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

[id='proc-migrating-kafka-connect-s2i-{context}']
= Migrating from Kafka Connect with S2I to Kafka Connect

[role="_abstract"]
Support for Kafka Connect with S2I and the `KafkaConnectS2I` resource is deprecated.
This follows the introduction of `build` configuration properties to the `KafkaConnect` resource,
which are used to build a container image with the connector plugins you require for your data connections automatically.

This procedure describes how to migrate your Kafka Connect with S2I instance to a standard Kafka Connect instance.
To do this, you configure a new `KafkaConnect` custom resource to replace the `KafkaConnectS2I` resource, which is then deleted.

WARNING: The migration process involves downtime from the moment the `KafkaConnectS2I` instance is deleted until the new `KafkaConnect` instance has been successfully deployed.
During this time, connectors will not be running and processing data. However, after the changeover they should continue from the point at which they stopped.

.Prerequisites

* Kafka Connect with S2I is deployed using a `KafkaConnectS2I` configuration
* Kafka Connect with S2I is using an image with connectors added using an S2I build
* Sink and source connector instances were created using `KafkaConnector` resources or the Kafka Connect REST API

.Procedure

. Create a new `KafkaConnect` custom resource using the same name as the name used for the `KafkaconnectS2I` resource.
. Copy the `KafkaConnectS2I` resource properties to the `KafkaConnect` resource.
. If specified, make sure you use the same `spec.config` properties:
+
--
* `group.id`
* `offset.storage.topic`
* `config.storage.topic`
* `status.storage.topic`
+
If these properties are not specified, defaults are used.
In which case, leave them out of the `KafkaConnect` resource configuration as well.
--
+
Now add configuration specific to the `KafkaConnect` resource to the new resource.

. Add `build` configuration to configure all the connectors and other libraries you want to add to the Kafka Connect deployment.
+
NOTE: Alternatively, you can build a new image with connectors manually, and specify it using the `.spec.image` property.

. Delete the old `KafkaConnectS2I` resource:
+
[source,shell,subs="+quotes"]
kubectl delete -f _MY-KAFKA-CONNECT-S2I-CONFIG-FILE_
+
Replace _MY-KAFKA-CONNECT-S2I-CONFIG-FILE_ with the name of the file containing your `KafkaConnectS2I` resource configuration.
+
Alternatively, you can specify the name of the resource:
+
[source,shell,subs="+quotes"]
kubectl delete kafkaconnects2i _MY-KAFKA-CONNECT-S2I_
+
Replace _MY-KAFKA-CONNECT-S2I_ with the name of the `KafkaConnectS2I` resource.
+
Wait until the Kafka Connect with S2I deployment and pods are deleted.
+
WARNING: No other resources must be deleted.

. Deploy the new `KafkaConnect` resource:
+
[source,shell,subs="+quotes"]
kubectl apply -f _MY-KAFKA-CONNECT-CONFIG-FILE_
+
Replace _MY-KAFKA-CONNECT-CONFIG-FILE_ with the name of the file containing your new `KafkaConnect` resource configuration.
+
Wait until the new image is built, the deployment is created, and the pods have started.

. If you are using `KafkaConnector` resources for managing Kafka Connect connectors, check that all expected connectors are present and are running:
+
[source,shell,subs="+quotes"]
----
kubectl get kctr --selector strimzi.io/cluster=_MY-KAFKA-CONNECT-CLUSTER_ -o name
----
+
Replace _MY-KAFKA-CONNECT-CLUSTER_ with the name of your Kafka Connect cluster.
+
Connectors automatically recover through Kafka Connect storage.
Even if you are using the Kafka Connect REST API to manage them, you should not need to recreate them manually.


[role="_additional-resources"]
.Additional resources
* xref:proc-kafka-connect-config-str[Configuring Kafka Connect]
* link:{BookURLDeploying}#creating-new-image-using-kafka-connect-build-str[Creating a new container image automatically using Strimzi]
* link:{BookURLDeploying}#creating-new-image-from-base-str[Creating a Docker image from the Kafka Connect base image]
* link:{BookURLDeploying}#con-creating-managing-connectors-str[Creating and managing connectors]
