This documents explains the processes and practices recommended for contributing enhancements to this operator.
- If you would like to chat with us about your use-cases, you can reach us at Discourse.
- Familiarising yourself with the Charmed Operator Framework library will help you a lot when working on new features or bug fixes.
- All enhancements require review before being merged. Code review typically examines
- code quality
- test coverage
- user experience for Juju administrators this charm.
- Please help us out in ensuring easy to review branches by rebasing your pull request branch onto
the
main
branch. This also avoids merge commits and creates a linear Git commit history.
You can create an environment for development with tox
:
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements-dev.txt
pip install tox
The charm additionally requires the following relations:
- ingress, interface: ingress
- database, interface: postgresql_client
- vault, interface: vault-kv
- openfga, interface: openfga
- certificates, interface: tls-certificates
tox -e fmt # update your code according to linting rules
tox -e lint # code style
tox -e unit # unit tests
tox -e integration # integration tests
tox # runs 'lint' and 'unit' environments
Build the charm in this git repository using:
charmcraft pack
# Create a model
juju add-model dev
# Enable DEBUG logging
juju model-config logging-config="<root>=INFO;unit=DEBUG"
# Deploy the charm
juju deploy ./juju-jimm-k8s_ubuntu-22.04-amd64.charm
Integration tests require the following setup:
-
A microk8s cluster -
sudo snap install microk8s
-
Enable add-ons -
sudo microk8s enable ingress hostpath-storage dns registry
-
Ensure rbac is disabled -
sudo microk8s disable rbac
-
Enable load-balancer add-on
sudo microk8s enable metallb
. Supply a CIDR like10.64.140.0/24
-
A Juju controller on microk8s
juju bootstrap microk8s
-
kubectl
must be installed -sudo snap install kubectl
-
Your kubectl must be configured to talk to microk8s -
microk8s config > ~/.kube/config
-
Setup the ability for Microk8s to pull from a private ghcr (Github Container Registry):
-
Obtain a Github PAT token that has at least
read:packages
access and can accessgit.luolix.top/canonical/jimm
. -
Run the following commands (adding values for the username/password placeholders):
read -r -d '' REGISTRY_CONFIG << EOL || true [plugins."io.containerd.grpc.v1.cri".registry.configs."ghcr.io".auth] username = "<your-username-here>" password = "<your-PAT-token-here>" EOL echo "$REGISTRY_CONFIG" | sudo tee -a /var/snap/microk8s/current/args/containerd-template.toml sudo snap restart microk8s.daemon-containerd
-
-
Create the
venv
and installtox
as described above. -
Run the test (optionally keep the model for debugging) -
tox -e integration -- --keep-models