// Module included in the following assemblies:
//
// assembly-configuring-container-images.adoc

[id='ref-configuring-container-images-{context}']
= Container image configurations

Container image which should be used for given components can be specified using the `image` property in:

* `Kafka.spec.kafka`
* `Kafka.spec.kafka.tlsSidecar`
* `Kafka.spec.zookeeper`
* `Kafka.spec.zookeeper.tlsSidecar`
* `Kafka.spec.entityOperator.topicOperator`
* `Kafka.spec.entityOperator.userOperator`
* `Kafka.spec.entityOperator.tlsSidecar`
* `KafkaConnect.spec`
* `KafkaConnectS2I.spec`

== Configuring the `Kafka.spec.kafka.image` property

The `Kafka.spec.kafka.image` property functions differently from the others, because {ProductName} supports multiple versions of Kafka, each requiring the own image.
The `STRIMZI_KAFKA_IMAGES` environment variable of the Cluster Operator configuration is used to provide a mapping between Kafka versions and the corresponding images. 
This is used in combination with the `Kafka.spec.kafka.image` and `Kafka.spec.kafka.version` properties as follows:

* If neither `Kafka.spec.kafka.image` nor `Kafka.spec.kafka.version` are given in the custom resource then the `version` will default to the  Cluster Operator's default Kafka version, and the image will be the one corresponding to this version in the `STRIMZI_KAFKA_IMAGES`.

* If `Kafka.spec.kafka.image` is given but `Kafka.spec.kafka.version` is not then the given image will be used and the `version` will be assumed to be the  Cluster Operator's default Kafka version.

* If `Kafka.spec.kafka.version` is given but `Kafka.spec.kafka.image` is not then image will be the one corresponding to this version in the `STRIMZI_KAFKA_IMAGES`.

* Both `Kafka.spec.kafka.version` and `Kafka.spec.kafka.image` are given the given image will be used, and it will be assumed to contain a Kafka broker with the given version.

WARNING: It is best to provide just `Kafka.spec.kafka.version` and leave the `Kafka.spec.kafka.image` property unspecified.
This reduces the chances of making a mistake in configuring the `Kafka` resource. If you need to change the images used for different versions of Kafka, it is better to configure the Cluster Operator's `STRIMZI_KAFKA_IMAGES` environment variable.

== Configuring the `image` property in other resources

For the `image` property in the other custom resources, the given value will be used during deployment.
If the `image` property is missing, the `image` specified in the Cluster Operator configuration will be used.
If the `image` name is not defined in the Cluster Operator configuration, then the default value will be used.

* For Kafka broker TLS sidecar:
. Container image specified in the `STRIMZI_DEFAULT_TLS_SIDECAR_KAFKA_IMAGE` environment variable from the Cluster Operator configuration.
. `strimzi/kafka-stunnel:latest` container image.
* For Zookeeper nodes:
. Container image specified in the `STRIMZI_DEFAULT_ZOOKEEPER_IMAGE` environment variable from the Cluster Operator configuration.
. `strimzi/zookeeper:latest` container image.
* For Zookeeper node TLS sidecar:
. Container image specified in the `STRIMZI_DEFAULT_TLS_SIDECAR_ZOOKEEPER_IMAGE` environment variable from the Cluster Operator configuration.
. `strimzi/zookeeper-stunnel:latest` container image.
* For Topic Operator:
. Container image specified in the `STRIMZI_DEFAULT_TOPIC_OPERATOR_IMAGE` environment variable from the Cluster Operator configuration.
.** `strimzi/topic-operator:latest` container image.
* For User Operator:
. Container image specified in the `STRIMZI_DEFAULT_USER_OPERATOR_IMAGE` environment variable from the Cluster Operator configuration.
. `strimzi/user-operator:latest` container image.
* For Entity Operator TLS sidecar:
. Container image specified in the `STRIMZI_DEFAULT_TLS_SIDECAR_ENTITY_OPERATOR_IMAGE` environment variable from the Cluster Operator configuration.
. `strimzi/entity-operator-stunnel:latest` container image.
* For Kafka Connect:
. Container image specified in the `STRIMZI_DEFAULT_KAFKA_CONNECT_IMAGE` environment variable from the Cluster Operator configuration.
. `strimzi/kafka-connect:latest` container image.
* For Kafka Connect with Source2image support:
. Container image specified in the `STRIMZI_DEFAULT_KAFKA_CONNECT_S2I_IMAGE` environment variable from the Cluster Operator configuration.
. `strimzi/kafka-connect-s2i:latest` container image.

WARNING: Overriding container images is recommended only in special situations, where you need to use a different container registry.
For example, because your network does not allow access to the container repository used by {ProductName}.
In such case, you should either copy the {ProductName} images or build them from source.
In case the configured image is not compatible with {ProductName} images, it might not work properly.

.Example of container image configuration
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    image: my-org/my-image:latest
    # ...
  zookeeper:
    # ...
----
