// Module included in the following assemblies:
//
// ref-kafka-entity-operator.adoc

[id='topic-operator-{context}']
= Configuring the Topic Operator

[role="_abstract"]
Use `topicOperator` properties in `Kafka.spec.entityOperator` to configure the Topic Operator.

NOTE: If you are using the preview of unidirectional topic management, the following properties are not used and will be ignored: 
`Kafka.spec.entityOperator.topicOperator.zookeeperSessionTimeoutSeconds` and `Kafka.spec.entityOperator.topicOperator.topicMetadataMaxAttempts`.
For more information on unidirectional topic management, refer to xref:ref-operator-topic-{context}[].

The following properties are supported:

`watchedNamespace`::
The Kubernetes namespace in which the Topic Operator watches for `KafkaTopic` resources.
Default is the namespace where the Kafka cluster is deployed.

`reconciliationIntervalSeconds`::
The interval between periodic reconciliations in seconds.
Default `120`.

`zookeeperSessionTimeoutSeconds`::
The ZooKeeper session timeout in seconds.
Default `18`.

`topicMetadataMaxAttempts`::
The number of attempts at getting topic metadata from Kafka.
The time between each attempt is defined as an exponential back-off.
Consider increasing this value when topic creation might take more time due to the number of partitions or replicas.
Default `6`.

`image`::
The `image` property can be used to configure the container image which will be used.
To learn more, refer to the information provided on link:{BookURLConfiguring}#con-common-configuration-images-reference[configuring the `image` property`^].

`resources`::
The `resources` property configures the amount of resources allocated to the Topic Operator.
You can specify requests and limits for `memory` and `cpu` resources. 
The requests should be enough to ensure a stable performance of the operator.

`logging`::
The `logging` property configures the logging of the Topic Operator.
To learn more, refer to the information provided on link:{BookURLConfiguring}#property-topic-operator-logging-reference[Topic Operator logging^].

.Example Topic Operator configuration
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
  zookeeper:
    # ...
  entityOperator:
    # ...
    topicOperator:
      watchedNamespace: my-topic-namespace
      reconciliationIntervalSeconds: 60
      resources:
        requests:
          cpu: "1"
          memory: 500Mi
        limits:
          cpu: "1"
          memory: 500Mi
    # ...
----
