From cbd844d6ecb37ef746e89441213075afeb939433 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Tue, 29 Sep 2026 13:36:40 +0200 Subject: [PATCH 1/2] fix: Use PascalCase for `metadataManager` field in CRD --- CHANGELOG.md | 4 ++++ .../examples/kraft_migration/01-setup.yaml | 2 +- .../kraft_migration/02-start-controllers.yaml | 2 +- .../kraft_migration/03-migrate-metadata.yaml | 2 +- .../kraft_migration/04-migrate-brokers.yaml | 2 +- .../kraft_migration/05-kraft-mode.yaml | 2 +- .../mirror_maker/01-setup-source.yaml | 2 +- .../mirror_maker/02-setup-target.yaml | 2 +- .../pages/usage-guide/kraft-controller.adoc | 2 +- extra/crds.yaml | 13 +++++++----- .../src/controller/build/mod.rs | 4 ++-- .../controller/build/resource/statefulset.rs | 2 +- .../src/controller/validate.rs | 8 +++---- rust/operator-binary/src/crd/mod.rs | 21 ++++++++++++------- .../kraft-kerberos/20-install-kafka.yaml.j2 | 2 +- .../60-scale-controller-up.yaml.j2 | 2 +- .../70-scale-controller-down.yaml.j2 | 2 +- .../operations-kraft/20-install-kafka.yaml.j2 | 2 +- .../operations-kraft/25-pause-kafka.yaml.j2 | 2 +- .../operations-kraft/30-stop-kafka.yaml.j2 | 2 +- .../operations-kraft/50-restart-kafka.yaml.j2 | 2 +- .../60-scale-controller-up.yaml.j2 | 2 +- .../70-scale-controller-down.yaml.j2 | 2 +- .../80-scale-broker-down.yaml.j2 | 2 +- .../90-controller-shutdown.yaml.j2 | 2 +- .../smoke-kraft/30-install-kafka.yaml.j2 | 2 +- .../kuttl/upgrade/02-install-kafka.yaml.j2 | 2 +- 27 files changed, 54 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cdeb3b9..ecec5949 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,10 @@ All notable changes to this project will be documented in this file. - A KRaft cluster without a `controllers` role is now rejected during validation. Previously, the operator would create a cluster consisting only of `brokers` which would never become healthy ([#1010]). +- `spec.clusterConfig.metadataManager` now uses PascalCase values (`ZooKeeper` and `KRaft`) as per + Kubernetes conventions. The lowercase values `zookeeper` and `kraft` are deprecated, but are still + accepted for backwards compatibility and may be removed in a future release ([#TODO]). +- TODO: Add to deprecation board ### Removed diff --git a/docs/modules/kafka/examples/kraft_migration/01-setup.yaml b/docs/modules/kafka/examples/kraft_migration/01-setup.yaml index 4274863e..f038f30b 100644 --- a/docs/modules/kafka/examples/kraft_migration/01-setup.yaml +++ b/docs/modules/kafka/examples/kraft_migration/01-setup.yaml @@ -84,7 +84,7 @@ spec: productVersion: 3.9.2 pullPolicy: IfNotPresent clusterConfig: - metadataManager: zookeeper + metadataManager: ZooKeeper brokerIdPodConfigMapName: broker-ids authentication: - authenticationClass: kafka-client-auth-tls diff --git a/docs/modules/kafka/examples/kraft_migration/02-start-controllers.yaml b/docs/modules/kafka/examples/kraft_migration/02-start-controllers.yaml index c4e2eeb5..10403210 100644 --- a/docs/modules/kafka/examples/kraft_migration/02-start-controllers.yaml +++ b/docs/modules/kafka/examples/kraft_migration/02-start-controllers.yaml @@ -9,7 +9,7 @@ spec: productVersion: 3.9.2 pullPolicy: IfNotPresent clusterConfig: - metadataManager: zookeeper + metadataManager: ZooKeeper authentication: - authenticationClass: kafka-client-auth-tls tls: diff --git a/docs/modules/kafka/examples/kraft_migration/03-migrate-metadata.yaml b/docs/modules/kafka/examples/kraft_migration/03-migrate-metadata.yaml index 34fab66b..dc5d891e 100644 --- a/docs/modules/kafka/examples/kraft_migration/03-migrate-metadata.yaml +++ b/docs/modules/kafka/examples/kraft_migration/03-migrate-metadata.yaml @@ -9,7 +9,7 @@ spec: productVersion: 3.9.2 pullPolicy: IfNotPresent clusterConfig: - metadataManager: zookeeper + metadataManager: ZooKeeper authentication: - authenticationClass: kafka-client-auth-tls tls: diff --git a/docs/modules/kafka/examples/kraft_migration/04-migrate-brokers.yaml b/docs/modules/kafka/examples/kraft_migration/04-migrate-brokers.yaml index c48f88c5..43f160bf 100644 --- a/docs/modules/kafka/examples/kraft_migration/04-migrate-brokers.yaml +++ b/docs/modules/kafka/examples/kraft_migration/04-migrate-brokers.yaml @@ -9,7 +9,7 @@ spec: productVersion: 3.9.2 pullPolicy: IfNotPresent clusterConfig: - metadataManager: zookeeper + metadataManager: ZooKeeper authentication: - authenticationClass: kafka-client-auth-tls tls: diff --git a/docs/modules/kafka/examples/kraft_migration/05-kraft-mode.yaml b/docs/modules/kafka/examples/kraft_migration/05-kraft-mode.yaml index 93de2360..686c7100 100644 --- a/docs/modules/kafka/examples/kraft_migration/05-kraft-mode.yaml +++ b/docs/modules/kafka/examples/kraft_migration/05-kraft-mode.yaml @@ -9,7 +9,7 @@ spec: productVersion: 3.9.2 pullPolicy: IfNotPresent clusterConfig: - metadataManager: kraft + metadataManager: KRaft authentication: - authenticationClass: kafka-client-auth-tls tls: diff --git a/docs/modules/kafka/examples/mirror_maker/01-setup-source.yaml b/docs/modules/kafka/examples/mirror_maker/01-setup-source.yaml index dfc96a21..c623c8a7 100644 --- a/docs/modules/kafka/examples/mirror_maker/01-setup-source.yaml +++ b/docs/modules/kafka/examples/mirror_maker/01-setup-source.yaml @@ -74,7 +74,7 @@ spec: productVersion: 3.9.2 pullPolicy: IfNotPresent clusterConfig: - metadataManager: zookeeper + metadataManager: ZooKeeper authentication: - authenticationClass: source-client-auth tls: diff --git a/docs/modules/kafka/examples/mirror_maker/02-setup-target.yaml b/docs/modules/kafka/examples/mirror_maker/02-setup-target.yaml index e5c51b6c..50729915 100644 --- a/docs/modules/kafka/examples/mirror_maker/02-setup-target.yaml +++ b/docs/modules/kafka/examples/mirror_maker/02-setup-target.yaml @@ -44,7 +44,7 @@ spec: productVersion: 3.9.2 pullPolicy: IfNotPresent clusterConfig: - metadataManager: kraft + metadataManager: KRaft authentication: - authenticationClass: target-client-auth tls: diff --git a/docs/modules/kafka/pages/usage-guide/kraft-controller.adoc b/docs/modules/kafka/pages/usage-guide/kraft-controller.adoc index 1d176745..1cc0fa24 100644 --- a/docs/modules/kafka/pages/usage-guide/kraft-controller.adoc +++ b/docs/modules/kafka/pages/usage-guide/kraft-controller.adoc @@ -29,7 +29,7 @@ metadata: name: kafka spec: clusterConfig: - metadataManager: kraft + metadataManager: KRaft image: productVersion: "3.9.2" brokers: diff --git a/extra/crds.yaml b/extra/crds.yaml index 9283cc4f..8b954ae6 100644 --- a/extra/crds.yaml +++ b/extra/crds.yaml @@ -1030,16 +1030,17 @@ spec: IMPORTANT: This property will be removed as soon as Kafka 3.x support is dropped. - Possible values are `zookeeper` and `kraft`. + Possible values are `ZooKeeper` and `KRaft`. The lowercase values `zookeeper` and `kraft` + are deprecated, but still accepted. If not set, defaults to: - - `zookeeper` for Kafka versions below `4.0.0`. - - `kraft` for Kafka versions `4.0.0` and higher. + - `ZooKeeper` for Kafka versions below `4.0.0`. + - `KRaft` for Kafka versions `4.0.0` and higher. - Using `zookeeper` for Kafka versions `4.0.0` and higher is not supported. + Using `ZooKeeper` for Kafka versions `4.0.0` and higher is not supported. - When set to `kraft`, the operator will perform the following actions: + When set to `KRaft`, the operator will perform the following actions: * Generate the Kafka cluster id. * Assign broker roles and configure controller quorum voters in the `broker.properties` files. @@ -1051,6 +1052,8 @@ spec: This property is also useful when migrating from ZooKeeper to Kraft mode because it permits the operator to reconcile controllers while still using ZooKeeper for brokers. enum: + - ZooKeeper + - KRaft - zookeeper - kraft - null diff --git a/rust/operator-binary/src/controller/build/mod.rs b/rust/operator-binary/src/controller/build/mod.rs index 1be5313e..00218291 100644 --- a/rust/operator-binary/src/controller/build/mod.rs +++ b/rust/operator-binary/src/controller/build/mod.rs @@ -267,7 +267,7 @@ mod tests { image: productVersion: 3.9.2 clusterConfig: - metadataManager: kraft + metadataManager: KRaft controllers: roleGroups: default: @@ -295,7 +295,7 @@ mod tests { image: productVersion: 3.9.2 clusterConfig: - metadataManager: kraft + metadataManager: KRaft controllers: roleGroups: default: diff --git a/rust/operator-binary/src/controller/build/resource/statefulset.rs b/rust/operator-binary/src/controller/build/resource/statefulset.rs index 8dc01278..00f9af0b 100644 --- a/rust/operator-binary/src/controller/build/resource/statefulset.rs +++ b/rust/operator-binary/src/controller/build/resource/statefulset.rs @@ -1030,7 +1030,7 @@ mod tests { image: productVersion: 3.9.2 clusterConfig: - metadataManager: kraft + metadataManager: KRaft controllers: roleGroups: default: diff --git a/rust/operator-binary/src/controller/validate.rs b/rust/operator-binary/src/controller/validate.rs index dd3bafb5..3f4017a1 100644 --- a/rust/operator-binary/src/controller/validate.rs +++ b/rust/operator-binary/src/controller/validate.rs @@ -485,7 +485,7 @@ mod tests { image: productVersion: 3.9.2 clusterConfig: - metadataManager: kraft + metadataManager: KRaft controllers: roleGroups: default: @@ -587,7 +587,7 @@ mod tests { image: productVersion: 3.9.2 clusterConfig: - metadataManager: kraft + metadataManager: KRaft controllers: roleGroups: default: @@ -657,7 +657,7 @@ mod tests { image: productVersion: 3.9.2 clusterConfig: - metadataManager: kraft + metadataManager: KRaft controllers: roleGroups: a: @@ -699,7 +699,7 @@ mod tests { image: productVersion: 3.9.2 clusterConfig: - metadataManager: kraft + metadataManager: KRaft controllers: roleGroups: default: diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 8d7babd1..28ca3213 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -194,16 +194,17 @@ pub mod versioned { /// /// IMPORTANT: This property will be removed as soon as Kafka 3.x support is dropped. /// - /// Possible values are `zookeeper` and `kraft`. + /// Possible values are `ZooKeeper` and `KRaft`. The lowercase values `zookeeper` and `kraft` + /// are deprecated, but still accepted. /// /// If not set, defaults to: /// - /// - `zookeeper` for Kafka versions below `4.0.0`. - /// - `kraft` for Kafka versions `4.0.0` and higher. + /// - `ZooKeeper` for Kafka versions below `4.0.0`. + /// - `KRaft` for Kafka versions `4.0.0` and higher. /// - /// Using `zookeeper` for Kafka versions `4.0.0` and higher is not supported. + /// Using `ZooKeeper` for Kafka versions `4.0.0` and higher is not supported. /// - /// When set to `kraft`, the operator will perform the following actions: + /// When set to `KRaft`, the operator will perform the following actions: /// /// * Generate the Kafka cluster id. /// * Assign broker roles and configure controller quorum voters in the `broker.properties` files. @@ -365,9 +366,15 @@ pub struct KafkaClusterStatus { Serialize, EnumString, )] -#[serde(rename_all = "lowercase")] +#[serde(rename_all = "PascalCase")] +// schemars ignores `#[serde(alias)]` (https://github.com/GREsau/schemars/issues/338), so we need to +// list the aliases in the schema manually. Otherwise the API server rejects them. +#[schemars(extend("enum" = ["ZooKeeper", "KRaft", "zookeeper", "kraft"]))] pub enum MetadataManager { + // The lowercase aliases are deprecated and only kept for backwards compatibility. + #[serde(alias = "zookeeper")] ZooKeeper, + #[serde(alias = "kraft")] KRaft, } @@ -669,7 +676,7 @@ mod tests { reconciliationPaused: false stopped: true clusterConfig: - metadataManager: kraft + metadataManager: KRaft authentication: - authenticationClass: my-kerberos authorization: diff --git a/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 b/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 index 4a7052fd..1acec1f1 100644 --- a/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/kraft-kerberos/20-install-kafka.yaml.j2 @@ -29,7 +29,7 @@ commands: pullPolicy: IfNotPresent clusterConfig: # KRaft: metadata is managed by the controllers role, no ZooKeeper involved. - metadataManager: kraft + metadataManager: KRaft authentication: - authenticationClass: kerberos-auth-$NAMESPACE tls: diff --git a/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 b/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 index 924b9104..05c0fb4a 100644 --- a/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 +++ b/tests/templates/kuttl/kraft-kerberos/60-scale-controller-up.yaml.j2 @@ -21,7 +21,7 @@ commands: pullPolicy: IfNotPresent clusterConfig: # KRaft: metadata is managed by the controllers role, no ZooKeeper involved. - metadataManager: kraft + metadataManager: KRaft authentication: - authenticationClass: kerberos-auth-$NAMESPACE tls: diff --git a/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 b/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 index 29fa460b..69ade078 100644 --- a/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 +++ b/tests/templates/kuttl/kraft-kerberos/70-scale-controller-down.yaml.j2 @@ -21,7 +21,7 @@ commands: pullPolicy: IfNotPresent clusterConfig: # KRaft: metadata is managed by the controllers role, no ZooKeeper involved. - metadataManager: kraft + metadataManager: KRaft authentication: - authenticationClass: kerberos-auth-$NAMESPACE tls: diff --git a/tests/templates/kuttl/operations-kraft/20-install-kafka.yaml.j2 b/tests/templates/kuttl/operations-kraft/20-install-kafka.yaml.j2 index 704cacaa..d43e7a18 100644 --- a/tests/templates/kuttl/operations-kraft/20-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/20-install-kafka.yaml.j2 @@ -17,7 +17,7 @@ spec: {% endif %} pullPolicy: IfNotPresent clusterConfig: - metadataManager: kraft + metadataManager: KRaft {% if lookup('env', 'VECTOR_AGGREGATOR') %} vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} diff --git a/tests/templates/kuttl/operations-kraft/25-pause-kafka.yaml.j2 b/tests/templates/kuttl/operations-kraft/25-pause-kafka.yaml.j2 index 563e72a5..7ce3ecbd 100644 --- a/tests/templates/kuttl/operations-kraft/25-pause-kafka.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/25-pause-kafka.yaml.j2 @@ -17,7 +17,7 @@ spec: {% endif %} pullPolicy: IfNotPresent clusterConfig: - metadataManager: kraft + metadataManager: KRaft {% if lookup('env', 'VECTOR_AGGREGATOR') %} vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} diff --git a/tests/templates/kuttl/operations-kraft/30-stop-kafka.yaml.j2 b/tests/templates/kuttl/operations-kraft/30-stop-kafka.yaml.j2 index cafaf9ba..ec5e9fe5 100644 --- a/tests/templates/kuttl/operations-kraft/30-stop-kafka.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/30-stop-kafka.yaml.j2 @@ -17,7 +17,7 @@ spec: {% endif %} pullPolicy: IfNotPresent clusterConfig: - metadataManager: kraft + metadataManager: KRaft {% if lookup('env', 'VECTOR_AGGREGATOR') %} vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} diff --git a/tests/templates/kuttl/operations-kraft/50-restart-kafka.yaml.j2 b/tests/templates/kuttl/operations-kraft/50-restart-kafka.yaml.j2 index a6ad4ec2..1a803bdb 100644 --- a/tests/templates/kuttl/operations-kraft/50-restart-kafka.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/50-restart-kafka.yaml.j2 @@ -16,7 +16,7 @@ spec: productVersion: "{{ test_scenario['values']['kafka-kraft'] }}" {% endif %} clusterConfig: - metadataManager: kraft + metadataManager: KRaft {% if lookup('env', 'VECTOR_AGGREGATOR') %} vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} diff --git a/tests/templates/kuttl/operations-kraft/60-scale-controller-up.yaml.j2 b/tests/templates/kuttl/operations-kraft/60-scale-controller-up.yaml.j2 index 5ce9614a..d412ed89 100644 --- a/tests/templates/kuttl/operations-kraft/60-scale-controller-up.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/60-scale-controller-up.yaml.j2 @@ -16,7 +16,7 @@ spec: productVersion: "{{ test_scenario['values']['kafka-kraft'] }}" {% endif %} clusterConfig: - metadataManager: kraft + metadataManager: KRaft {% if lookup('env', 'VECTOR_AGGREGATOR') %} vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} diff --git a/tests/templates/kuttl/operations-kraft/70-scale-controller-down.yaml.j2 b/tests/templates/kuttl/operations-kraft/70-scale-controller-down.yaml.j2 index a6ad4ec2..1a803bdb 100644 --- a/tests/templates/kuttl/operations-kraft/70-scale-controller-down.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/70-scale-controller-down.yaml.j2 @@ -16,7 +16,7 @@ spec: productVersion: "{{ test_scenario['values']['kafka-kraft'] }}" {% endif %} clusterConfig: - metadataManager: kraft + metadataManager: KRaft {% if lookup('env', 'VECTOR_AGGREGATOR') %} vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} diff --git a/tests/templates/kuttl/operations-kraft/80-scale-broker-down.yaml.j2 b/tests/templates/kuttl/operations-kraft/80-scale-broker-down.yaml.j2 index ee4cb139..f81e675e 100644 --- a/tests/templates/kuttl/operations-kraft/80-scale-broker-down.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/80-scale-broker-down.yaml.j2 @@ -23,7 +23,7 @@ spec: {% endif %} {% if lookup('env', 'VECTOR_AGGREGATOR') %} clusterConfig: - metadataManager: kraft + metadataManager: KRaft vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} controllers: diff --git a/tests/templates/kuttl/operations-kraft/90-controller-shutdown.yaml.j2 b/tests/templates/kuttl/operations-kraft/90-controller-shutdown.yaml.j2 index 6ccff4ad..821554df 100644 --- a/tests/templates/kuttl/operations-kraft/90-controller-shutdown.yaml.j2 +++ b/tests/templates/kuttl/operations-kraft/90-controller-shutdown.yaml.j2 @@ -23,7 +23,7 @@ spec: {% endif %} {% if lookup('env', 'VECTOR_AGGREGATOR') %} clusterConfig: - metadataManager: kraft + metadataManager: KRaft vectorAggregatorConfigMapName: vector-aggregator-discovery {% endif %} controllers: diff --git a/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 b/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 index 95d85da6..f8040b9d 100644 --- a/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/smoke-kraft/30-install-kafka.yaml.j2 @@ -69,7 +69,7 @@ spec: {% endif %} pullPolicy: IfNotPresent clusterConfig: - metadataManager: kraft + metadataManager: KRaft authentication: - authenticationClass: test-kafka-client-auth-tls tls: diff --git a/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 b/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 index 972b8251..0875083a 100644 --- a/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 +++ b/tests/templates/kuttl/upgrade/02-install-kafka.yaml.j2 @@ -34,7 +34,7 @@ spec: clusterConfig: # Need to set this explicitly because the default would be zookeeper for 3.9.2 # but we don't want to test zookeeper -> kraft migration here - metadataManager: kraft + metadataManager: KRaft {% if test_scenario['values']['use-client-auth-tls'] == 'true' %} authentication: - authenticationClass: test-kafka-client-auth-tls From 70bff0044521c6120e825df9716ac3be9f76b0c5 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Tue, 29 Sep 2026 13:46:42 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecec5949..4e5c6c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,8 +59,7 @@ All notable changes to this project will be documented in this file. become healthy ([#1010]). - `spec.clusterConfig.metadataManager` now uses PascalCase values (`ZooKeeper` and `KRaft`) as per Kubernetes conventions. The lowercase values `zookeeper` and `kraft` are deprecated, but are still - accepted for backwards compatibility and may be removed in a future release ([#TODO]). -- TODO: Add to deprecation board + accepted for backwards compatibility and may be removed in a future release ([#1034]). ### Removed @@ -83,6 +82,7 @@ All notable changes to this project will be documented in this file. [#1021]: https://github.com/stackabletech/kafka-operator/pull/1021 [#1022]: https://github.com/stackabletech/kafka-operator/pull/1022 [#1024]: https://github.com/stackabletech/kafka-operator/pull/1024 +[#1034]: https://github.com/stackabletech/kafka-operator/pull/1034 ## [26.7.0] - 2026-07-21