Skip to content

Commit cb36c43

Browse files
committed
Add annotation-based toggle for enabling stretch Kafka clusters
Signed-off-by: Aswin A <[email protected]>
1 parent 4fdb733 commit cb36c43

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

095-stretch-cluster.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@ data:
146146
kubeconfig: <base64-encoded-kubeconfig>
147147
```
148148
149-
When the `STRIMZI_REMOTE_KUBE_CONFIG` environment variable is set, the Cluster Operator will recognize that it needs to deploy a stretch Kafka cluster.
150-
151-
In this mode, any `StrimziPodSet` resources created in a remote cluster will include the annotation `strimzi.io/remote-podset: true`.
152-
This annotation allows the remote cluster’s Strimzi operator to reconcile the StrimziPodSet independently, without requiring the presence of the `Kafka` and `KafkaNodePool` custom resources in the same cluster.
153-
154149
##### Remote cluster operator configuration
155150
156151
When deploying the operator to remote clusters, the operator must be configured to reconcile only StrimziPodSet resources by setting the existing environment variable:
@@ -173,11 +168,32 @@ The official Strimzi documentation should clearly state that it is necessary to
173168

174169
##### Kafka CR
175170

176-
There is no change required to the Kafka custom resource (Kafka CR).
177-
The Kafka resource remains exactly as defined in the existing Strimzi API, and users can continue to define their cluster configurations in the standard way.
178-
Remote cluster access credentials are configured through environment variables in the Cluster Operator deployment.
179-
This simplifies the Kafka CR and keeps global operational concerns decoupled from workload specifications.
180-
Cluster-specific configuration, such as the target remote cluster for each node pool, is specified in the KafkaNodePool CR via annotations.
171+
To enable stretch cluster functionality, users must explicitly opt in by adding the following annotation to the Kafka resource:
172+
173+
```yaml
174+
metadata:
175+
annotations:
176+
strimzi.io/enable-stretch-cluster: "true"
177+
```
178+
179+
This annotation signals the user's intent to deploy a stretch Kafka cluster.
180+
However, stretch mode is only activated if both of the following conditions are met:
181+
182+
- The Kafka CR has the `strimzi.io/enable-stretch-cluster: "true"` annotation, and
183+
- The Cluster Operator has the `STRIMZI_REMOTE_KUBE_CONFIG` environment variable set with access credentials for the remote clusters.
184+
185+
If either condition is not satisfied, the deployment falls back to a standard single-cluster setup. In such cases, the operator will log a warning such as:
186+
187+
```
188+
Stretch cluster requested via annotation, but STRIMZI_REMOTE_KUBE_CONFIG is not configured — defaulting to single-cluster deployment.
189+
```
190+
191+
This design ensures:
192+
193+
- No changes are required to the Kafka CRD.
194+
- Stretch and non-stretch Kafka deployments can co-exist under the same Cluster Operator instance.
195+
- Users receive clear feedback when configuration is incomplete or inconsistent.
196+
181197

182198
##### KafkaNodePool CR
183199

@@ -345,7 +361,7 @@ The key additional entry in stretch mode is
345361
DNS:<pod-name>.<stretch-cluster-id>.<service-name>.<namespace>.svc.clusterset.local
346362
```
347363
348-
This entry is added only when stretch mode is enabled (i.e., when `STRIMZI_REMOTE_KUBE_CONFIG` is configured).
364+
This entry is added only when stretch mode is enabled (i.e., `STRIMZI_REMOTE_KUBE_CONFIG` environment variable is set and the `Kafka` CR is annotated with `strimzi.io/enable-stretch-cluster: "true`).
349365
Regular single-cluster deployments do not include this entry, preserving the existing SAN generation logic.
350366
This ensures secure, DNS-verifiable TLS communication between Kafka nodes across clusters without compromising on hostname verification or requiring any changes to Kafka's default TLS configuration.
351367

0 commit comments

Comments
 (0)