// Module included in the following assemblies:
//
// assembly-using-the-cluster-operator.adoc

[id='ref-operator-cluster-feature-gates-{context}']
= Configuring feature gates

[role="_abstract"]
Strimzi operators support _feature gates_ to enable or disable certain features and functionality.
Enabling a feature gate changes the behavior of the relevant operator and introduces the feature to your Strimzi deployment.

Feature gates have a default state of either _enabled_ or _disabled_.

To modify a feature gate's default state, use the `STRIMZI_FEATURE_GATES` environment variable in the operator's configuration.
You can modify multiple feature gates using this single environment variable.
Specify a comma-separated list of feature gate names and prefixes.
A `+` prefix enables the feature gate and a `-` prefix  disables it.

.Example feature gate configuration that enables `FeatureGate1` and disables `FeatureGate2`
[source,yaml,options="nowrap"]
----
env:
  - name: STRIMZI_FEATURE_GATES
    value: +FeatureGate1,-FeatureGate2
----

== ControlPlaneListener feature gate

The `ControlPlaneListener` feature gate has a default state of _enabled_.

Use the `ControlPlaneListener` feature gate to change the communication paths used for inter-broker communications within your Kafka cluster.
In Strimzi, control plane traffic consists of controller connections that maintain the desired state of the Kafka cluster.
Data plane traffic mainly consists of data replication between the leader broker and the follower brokers.

When `ControlPlaneListener` is enabled, control plane traffic goes through a dedicated _control plane listener_ on port 9090.
Data plane traffic continues to use the internal listener on port 9091.

Using control plane listeners might improve performance because important controller connections, such as partition leadership changes, are not delayed by data replication across brokers.

.Disabling the ControlPlaneListener feature gate
To disable the `ControlPlaneListener` feature gate, specify `-ControlPlaneListener` in the `STRIMZI_FEATURE_GATES` environment variable in the Cluster Operator configuration.
When the `ControlPlaneListener` feature gate is disabled, control plane and data plane traffic go through the same internal listener on port 9091.
This was the default behavior before the feature gate was introduced.

IMPORTANT: The `ControlPlaneListener` feature gate must be disabled when upgrading from or downgrading to Strimzi 0.22 and earlier versions.

== ServiceAccountPatching feature gate

The `ServiceAccountPatching` feature gate has a default state of _enabled_.

By default, the Cluster Operator reconciles service accounts and updates them when needed.
For example, you can change service account labels and annotations after the operands are already created.
To disable service account patching, disable the `ServiceAccountPatching` feature gate.

.Disabling the ServiceAccountPatching feature gate
To disable the `ServiceAccountPatching` feature gate, specify `-ServiceAccountPatching` in the `STRIMZI_FEATURE_GATES` environment variable in the Cluster Operator configuration.

[id='ref-operator-use-strimzi-pod-sets-feature-gate-{context}']
== UseStrimziPodSets feature gate

The `UseStrimziPodSets` feature gate has a default state of _disabled_.

Currently, Strimzi relies on StatefulSets to create and manage pods for the ZooKeeper and Kafka clusters.
Strimzi creates the StatefulSet and Kubernetes creates the pods according to the StatefulSet definition.
When a pod is deleted, Kubernetes is responsible for recreating it.
The use of StatefulSets has the following limitations:

* Pods are always created or removed based on their index numbers
* All pods in the StatefulSet need to have a similar configuration
* Changing storage configuration for the Pods in the StatefulSet is complicated

The `UseStrimziPodSets` feature gate introduces a resource for managing pods called `StrimziPodSet`.
When the feature gate is enabled, this resource is used instead of the StatefulSets.
Strimzi handles the creation and management of pods instead of Kubernetes.
Using StrimziPodSets instead of StatefulSets provides more control over the functionality.

.Enabling the UseStrimziPodSets feature gate
To enable the `UseStrimziPodSets` feature gate, specify `+UseStrimziPodSets` in the `STRIMZI_FEATURE_GATES` environment variable in the Cluster Operator configuration.

IMPORTANT: The `UseStrimziPodSets` feature gate must be disabled when downgrading to Strimzi 0.27 and earlier versions.

[id='ref-operator-use-kraft-feature-gate-{context}']
== (Preview) UseKRaft feature gate

The `UseKRaft` feature gate has a default state of _disabled_.

The `UseKRaft` feature gate deploys the Kafka cluster in the KRaft (Kafka Raft metadata) mode without ZooKeeper.
This feature gate is currently intended only for development and testing.

IMPORTANT: **The KRaft mode is not ready for production in Apache Kafka or in Strimzi.**

When the `UseKRaft` feature gate is enabled, the Kafka cluster is deployed without ZooKeeper.
*The `.spec.zookeeper` properties in the Kafka custom resource will be ignored, but still need to be present.*
The `UseKRaft` feature gate provides an API that configures Kafka cluster nodes and their roles.
The API is still in development and is expected to change before the KRaft mode is production-ready.

Currently, the KRaft mode in Strimzi has the following major limitations:

* Moving from Kafka clusters with ZooKeeper to KRaft clusters or the other way around is not supported.
* Upgrades and downgrades of Apache Kafka versions or the Strimzi operator are not supported.
  Users might need to delete the cluster, upgrade the operator and deploy a new Kafka cluster.
* The Entity Operator (including the User Operator and Topic operator) is not supported.
  The `spec.entityOperator` property *must be removed* from the `Kafka` custom resource.
* `simple` authorization is not supported.
* SCRAM-SHA-512 authentication is not supported.
* JBOD storage is not supported. 
  The `type: jbod` storage can be used, but the JBOD array can contain only one disk.
* Liveness and readiness probes are disabled.
* All Kafka nodes have both the `controller` and `broker` KRaft roles.
  Kafka clusters with separate `controller` and `broker` nodes are not supported.

.Enabling the UseStrimziPodSets feature gate
To enable the `UseKRaft` feature gate, specify `+UseKRaft` in the `STRIMZI_FEATURE_GATES` environment variable in the Cluster Operator configuration.

IMPORTANT: The `UseKRaft` feature gate depends on the `UseStrimziPodSets` feature gate.
When enabling the `UseKRaft` feature gate, make sure that the `USeStrimziPodSets` feature gate is enabled as well.
