// 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 moved to GA, which means it is now permanently enabled and cannot be disabled.
With `ControlPlaneListener` enabled, the connections between the Kafka controller and brokers use an internal _control plane listener_ on port 9090.
Replication of data between brokers, as well as internal connections from Strimzi operators, Cruise Control, or the Kafka Exporter use the _replication listener_ on port 9091.

IMPORTANT: With the `ControlPlaneListener` feature gate permanently enabled, it is no longer possible to upgrade or downgrade directly between Strimzi 0.22 and earlier and Strimzi 0.32 and newer.
You have to upgrade or downgrade through one of the Strimzi versions in between.

== ServiceAccountPatching feature gate

The `ServiceAccountPatching` feature gate has moved to GA, which means it is now permanently enabled and cannot be disabled.
With `ServiceAccountPatching` enabled, the Cluster Operator always reconciles service accounts and updates them when needed.
For example, when you change service account labels or annotations using the `template` property of a custom resource, the operator automatically updates them on the existing service account resources.

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

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

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.

When this feature gate is disabled, 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

.Disabling the UseStrimziPodSets feature gate
To disable 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 Topic Operator is not supported.
  The `spec.entityOperator.topicOperator` property *must be removed* from the `Kafka` custom resource.
* 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.
* 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.

[id='ref-operator-stable-connect-identities-feature-gate-{context}']
== StableConnectIdentities feature gate

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

The `StableConnectIdentities` feature gate uses `StrimziPodSet` resources to manage Kafka Connect and Kafka MirrorMaker 2.0  pods instead of using Kubernetes Deployment resources.
`StrimziPodSets` give the pods stable names and stable addresses, which do not change during rolling upgrades.
This helps to minimize the number of rebalances of connector tasks.

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

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