Skip to content

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.

License

Notifications You must be signed in to change notification settings

alithethird/charmcraft

This branch is 15 commits behind canonical/charmcraft:main.

Folders and files

NameName
Last commit message
Last commit date
Mar 14, 2025
Mar 28, 2025
Mar 31, 2025
Mar 25, 2022
Mar 14, 2025
Feb 15, 2025
Mar 28, 2025
Mar 14, 2025
Sep 3, 2021
Jan 14, 2025
Jan 14, 2025
Sep 13, 2022
Mar 18, 2025
Feb 7, 2025
Dec 6, 2023
Apr 4, 2023
Nov 15, 2020
Mar 27, 2025
Jun 28, 2024
Sep 17, 2020
Apr 20, 2020
Jul 24, 2020
Feb 21, 2025
Feb 13, 2025
Apr 2, 2025
Dec 4, 2023
Jan 27, 2025
Oct 1, 2024
Feb 26, 2025
Mar 14, 2025
Oct 13, 2023
Jan 7, 2025
Mar 14, 2024
May 12, 2020
Jan 3, 2024
Feb 19, 2025
Mar 14, 2025

Repository files navigation

charmcraft Tests Spread Weekly Spread

Charmcraft -- easily initialise, pack, and publish your charms

Charmcraft is a CLI tool that makes it easy and quick to initialise, package, and publish Kubernetes and machine charms.

Give it a try

Let's use Charmcraft to initialise and pack a Kubernetes charm:

Set up

See Juju | Set things up.
Choose the automatic track and MicroK8s.

Initialise and pack your charm

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.

Clean up

See Juju | Tear things down.
Choose the automatic track.

Next steps

About

Collaborate, build and publish charmed operators for Kubernetes, Linux and Windows.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 95.6%
  • Jinja 2.9%
  • Other 1.5%