This Juju Charmed Operator is implemented using the Charmed Operator Framework, designed to deploy a standard OCI (e.g. Docker) ZooKeeper image alongside a sidecar container containing the Juju operator logic.
A non-sidecar version of this charm is also available on the Charmhub.
Developing
Create and activate a virtualenv with the development requirements:
$ git clone https://github.com/openstack-charmers/charm-zookeeper-k8s
$ cd charm-zookeeper-k8s/
$ virtualenv -p python3 venv
$ source venv/bin/activate
$ pip install -r requirements-dev.txt
Testing
The Python operator framework includes a very nice harness for testing operator behaviour without full deployment. Just run_tests
:
$ ./run_tests
Deploying from source
$ charmcraft pack
$ juju deploy ./zookeeper-k8s.charm -n 3 --resource zookeeper-image=zookeeper
Where:
-
-n
: the number of Juju units to deploy, i.e. the number of wanted k8s pods. Any number>= 1
is supported but for production you should pick an odd number>= 3
. -
zookeeper-image
: OCI (e.g. Docker) ZooKeeper image. Usezookeeper
for the latest image from DockerHub.