Skip to content

Commit d3db920

Browse files
committed
Introduce STRIMZI_CENTRAL_CLUSTER_ID env var to identify the central cluster
and validate KafkaNodePool deployment targets in stretch cluster setups Signed-off-by: Aswin A <[email protected]>
1 parent b7e1107 commit d3db920

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

095-stretch-cluster.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,20 @@ The values of the environment variables use the following format:
131131
The secrets referenced here must contain the kubeconfig for the Kubernetes cluster available at the provided URL as the value of secret key 'kubeconfig'.
132132
This allows the central Strimzi operator to authenticate with multiple Kubernetes clusters.
133133
134+
```yaml
135+
- name: STRIMZI_CENTRAL_CLUSTER_ID
136+
value: <central-cluster-id>
137+
```
138+
139+
- `STRIMZI_CENTRAL_CLUSTER_ID` (Required)
140+
This environment variable defines the identifier (alias) of the central Kubernetes cluster, where the `Kafka` and `KafkaNodePool` CRs are created in a stretch Kafka deployment.
141+
This identifier must be unique and must not overlap with any of the cluster IDs defined in the `STRIMZI_REMOTE_KUBE_CONFIG` environment variable.
142+
This value is used to validate and match the `strimzi.io/stretch-cluster-alias` annotation in `KafkaNodePool` CR to determine whether the resources associated with a given node pool should be deployed in the central cluster.
143+
If a KafkaNodePool CR has a stretch cluster alias that matches the value of `STRIMZI_CENTRAL_CLUSTER_ID`, the operator will deploy the corresponding resources in the central cluster.
144+
145+
Configuring the central cluster's identity explicitly avoids ambiguity and eliminates the risk of unintentionally deploying to the central cluster when a typo or misconfiguration occurs in the alias.
146+
This ensures that invalid cluster identifiers always result in a reconciliation failure, leading to a clearer user experience and safer operations.
147+
134148
**Example Secret**
135149

136150
Below is an example Kubernetes Secret containing a kubeconfig for a remote cluster
@@ -221,7 +235,23 @@ metadata:
221235

222236
The identifier used here is required and must match one of the values defined by the user in 'Step 1' and added to the environment variable map value in 'Step 2'.
223237
This annotation is used to construct critical Kafka configuration properties such as `controller.quorum.voters` and `advertised.listeners`.
224-
If the identifier does not match any of the values defined in the `STRIMZI_REMOTE_KUBE_CONFIG` environment variable, the operator will deploy the node pool to the central Kubernetes cluster.
238+
The stretch cluster alias (defined via the annotation `strimzi.io/stretch-cluster-alias`) in the `KafkaNodePoo`l` CR must match exactly one of the following:
239+
- The value of the environment variable `STRIMZI_CENTRAL_CLUSTER_ID` (representing the current cluster the operator is running in), or
240+
- One of the cluster IDs defined in the `STRIMZI_REMOTE_KUBE_CONFIG` environment variable.
241+
242+
If the alias does not match either of these, the configuration is considered invalid, and reconciliation for the Kafka CR will fail with an error indicating that the target cluster is not recognized.
243+
244+
245+
#### Validation Matrix
246+
247+
| Kafka Stretch Enabled | `strimzi.io/stretch-cluster-alias` Present in KNP | Valid Alias (matches `STRIMZI_CENTRAL_CLUSTER_ID` or `STRIMZI_REMOTE_KUBE_CONFIG`) | Result |
248+
| :-------------------- | :------------------------------------------------ | :------------------------------------------------------------------------------------------| :---------------------------- |
249+
| false | no | - | ✅ Central-only, valid |
250+
| false | yes | - | ❌ Invalid, mixed config |
251+
| true | no | - | ❌ Invalid, alias required |
252+
| true | yes | ❌ no match | ❌ Invalid, unknown cluster alias |
253+
| true | yes | ✅ matches `STRIMZI_CENTRAL_CLUSTER_ID` | ✅ Deploy to central cluster |
254+
| true | yes | ✅ matches a cluster in `STRIMZI_REMOTE_KUBE_CONFIG` | ✅ Deploy to remote cluster |
225255

226256
#### Cluster operator behaviour
227257

0 commit comments

Comments
 (0)