// Module included in the following assemblies:
//
// assembly-kafka-broker-configuration.adoc

[id='ref-kafka-broker-configuration-{context}']
= Kafka broker configuration

The `config` property in `Kafka.spec.kafka` contains Kafka broker configuration options as keys with values in one of the following JSON types:

* String
* Number
* Boolean

You can specify and configure all of the options in the "Broker Configs" section of the {ApacheKafkaBrokerConfig} apart from those managed directly by {ProductName}.
Specifically, you are prevented from modifying all configuration options with keys equal to or starting with one of the following strings:

* `listeners`
* `advertised.`
* `broker.`
* `listener.`
* `host.name`
* `port`
* `inter.broker.listener.name`
* `sasl.`
* `ssl.`
* `security.`
* `password.`
* `principal.builder.class`
* `log.dir`
* `zookeeper.connect`
* `zookeeper.set.acl`
* `authorizer.`
* `super.user`

If the `config` property specifies a restricted option, it is ignored and a warning message is printed to the Cluster Operator log file.
All other supported options are passed to Kafka.

.An example Kafka broker configuration
[source,yaml,subs="attributes+"]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    config:
      num.partitions: 1
      num.recovery.threads.per.data.dir: 1
      default.replication.factor: 3
      offsets.topic.replication.factor: 3
      transaction.state.log.replication.factor: 3
      transaction.state.log.min.isr: 1
      log.retention.hours: 168
      log.segment.bytes: 1073741824
      log.retention.check.interval.ms: 300000
      num.network.threads: 3
      num.io.threads: 8
      socket.send.buffer.bytes: 102400
      socket.receive.buffer.bytes: 102400
      socket.request.max.bytes: 104857600
      group.initial.rebalance.delay.ms: 0
    # ...
----
