Strimzi uses init container to gather additional information about the running Kafka node. This is done in two situations:
For node port listeners, we need to find out the node address to use it as advertised address
For rack awareness, we need to find the corresponding label to configure the rack
Right now, we configure the init container for all Kafka nodes. But it is really needed only for broker or mixed nodes. Controller-only nodes do not need it because:
They are never exposed through node ports
Rack awareness does not make sense for them since they have only the metadata topic with replicas on each controller - so there is nothing to distribute.
This PR cleans up the code and configures the init container, the related volumes and volume mounts only when the node has the broker role. It does not affect the Cluster Role Binding to access the Kuberetes API because all Kafka nodes share the same service account.
I also decided to keep the affinity. While the rack does not need to be configured in the controller nodes, they should ideally be still distributed across the zones/racks and the best-effort affinity might help with it.
Checklist
[x] Write tests
[x] Make sure all tests pass
[x] Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
Type of change
Description
Strimzi uses init container to gather additional information about the running Kafka node. This is done in two situations:
Right now, we configure the init container for all Kafka nodes. But it is really needed only for broker or mixed nodes. Controller-only nodes do not need it because:
This PR cleans up the code and configures the init container, the related volumes and volume mounts only when the node has the broker role. It does not affect the Cluster Role Binding to access the Kuberetes API because all Kafka nodes share the same service account.
I also decided to keep the affinity. While the rack does not need to be configured in the controller nodes, they should ideally be still distributed across the zones/racks and the best-effort affinity might help with it.
Checklist