Skip to content

Commit 6f1fbc2

Browse files
authored
Merge pull request #62843 from gryf/kuryr-migration-4.14
[OSDOCS-6377] Update kuryr-ovn kubernetes migration docs
2 parents 42240f0 + ef04db6 commit 6f1fbc2

File tree

2 files changed

+40
-51
lines changed

2 files changed

+40
-51
lines changed

modules/nw-kuryr-cleanup.adoc

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ plugin, you must clean up the resources that Kuryr created previously.
1212
[NOTE]
1313
====
1414
The clean up process relies on a Python virtual environment to ensure that the package versions that you use support tags for Octavia objects. You do not need a virtual environment if you are certain that your environment uses at minimum:
15-
* `openstacksdk` version 0.54.0
16-
* `python-openstackclient` version 5.5.0
17-
* `python-octaviaclient` version 2.3.0
15+
16+
* The `openstacksdk` Python package version 0.54.0
17+
18+
* The `python-openstackclient` Python package version 5.5.0
19+
20+
* The `python-octaviaclient` Python package version 2.3.0
21+
22+
If you decide to use these particular versions, be sure to pull `python-neutronclient` prior to version 9.0.0, as it prevents you from accessing trunks.
23+
1824
====
1925

2026
.Prerequisites
@@ -46,13 +52,13 @@ $ source /tmp/venv/bin/activate
4652
+
4753
[source,terminal]
4854
----
49-
(venv) $ pip install pip --upgrade
55+
(venv) $ pip install --upgrade pip
5056
----
5157
.. Install the required Python packages by running the following command:
5258
+
5359
[source,terminal]
5460
----
55-
(venv) $ pip install openstacksdk==0.54.0 python-openstackclient==5.5.0 python-octaviaclient==2.3.0
61+
(venv) $ pip install openstacksdk==0.54.0 python-openstackclient==5.5.0 python-octaviaclient==2.3.0 'python-neutronclient<9.0.0'
5662
----
5763

5864
. In your terminal, set variables to cluster and Kuryr identifiers by running the following commands:
@@ -74,7 +80,7 @@ $ source /tmp/venv/bin/activate
7480
+
7581
[source,terminal]
7682
----
77-
(venv) $ ROUTERID=$(oc get kuryrnetwork -A --no-headers -o custom-columns=":status.routerId"|head -n 1)
83+
(venv) $ ROUTERID=$(oc get kuryrnetwork -A --no-headers -o custom-columns=":status.routerId"|uniq)
7884
----
7985

