To set up a charm project, create a directory for your charm, enter it, then run charmcraft init
with the --profile
flag followed by a suitable profile name (for machine charms: machine
; for Kubernetes charms: kubernetes
, simple
, or flask-framework
); that will create all the necessary files and even prepopulate them with useful content.
charmcraft init --profile <profile>
See sample session
$ mkdir my-flask-app-k8s
$ cd my-flask-app-k8s/
$ charmcraft init --profile flask-framework
Charmed operator package file and directory tree initialised.
Now edit the following package files to provide fundamental charm metadata
and other information:
charmcraft.yaml
src/charm.py
README.md
$ ls -R
.:
charmcraft.yaml requirements.txt src
./src:
charm.py
The command also allows you to not specify any profile (in that case you get the simple
profile – a Kubernetes profile with lots of scaffolding, suitable for beginners) and has flags that you can use to specify a different directory to operate in, a charm name different from the name of the root directory, etc.
See more:
charmcraft init
, Profile, List of files in the charm project
Contributors: @jdkandersson, @mmkay, @tmihoc, @weii-wang