Skip to content

Conversation

maltesander
Copy link
Member

@maltesander maltesander commented Sep 4, 2025

Description

This PR add a new role controller to configure KRaft instead of ZooKeeper. This is prep work for Kafka 4.0, where ZooKeeper is removed.

fixes #690

BREAKING Changes:

  • renamed server.properties to broker.properties and controller.properties respectively (this affects e.g. config overrides)

What was done?

  • CRD:
    • make zookeeperConfigmapName optional
    • split KafkaConfig into Broker and Controller config
    • split out common configs (e.g. resources)
    • added controller role
    • split roles to own module
  • Product config:
    • clean out properties
    • remove zookeeper.connect, zookeeper.timeout (never used or overwritten in zk mode)
    • add controller to product config machinery
  • Implementation
    • Added sanity check to have Kafka4.0 / Controller and zookeeper mutually exclusive
    • introduce AnyConfig to better handle different config types
    • rework container commands and split to own module
      • KRaft formatting
      • node.id handling
    • rework resources (statefulset, configmap, service) and split to own module
    • increased default broker memory to 2gb
    • removed obsolete errors
    • better constants and config handling
    • hashing for "random" but deterministic integers for node.id
    • cluster-id is set to KafkaCluster metadata.uid
  • Tests:
    • Added use-kraft-controller dimension in almost all tests to split between Kraft / zk

What was not done?

  • (Stackable) Listener
  • Discovery
  • Actual Kafka 4.0 support

TODO

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

@maltesander maltesander marked this pull request as ready for review September 8, 2025 06:38
@sbernauer sbernauer requested a review from razvan September 11, 2025 07:16
Copy link
Member

@razvan razvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a first round of reading. Have some comments/suggestions.

Testing a bit more now.

/// Supporting Kraft alongside Zookeeper requires a couple of CRD checks
/// - If Kafka 4 and higher is used, no zookeeper config map ref has to be provided
/// - Configuring the controller role means no zookeeper config map ref has to be provided
pub fn check_kraft_vs_zookeeper(&self, product_version: &str) -> Result<(), Error> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this implicit decision a dedicated field could be used that explicitly puts the cluster in Zookeeper or Kraft mode.

It is possible to create a Kafka cluster in Kraft mode without any spec.controllers property.

Being explicit about the metadata manager/handler will be needed later to support migrations when both Zookeeper and controllers must be running at the same time.

My suggestion for the field would be kraft_mode: [OFF|COMBINED|MIGRATING|ON]

This PR can ignore COMBINED and MIGRATING.

@@ -62,17 +62,21 @@ dimensions:
- "cluster-internal"
- "external-stable"
- "external-unstable"
- name: use-kraft-controller
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on Slack, this is too long. Maybe rename to just kraft similarly to openshift.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now using zookeeper and zookeeper-latest dimension for kraft with value "false".

@Techassi Techassi self-requested a review September 15, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/action-required Denotes a PR that introduces potentially breaking changes that require user action.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support deploying Kafka with KRaft instead of ZooKeeper for consensus building
2 participants