8086
. Create a Bash function that removes finalizers from specified resources by running the following command:
@@ -84,12 +90,12 @@ $ source /tmp/venv/bin/activate
8490
(venv) $ function REMFIN {
8591
local resource=$1
8692
local finalizer=$2
87-
for res in $(oc get $resource -A --template='{{range $i,$p := .items}}{{ $p.metadata.name }}|{{ $p.metadata.namespace }}{{"\n"}}{{end}}'); do
93+
for res in $(oc get "${resource}" -A --template='{{range $i,$p := .items}}{{ $p.metadata.name }}|{{ $p.metadata.namespace }}{{"\n"}}{{end}}'); do
8894
name=${res%%|*}
8995
ns=${res##*|}
90-
yaml=$(oc get -n $ns $resource $name -o yaml)
96+
yaml=$(oc get -n "${ns}" "${resource}" "${name}" -o yaml)
9197
if echo "${yaml}" | grep -q "${finalizer}"; then
92-
echo "${yaml}" | grep -v "${finalizer}" | oc replace -n $ns $resource $name -f -
98+
echo "${yaml}" | grep -v "${finalizer}" | oc replace -n "${ns}" "${resource}" "${name}" -f -
9399
fi
94100
done
95101
}
@@ -109,7 +115,7 @@ The named resource is removed from the cluster and its definition is replaced wi
109115
+
110116
[source,terminal]
111117
----
112-
(venv) $ if $(oc get -n openshift-kuryr service service-subnet-gateway-ip &>/dev/null); then
118+
(venv) $ if oc get -n openshift-kuryr service service-subnet-gateway-ip &>/dev/null; then
113119
oc -n openshift-kuryr delete service service-subnet-gateway-ip
114120
fi
115121
----
@@ -118,8 +124,8 @@ fi
118124
+
119125
[source,terminal]
120126
----
121-
(venv) $ for lb in $(openstack loadbalancer list --tags $CLUSTERTAG -f value -c id); do
122-
openstack loadbalancer delete --cascade $lb
127+
(venv) $ for lb in $(openstack loadbalancer list --tags "${CLUSTERTAG}" -f value -c id); do
128+
openstack loadbalancer delete --cascade "${lb}"
123129
done
124130
----
125131

@@ -141,14 +147,14 @@ done
141147
+
142148
[source,terminal]
143149
----
144-
(venv) $ openstack router remove subnet $ROUTERID ${CLUSTERID}-kuryr-service-subnet
150+
(venv) $ openstack router remove subnet "${ROUTERID}" "${CLUSTERID}-kuryr-service-subnet"
145151
----
146152

147153
. To remove the Kuryr service network, enter the following command:
148154
+
149155
[source,terminal]
150156
----
151-
(venv) $ openstack network delete ${CLUSTERID}-kuryr-service-network
157+
(venv) $ openstack network delete "${CLUSTERID}-kuryr-service-network"
152158
----
153159

154160
. To remove Kuryr finalizers from all pods, enter the following command:
@@ -184,9 +190,10 @@ This command deletes the `KuryrPort` CRs.
184190
+
185191
[source,terminal]
186192
----
187-
(venv) $ read -ra trunks <<< $(python -c "import openstack; n = openstack.connect().network; print(' '.join([x.id for x in n.trunks(any_tags='$CLUSTERTAG')]))") && \
193+
(venv) $ mapfile trunks < <(python -c "import openstack; n = openstack.connect().network; print('\n'.join([x.id for x in n.trunks(any_tags='$CLUSTERTAG')]))") && \
188194
i=0 && \
189195
for trunk in "${trunks[@]}"; do
196+
trunk=$(echo "$trunk"|tr -d '\n')
190197
i=$((i+1))
191198
echo "Processing trunk $trunk, ${i}/${#trunks[@]}."
192199
subports=()
@@ -198,7 +205,7 @@ for trunk in "${trunks[@]}"; do
198205
args+=("--subport $sub")
199206
done
200207
if [ ${#args[@]} -gt 0 ]; then
201-
openstack network trunk unset ${args[*]} $trunk
208+
openstack network trunk unset ${args[*]} "${trunk}"
202209
fi
203210
done
204211
----
@@ -216,7 +223,7 @@ for kn in "${kuryrnetworks[@]}"; do
216223
echo "Processing network $netID, ${i}/${#kuryrnetworks[@]}"
217224
# Remove all ports from the network.
218225
for port in $(python -c "import openstack; n = openstack.connect().network; print(' '.join([x.id for x in n.ports(network_id='$netID') if x.device_owner != 'network:router_interface']))"); do
219-
( openstack port delete $port ) &
226+
( openstack port delete "${port}" ) &
220227
221228
# Only allow 20 jobs in parallel.
222229
if [[ $(jobs -r -p | wc -l) -ge 20 ]]; then
@@ -226,26 +233,26 @@ for kn in "${kuryrnetworks[@]}"; do
226233
wait
227234
228235
# Remove the subnet from the router.
229-
openstack router remove subnet $ROUTERID $subnetID
236+
openstack router remove subnet "${ROUTERID}" "${subnetID}"
230237
231238
# Remove the network.
232-
openstack network delete $netID
239+
openstack network delete "${netID}"
233240
done
234241
----
235242
236243
. To remove the Kuryr security group, enter the following command:
237244
+
238245
[source,terminal]
239246
----
240-
(venv) $ openstack security group delete ${CLUSTERID}-kuryr-pods-security-group
247+
(venv) $ openstack security group delete "${CLUSTERID}-kuryr-pods-security-group"
241248
----
242249
243250
. To remove all tagged subnet pools, enter the following command:
244251
+
245252
[source,terminal]
246253
----
247-
(venv) $ for subnetpool in $(openstack subnet pool list --tags $CLUSTERTAG -f value -c ID); do
248-
openstack subnet pool delete $subnetpool
254+
(venv) $ for subnetpool in $(openstack subnet pool list --tags "${CLUSTERTAG}" -f value -c ID); do
255+
openstack subnet pool delete "${subnetpool}"
249256
done
250257
----
251258
@@ -254,7 +261,7 @@ done
254261
[source,terminal]
255262
----
256263
(venv) $ networks=$(oc get kuryrnetwork -A --no-headers -o custom-columns=":status.netId") && \
257-
for existingNet in $(openstack network list --tags $CLUSTERTAG -f value -c ID); do
264+
for existingNet in $(openstack network list --tags "${CLUSTERTAG}" -f value -c ID); do
258265
if [[ $networks =~ $existingNet ]]; then
259266
echo "Network still exists: $existingNet"
260267
fi
@@ -268,7 +275,7 @@ If the command returns any existing networks, intestigate and remove them before
268275
[source,terminal]
269276
----
270277
(venv) $ for sgid in $(openstack security group list -f value -c ID -c Description | grep 'Kuryr-Kubernetes Network Policy' | cut -f 1 -d ' '); do
271-
openstack security group delete $sgid
278+
openstack security group delete "${sgid}"
272279
done
273280
----
274281
@@ -283,7 +290,7 @@ done
283290
+
284291
[source,terminal]
285292
----
286-
(venv) $ if $(python3 -c "import sys; import openstack; n = openstack.connect().network; r = n.get_router('$ROUTERID'); sys.exit(0) if r.description != 'Created By OpenShift Installer' else sys.exit(1)"); then
287-
openstack router delete $ROUTERID
293+
(venv) $ if python3 -c "import sys; import openstack; n = openstack.connect().network; r = n.get_router('$ROUTERID'); sys.exit(0) if r.description != 'Created By OpenShift Installer' else sys.exit(1)"; then
294+
openstack router delete "${ROUTERID}"
288295
fi
289296
----

modules/nw-kuryr-migration.adoc

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ $ CLUSTERID=$(oc get infrastructure.config.openshift.io cluster -o=jsonpath='{.s
4747
+
4848
[source,terminal]
4949
----
50-
$ oc patch Network.operator.openshift.io cluster --type='merge' \
51-
--patch '{ "spec": { "migration": { "networkType": "OVNKubernetes" } } }'
50+
$ oc patch Network.operator.openshift.io cluster --type=merge \
51+
--patch '{"spec": {"migration": {"networkType": "OVNKubernetes"}}}'
5252
----
5353
+
5454
[NOTE]
@@ -216,8 +216,8 @@ where:
216216
+
217217
[source,terminal]
218218
----
219-
$ oc patch Network.config.openshift.io cluster \
220-
--type='merge' --patch '{ "spec": { "networkType": "OVNKubernetes" } }'
219+
$ oc patch Network.config.openshift.io cluster --type=merge \
220+
--patch '{"spec": {"networkType": "OVNKubernetes"}}'
221221
----
222222

223223
** To specify a different cluster network IP address block, enter the following command:
@@ -250,24 +250,6 @@ You cannot change the service network address block during the migration.
250250
You cannot use any CIDR block that overlaps with the `100.64.0.0/16` CIDR block because the OVN-Kubernetes network provider uses this block internally.
251251
====
252252

253-
. Verify that the Multus daemon set rollout is complete by entering the following command:
254-
+
255-
[source,terminal]
256-
----
257-
$ oc -n openshift-multus rollout status daemonset/multus
258-
----
259-
+
260-
The name of the Multus pods is in the form of `multus-<xxxxx>`, where `<xxxxx>` is a random sequence of letters. It might take several moments for the pods to restart.
261-
+
262-
.Example output
263-
[source,text]
264-
----
265-
Waiting for daemon set "multus" rollout to finish: 1 out of 6 new pods have been updated...
266-
...
267-
Waiting for daemon set "multus" rollout to finish: 5 of 6 updated pods are available...
268-
daemon set "multus" successfully rolled out
269-
----
270-
271253
. To complete the migration, reboot each node in your cluster. For example, you can use a bash script similar to the following example. The script assumes that you can connect to each host by using `ssh` and that you have configured `sudo` to not prompt for a password:
272254
+
273255
[source,bash]
@@ -286,7 +268,7 @@ done
286268
If SSH access is not available, you can use the `openstack` command:
287269
[source,terminal]
288270
----
289-
$ for name in $(openstack server list --name ${CLUSTERID}\* -f value -c Name); do openstack server reboot $name; done
271+
$ for name in $(openstack server list --name "${CLUSTERID}*" -f value -c Name); do openstack server reboot "${name}"; done
290272
----
291273
Alternatively, you might be able to reboot each node through the management portal for
292274
your infrastructure provider. Otherwise, contact the appropriate authority to
@@ -341,6 +323,6 @@ You might encounter pods that have a `Terminating` state due to finalizers that
341323
+
342324
[source,terminal]
343325
----
344-
$ oc patch Network.operator.openshift.io cluster --type='merge' \
345-
--patch '{ "spec": { "migration": null } }'
326+
$ oc patch Network.operator.openshift.io cluster --type=merge \
327+
--patch '{"spec": {"migration": null}}'
346328
----

0 commit comments

Comments
 (0)