Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Charmcraft is a CLI tool that makes it easy and quick to initialise, package, and publish Kubernetes and machine charms. It is an official component of the Charm SDK, itself a part of the Juju universe.
Juju | Learn how to quickly deploy, integrate, and manage charms on any cloud with Juju. It's as simple as juju deploy foo , juju integrate foo bar , ..., on any cloud. | |
Charmhub | Sample our existing charms on Charmhub. A charm can be a cluster (OpenStack, Kubernetes), a data platform (PostgreSQL, MongoDB, etc.), an observability stack (Canonical Observability Stack), an MLOps solution (Kubeflow), and so much more. | |
:point_right: | Charm SDK | Write your own charm! Juju is written in Go, but our SDK supports easy charm development in Python. |
Let's use Charmcraft to initialise and pack a Kubernetes charm:
See Charm SDK | Set up your development environment automatically > Set up an Ubuntu
charm-dev
VM with Multipass.
Choose the MicroK8s track.
In your Multipass VM shell, create a charm directory and use Charmcraft to initialise your charm file structure:
mkdir my-new-charm
cd my-new-charm
charmcraft init
This has created a standard charm directory structure:
$ ls -R
.:
CONTRIBUTING.md README.md pyproject.toml src tox.ini
LICENSE charmcraft.yaml requirements.txt tests
./src:
charm.py
./tests:
integration unit
./tests/integration:
test_charm.py
./tests/unit:
test_charm.py
Poke around:
Note that the charmcraft.yaml
file shows that what we have is an example charm called my-new-charm
, which builds on Ubuntu 22.04 and which uses an OCI image resource httpbin
from kennethreitz/httpbin
.
Note that the src/charm.py
file contains code scaffolding featuring the Charm SDK's Ops library for writing charms.
Explore further, start editing the files, or skip ahead and pack the charm:
charmcraft pack
If you didn't take any wrong turn or simply left the charm exactly as it was, this should work and yield a file called my-new-charm_ubuntu-22.04-amd64.charm
(the architecture bit may be different depending on your system's architecture). Use this name and the resource from the metadata.yaml
to deploy your example charm to your local MicroK8s cloud with Juju:
juju deploy ./my-new-charm_ubuntu-22.04-amd64.charm --resource httpbin-image=kennethreitz/httpbin
Congratulations, you’ve just initialised and packed your first Kubernetes charm using Charmcraft!
But Charmcraft goes far beyond init
and pack
. For example, when you're ready to share your charm with the world, you can use Charmcraft to publish your charm on Charmhub. Run charmcraft help
to preview more.
See Charm SDK | Set up your development environment automatically > Clean up.
Read our user documentation, which also includes other guides showing Charmcraft in action
Read our Code of conduct and:
FAQs
The main tool to build, upload, and develop in general the Juju charms.
We found that charmcraft demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.