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, add or update the configuration environment variables 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:
- Run:
kubectl -n rabbitmq-system edit deployment rabbitmq-cluster-operator
- 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,my-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,my-namespace"
# ... - 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 your changes.
Therefore, these updates must be synced every time
the Cluster Operator is updated. Consider using templating to add these variables automatically.
For example, using 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, or list of namespaces, which the operator will reconcile and watch RabbitmqClusters (independent of installation namespace). Use a comma separator, without spaces e.g. "project-1,project-2,rabbitmq-testing" | All namespaces are watched and reconciled |
DEFAULT_RABBITMQ_IMAGE | RabbitMQ container image used for new RabbitmqCluster Pods where not explicitly set in | 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 | 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 | 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. | The pprof debug endpoint will not be exposed on the Operator Pod. |
CONTROL_RABBITMQ_IMAGE | EXPERIMENTAL! When this is set to | The Operator does not control the image. The user is responsible for updating RabbitmqCluster image. |
LEASE_DURATION | Time, in seconds, that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack.
Default is 15 seconds. The value must be a string e.g. | Default value is set to 15 seconds. |
RENEW_DEADLINE | Renew deadline is the duration that the acting controlplane will retry refreshing leadership before giving up. Default is 10 seconds.
The value must be a string e.g. | Default value is set to 10 seconds. |
RETRY_PERIOD | Retry period is the duration the LeaderElector clients should wait between tries of actions. Default is 2 seconds.
The value must be a string e.g. | Default value is set to 2 seconds. |