Script to generate OLM (Operator-LifeCycle-Manager) Bundles for RabbitMQ Kubernetes operators
Starting from our operator manifests:
cluster-operator-manifest
messaging-topology-operator-manifest
The script is producing bundles like:
cluster-operator-olm-bundle
messaging-topology-operator-olm-bundle
That can be published to operatorhub/openshift marketplace
This script is mainly used by our operator pipelines:
But it can be used for testing/extension ecc...
Basic Guidelines followed:
https://olm.operatorframework.io/docs/tasks/creating-operator-bundle/
How to create, publish and test an OLM Bundle:
https://devopstales.github.io/home/oml/
the project is based on poetry
It can be used in this way:
poetry run generate_bundle ./rabbitmq_olm_package_repo/manifests_crds/cluster-operator.yaml 2.7.0 ./OLM_generated_bundle_example/rabbitmq-cluster-operator
poetry run generate_bundle ./rabbitmq_olm_package_repo/manifests_crds_messaging_topology_operator/messaging-topology-operator-with-certmanager.yaml 1.14.0 ./OLM_generated_bundle_example/rabbitmq-messaging-topology-operator
First parameter is the operator release file like:
The second parameter the version of the Bundle we are creating (Same version of the cluster operator)
Third parameter is the output folder where the bundle is generated
The script is based on ytt and a set of template files https://carvel.dev/ytt/
From a generator file containing metadata:
cluster-operator-generator-manifest
the script iss applying a set of ytt overlay defined in:
The script at the moment doesn't support the detection of new controllers and webhooks in the bundle
This is mainly because the mapping is completely different and at the moment the operators are stable (in the last 3 years just 2 new controllers were added in the messaging topology operator).
In case a new controller needs to be added you need to manually add it in the generator file:
messaging-topology-operator-generator-manifest
In case the controller uses a webhook (like in case of the messaging topology operator), also the webhook needs to be added in:
web-hook mapping
When using the OLM packaging to install and use the two RabbitMQ Kubernetes Operators: (RabbitMQ cluster operator and RabbitMQ Messaging Topology Operator) you need to follow the OLM general documentation:
https://olm.operatorframework.io/docs/
Interesting section are about (Installation and Upgrade):
https://docs.openshift.com/container-platform/4.15/operators/admin/olm-upgrading-operators.html
OG and Subscriptions:
https://olm.operatorframework.io/docs/advanced-tasks/operator-scoping-with-operatorgroups/
https://olm.operatorframework.io/docs/concepts/crds/subscription/
There are a few scenarios like (upgrade, certificate management, volume management) that may be different when using OLM.
In particular a few scenarios that diverge from the standard RabbitMQ operator documentation are:
- In the Messaging Topology Operator there is no need to use cert-manager as OLM already deploy and rotate certificates for the webhooks as described here: https://olm.operatorframework.io/docs/advanced-tasks/adding-admission-and-conversion-webhooks/ Also it is not possible (at the moment) for a user to provide their own certificates (as described as limitation in the same page). See also #21
- There are scenarios that requires a modifications on the Operator Deployment (for example mounting volumes or adding environment variables). This can't be done directly in OLM because the CSV will automatically revert these modifications. These scenarios can be implemented by templating the Subscription as described here: https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/subscription-config.md#configuring-operators-deployed-by-olm See also #11
You can run test with:
poetry run pytest
Test are automatically run by our github flow on every PR or merge on main.