// Module included in the following assemblies:
//
// assembly-upgrade-resources.adoc

[id='proc-upgrade-kafka-resources-{context}']
= Upgrading Kafka resources

.Prerequisites

* A Cluster Operator supporting the `{ApiVersion}` API version is up and running.

.Procedure
Execute the following steps for each `Kafka` resource in your deployment.

. Update the `Kafka` resource in an editor.
+
[source,shell,subs="+quotes,attributes"]
----
kubectl edit kafka _my-cluster_
----

. Replace:
+
[source,shell,subs="attributes"]
----
apiVersion: {KafkaApiVersionPrev}
----
+
with:
+
[source,shell,subs="attributes"]
----
apiVersion:{KafkaApiVersion}
----

. If the `Kafka` resource has:
+
[source,shell]
----
Kafka.spec.topicOperator
----
+
Replace it with:
+
[source,shell]
----
Kafka.spec.entityOperator.topicOperator
----
+
For example, replace:
+
[source,shell]
----
spec:
  # ...
  topicOperator: {}
----
+
with:
+
[source,shell]
----
spec:
  # ...
  entityOperator:
    topicOperator: {}
----
. If present, move:
+
[source,shell]
----
Kafka.spec.entityOperator.affinity
----
+
[source,shell]
----
Kafka.spec.entityOperator.tolerations
----
+
to:
+
[source,shell]
----
Kafka.spec.entityOperator.template.pod.affinity
----
+
[source,shell]
----
Kafka.spec.entityOperator.template.pod.tolerations
----
+
For example, move:
+
[source,shell]
----
spec:
  # ...
  entityOperator:
    affinity {}
    tolerations {}
----
+
to:
+
[source,shell]
----
spec:
  # ...
  entityOperator:
    template:
      pod:
        affinity {}
        tolerations {}
----


. If present, move:
+
[source,shell]
----
Kafka.spec.kafka.affinity
----
+
[source,shell]
----
Kafka.spec.kafka.tolerations
----
+
to:
+
[source,shell]
----
Kafka.spec.kafka.template.pod.affinity
----
+
[source,shell]
----
Kafka.spec.kafka.template.pod.tolerations
----
+
For example, move:
+
[source,shell]
----
spec:
  # ...
  kafka:
    affinity {}
    tolerations {}
----
+
to:
+
[source,shell]
----
spec:
  # ...
  kafka:
    template:
      pod:
        affinity {}
        tolerations {}
----


. If present, move:
+
[source,shell]
----
Kafka.spec.zookeeper.affinity
----
+
[source,shell]
----
Kafka.spec.zookeeper.tolerations
----
+
to:
+
[source,shell]
----
Kafka.spec.zookeeper.template.pod.affinity
----
+
[source,shell]
----
Kafka.spec.zookeeper.template.pod.tolerations
----
+
For example, move:
+
[source,shell]
----
spec:
  # ...
  zookeeper:
    affinity {}
    tolerations {}
----
+
to:
+
[source,shell]
----
spec:
  # ...
  zookeeper:
    template:
      pod:
        affinity {}
        tolerations {}
----

. Save the file, exit the editor and wait for the updated resource to be reconciled.
