Modifying the RabbitMQ Cluster Operator Default Configuration

This information describes how to modify the configuration of the RabbitMQ Cluster Kubernetes Operator in a Kubernetes cluster. You might want to do this to control how the Cluster Operator configures RabbitmqClusters. For example, it can be useful when you are configuring the operator to automatically use the RabbitMQ container images that are stored in a private registry.

To change the configuration to suit your needs, you must add the configuration environment variables and set them to the values you want by editing the Cluster Operator deployment manifest. This is the YAML manifest artefact that is released with every new version of the RabbitMQ Cluster Operator on GitHub. The environment variables that can be set are listed in the table in Cluster Operator Environment Variables.

Adding Cluster Operator Environment Variables to the Deployment Manifest

When the Cluster Operator is deployed, update the manifest by completing the following steps:

  1. Run:
kubectl -n rabbitmq-system edit deployment rabbitmq-cluster-operator
  1. Add the environment variables you want to change. In the following example, the OPERATOR_SCOPE_NAMESPACE environment variable is added and set to custom-namespace for the Cluster Operator.
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/component: rabbitmq-operator
    app.kubernetes.io/name: rabbitmq-cluster-operator
    app.kubernetes.io/part-of: rabbitmq
  name: rabbitmq-cluster-operator
  namespace: rabbitmq-system
spec:
  template:
    spec:
      containers:
      - command:
        - /manager
        env:
        - name: OPERATOR_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: OPERATOR_SCOPE_NAMESPACE
          value: custom-namespace
...
  1. Save the manifest. The Cluster Operator Pod is updated to use this configuration.

Important: Future GitHub releases for the RabbitMQ Cluster Operator will not have the changes that you are making now so you must make these updates everytime you update the Cluster Operator. You can consider using templating to add these variables automatically. For example, you can use a ytt overlay.

Example of Using ytt overlay to add Cluster Operator Environment Variables Automatically

values.yaml

#@ load("@ytt:overlay", "overlay")
#@ deployment = overlay.subset({"kind": "Deployment"})
#@ cluster_operator = overlay.subset({"metadata": {"name": "rabbitmq-cluster-operator"}})
#@overlay/match by=overlay.and_op(deployment, cluster_operator),expects="1+"
---
spec:
  template:
    spec:
      containers:
      #@overlay/match by=overlay.subset({"name": "operator"}),expects="1+"
      -
        #@overlay/match missing_ok=True
        env:
        - name: OPERATOR_SCOPE_NAMESPACE
          value: custom-namespace

Use this overlay when upgrading the operator to ensure your custom configuration is applied for the new version:

ytt -f https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml -f values.yaml | kubectl apply -f -

Cluster Operator Environment Variables

The following table listes the Cluster Operator environment variables that are available to set in the deployment manifest.

Variable Name Effect when Set Effect when not Set
OPERATOR_SCOPE_NAMESPACE Namespace which the operator will reconcile and watch RabbitmqClusters (independent of installation namespace) All namespaces are watched and reconciled
DEFAULT_RABBITMQ_IMAGE RabbitMQ container image used for new RabbitmqCluster Pods where not explicitly set in RabbitmqCluster.Spec.Image Operator uses the latest RabbitMQ container image available at time of release for new Pods
DEFAULT_USER_UPDATER_IMAGE Vault sidecar container image used for new RabbitmqCluster Pods where not explicitly set in RabbitmqCluster.Spec.SecretBackend.Vault.DefaultUserUpdaterImage Operator uses the latest sidecar container image available at time of release for new Pods
DEFAULT_IMAGE_PULL_SECRETS Comma-separated list of imagePullSecrets to set by default on all RabbitmqCluster Pods where not explicitly set in RabbitmqCluster.Spec.ImagePullSecrets New RabbitmqCluster Pods have no imagePullSecrets by default
ENABLE_DEBUG_PPROF The default value is false because this variable should NOT be used in production. When it is set to true, it exposes a set of debug endpoints on the Operator Pod's metrics port for CPU and [memory profiling of the Operator with pprof](./debug-operator.md#operator-resource-usage-profiling). The pprof debug endpoint will not be exposed on the Operator Pod.

check-circle-line exclamation-circle-line close-line
Scroll to top icon