<commit_before>// Module included in the following assemblies:
//
// * networking/ovn_kubernetes_network_provider/migrate-from-openshift-sdn.adoc

[id="nw-ovn-kubernetes-migration_{context}"]
= Migrating to the OVN-Kubernetes default CNI network provider

As a cluster administrator, you can change the default Container Network Interface (CNI) network provider for your cluster to OVN-Kubernetes.
During the migration, you must reboot every node in your cluster.

[IMPORTANT]
====
While performing the migration, your cluster is unavailable and workloads might be interrupted.
Perform the migration only when an interruption in service is acceptable.
====

.Prerequisites

* A cluster installed on installer-provisioned infrastructure and configured with the OpenShift SDN default CNI network provider in the network policy isolation mode.
* Install the OpenShift CLI (`oc`).
* Access to the cluster as a user with the `cluster-admin` role.
* A recent backup of the etcd database is available.
* The cluster is in a known good state, without any errors.
* A reboot can be triggered manually for each node.

.Procedure

. To backup the configuration for the cluster network, enter the following command:
+
[source,terminal]
----
$ oc get Network.config.openshift.io cluster -o yaml > cluster-openshift-sdn.yaml
----

. To enable the migration, set an annotation on the Cluster Network Operator configuration object by entering the following command:
+
[source,terminal]
----
$ oc annotate Network.operator.openshift.io cluster \
  'networkoperator.openshift.io/network-migration'=""
----

. Stop all of the machine configuration pools managed by the Machine Config Operator (MCO):

** Stop the master configuration pool:
+
[source,terminal]
----
$ oc patch MachineConfigPool master --type='merge' --patch \
  '{ "spec": { "paused": true } }'
----

** Stop the worker configuration pool:
+
[source,terminal]
----
$ oc patch MachineConfigPool worker --type='merge' --patch \
  '{ "spec":{ "paused" :true } }'
----

. Configure the OVN-Kubernetes cluster network provider by using one of the following commands:

** To specify the network provider without changing the cluster network IP address block, enter the following command:
+
[source,terminal]
----
$ oc patch Network.config.openshift.io cluster \
  --type='merge' --patch '{ "spec": { "networkType": "OVNKubernetes" } }'
----

** To specify a different cluster network IP address block, enter the following command:
+
[source,terminal]
----
$ oc patch Network.config.openshift.io cluster \
  --type='merge' --patch '{
    "spec": {
      "clusterNetwork": [
        "cidr": "<cidr>",
        "hostPrefix": "<prefix>"
      ]
      "networkType": "OVNKubernetes"
    } 
  }'
----
+
where `cidr` is a CIDR block and `prefix` is the slice of the CIDR block apportioned to each node in your cluster. You cannot use any CIDR block that overlaps with the `172.16.17.32/16` CIDR block, because the OVN-Kubernetes network provider uses this block internally.
+
IMPORTANT: You cannot change the service network address block during the migration.

. Optional: You can customize the following settings for OVN-Kubernetes to meet your network infrastructure requirements:
+
--
* Maximum transmission unit (MTU)
* Geneve (Generic Network Virtualization Encapsulation) overlay network port
--
+
To customize either of the previously noted settings, enter and customize the following command. If you do not need to change the default value, omit the key from the patch.
+
[source,terminal]
----
$ oc patch Network.operator.openshift.io cluster --type=merge \
  --patch '{
    "spec":{
      "defaultNetwork":{
        "ovnKubernetesConfig":{
          "mtu":<mtu>,
          "genevePort":<port>
    }}}}'
----
+<commit_msg>Fix invalid JSON value in script template<commit_after>// Module included in the following assemblies:
//
// * networking/ovn_kubernetes_network_provider/migrate-from-openshift-sdn.adoc

[id="nw-ovn-kubernetes-migration_{context}"]
= Migrating to the OVN-Kubernetes default CNI network provider

As a cluster administrator, you can change the default Container Network Interface (CNI) network provider for your cluster to OVN-Kubernetes.
During the migration, you must reboot every node in your cluster.

[IMPORTANT]
====
While performing the migration, your cluster is unavailable and workloads might be interrupted.
Perform the migration only when an interruption in service is acceptable.
====

.Prerequisites

* A cluster installed on installer-provisioned infrastructure and configured with the OpenShift SDN default CNI network provider in the network policy isolation mode.
* Install the OpenShift CLI (`oc`).
* Access to the cluster as a user with the `cluster-admin` role.
* A recent backup of the etcd database is available.
* The cluster is in a known good state, without any errors.
* A reboot can be triggered manually for each node.

.Procedure

. To backup the configuration for the cluster network, enter the following command:
+
[source,terminal]
----
$ oc get Network.config.openshift.io cluster -o yaml > cluster-openshift-sdn.yaml
----

. To enable the migration, set an annotation on the Cluster Network Operator configuration object by entering the following command:
+
[source,terminal]
----
$ oc annotate Network.operator.openshift.io cluster \
  'networkoperator.openshift.io/network-migration'=""
----

. Stop all of the machine configuration pools managed by the Machine Config Operator (MCO):

** Stop the master configuration pool:
+
[source,terminal]
----
$ oc patch MachineConfigPool master --type='merge' --patch \
  '{ "spec": { "paused": true } }'
----

** Stop the worker configuration pool:
+
[source,terminal]
----
$ oc patch MachineConfigPool worker --type='merge' --patch \
  '{ "spec":{ "paused" :true } }'
----

. Configure the OVN-Kubernetes cluster network provider by using one of the following commands:

** To specify the network provider without changing the cluster network IP address block, enter the following command:
+
[source,terminal]
----
$ oc patch Network.config.openshift.io cluster \
  --type='merge' --patch '{ "spec": { "networkType": "OVNKubernetes" } }'
----

** To specify a different cluster network IP address block, enter the following command:
+
[source,terminal]
----
$ oc patch Network.config.openshift.io cluster \
  --type='merge' --patch '{
    "spec": {
      "clusterNetwork": [
        {
          "cidr": "<cidr>",
          "hostPrefix": "<prefix>"
        }        
      ],
      "networkType": "OVNKubernetes"
    } 
  }'
----
+
where `cidr` is a CIDR block and `prefix` is the slice of the CIDR block apportioned to each node in your cluster. You cannot use any CIDR block that overlaps with the `172.16.17.32/16` CIDR block, because the OVN-Kubernetes network provider uses this block internally.
+
IMPORTANT: You cannot change the service network address block during the migration.

. Optional: You can customize the following settings for OVN-Kubernetes to meet your network infrastructure requirements:
+
--
* Maximum transmission unit (MTU)
* Geneve (Generic Network Virtualization Encapsulation) overlay network port
--
+
To customize either of the previously noted settings, enter and customize the following command. If you do not need to change the default value, omit the key from the patch.
+
[source,terminal]
----
$ oc patch Network.operator.openshift.io cluster --type=merge \
  --patch '{
    "spec":{
      "defaultNetwork":{
        "ovnKubernetesConfig":{
          "mtu":<mtu>,
          "genevePort":<port>
    }}}}'
----
+
{'fraction_non_alphanumeric': 0.10551969437491766, 'fraction_numerical': 0.0028981688842049796, 'mean_word_length': 3.765850596359071, 'pattern_counts': {'":': 30, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7646532', 'n_tokens_mistral': 2152, 'n_tokens_neox': 2023, 'n_words': 858}