|
1 |
| -[id="ospdo_scale_down_pre_database_adoption_{context}"] |
| 1 | +[id="ospdo-scale-down-pre-database-adoption_{context}"] |
2 | 2 |
|
3 | 3 | = Scaling down director Operator resources
|
4 | 4 |
|
5 | 5 | Before you migrate your databases to the control plane, you must scale down and remove OpenStack director Operator (OSPdO) resources in order to use the {rhos_long} resources.
|
6 | 6 |
|
| 7 | +You must perform the following actions: |
| 8 | + |
| 9 | +* Dump selected data from the existing {OpenStackShort} {rhos_prev_ver} cluster. You use this data to build the custom resources for the data plane adoption. |
| 10 | +* After you extract and save the data, remove the OSPdO control plane and operator. |
| 11 | + |
7 | 12 | .Procedure
|
| 13 | +. Download the NIC templates: |
| 14 | ++ |
| 15 | +---- |
| 16 | + # Make temp directory if doesn't exist |
| 17 | + mkdir -p temp |
| 18 | + cd temp |
| 19 | + echo "Extract nic templates" |
| 20 | + oc get -n "${OSPDO_NAMESPACE}" cm tripleo-tarball -ojson | jq -r '.binaryData."tripleo-tarball.tar.gz"' | base64 -d | tar xzvf - |
| 21 | + # Revert back to original directory |
| 22 | + cd - |
| 23 | +---- |
| 24 | +. Get the SSH key for accessing the data plane nodes: |
| 25 | ++ |
| 26 | +---- |
| 27 | + # Make temp directory if doesn't exist |
| 28 | + mkdir -p temp |
| 29 | + # Get the SSH key from the openstackclient (osp 17) |
| 30 | + # to be used later to create the SSH secret for dataplane adoption |
| 31 | + $OS_CLIENT cat /home/cloud-admin/.ssh/id_rsa > temp/ssh.private |
| 32 | + $OS_CLIENT cat /home/cloud-admin/.ssh/id_rsa.pub > temp/ssh.pub |
| 33 | + echo "SSH private and public keys saved in temp/ssh.private and temp/ssh.pub" |
| 34 | +---- |
| 35 | +. Get the OVN configuration from each Compute node role, `OpenStackBaremetalSet`. This configuration is used later to build the `OpenStackDataPlaneNodeSet`(s). Repeat the following step for each `OpenStackBaremetalSet `: |
| 36 | ++ |
| 37 | +---- |
| 38 | + # Make temp directory if doesn't exist |
| 39 | + mkdir -p temp |
| 40 | + # |
| 41 | + # Query the first node in OSBMS |
| 42 | + # |
| 43 | + IP=$(oc -n "${OSPDO_NAMESPACE}" get openstackbaremetalsets.osp-director.openstack.org <<OSBMS-NAME>> -ojson | jq -r '.status.baremetalHosts| keys[] as $k | .[$k].ipaddresses["ctlplane"]'| awk -F'/' '{print $1}') |
| 44 | + # Get the OVN parameters |
| 45 | + oc -n "${OSPDO_NAMESPACE}" exec -c openstackclient openstackclient -- \ |
| 46 | + ssh cloud-admin@${IP} sudo ovs-vsctl -f json --columns=external_ids list Open | |
| 47 | + jq -r '.data[0][0][1][]|join("=")' | sed -n -E 's/^(ovn.*)+=(.*)+/edpm_\1: \2/p' | |
| 48 | + grep -v -e ovn-remote -e encap-tos -e openflow -e ofctrl > temp/<<OSBMS-NAME>>.txt |
| 49 | +---- |
| 50 | ++ |
| 51 | +---- |
| 52 | + # Create temp directory if it does not exist |
| 53 | + mkdir -p temp |
| 54 | + for name in $(oc -n "${OSPDO_NAMESPACE}" get openstackbaremetalsets.osp-director.openstack.org | awk 'NR > 1 {print $1}'); do |
| 55 | + oc -n "${OSPDO_NAMESPACE}" get openstackbaremetalsets.osp-director.openstack.org $name -ojson | |
| 56 | + jq -r '.status.baremetalHosts| "nodes:", keys[] as $k | .[$k].ipaddresses as $a | |
| 57 | + " \($k):", |
| 58 | + " hostName: \($k)", |
| 59 | + " ansible:", |
| 60 | + " ansibleHost: \($a["ctlplane"] | sub("/\\d+"; ""))", |
| 61 | + " networks:", ($a | to_entries[] | " - name: \(.key) \n fixedIP: \(.value | sub("/\\d+"; ""))\n subnetName: subnet1")' > temp/${name}-nodes.txt |
| 62 | + done |
| 63 | +---- |
| 64 | +. Remove the conflicting repositories and packages from all Compute hosts. Define the OSPdO and {OpenStackShort} {rhos_prev_ver} Pacemaker services that must be stopped: |
| 65 | ++ |
| 66 | +---- |
| 67 | +PacemakerResourcesToStop_dataplane=( |
| 68 | + "galera-bundle" |
| 69 | + "haproxy-bundle" |
| 70 | + "rabbitmq-bundle") |
8 | 71 |
|
| 72 | +# Stop these PCM services after adopting control |
| 73 | +# plane, but before starting deletion of OSPD0 (osp17) env |
| 74 | + echo "Stopping pacemaker OpenStack services" |
| 75 | + SSH_CMD=CONTROLLER_SSH |
| 76 | + if [ -n "${!SSH_CMD}" ]; then |
| 77 | + echo "Using controller 0 to run pacemaker commands " |
| 78 | + for resource in "${PacemakerResourcesToStop_dataplane[@]}"; do |
| 79 | + if ${!SSH_CMD} sudo pcs resource config "$resource" &>/dev/null; then |
| 80 | + echo "Stopping $resource" |
| 81 | + ${!SSH_CMD} sudo pcs resource disable "$resource" |
| 82 | + else |
| 83 | + echo "Service $resource not present" |
| 84 | + fi |
| 85 | + done |
| 86 | + fi |
| 87 | +---- |
9 | 88 | . Scale down the {rhos_acro} OpenStack Operator `controller-manager` to 0 replicas and temporarily delete the `OpenStackControlPlane` `OpenStackClient` pod, so that you can use the OSPdO `controller-manager` to clean up some of its resources. The cleanup is needed to avoid a pod name collision between the OSPdO OpenStackClient and the {rhos_acro} OpenStackClient.
|
10 | 89 | +
|
11 | 90 | ----
|
12 |
| -$ oc patch csv -n openstack-operators openstack-operator.v0.0.1 --type json -p="[{"op": "replace", "path": "/spec/install/spec/deployments/0/spec/replicas", "value": "0"}]" |
| 91 | +$ oc patch csv -n openstack-operators openstack-operator.v1.0.5 --type json -p="[{"op": "replace", "path": "/spec/install/spec/deployments/0/spec/replicas", "value": "0"}]" |
13 | 92 | $ oc delete openstackclients.client.openstack.org --all
|
14 | 93 | ----
|
15 | 94 | +
|
| 95 | +* Replace the CSV version with the CSV version that is deployed in the cluster. |
16 | 96 | . Delete the OSPdO `OpenStackControlPlane` custom resource (CR):
|
17 | 97 | +
|
18 | 98 | ----
|
@@ -192,8 +272,19 @@ $ oc delete openstackprovisionservers.osp-director.openstack.org -n openstack --
|
192 | 272 | +
|
193 | 273 | ----
|
194 | 274 | $ compute_bmh_list=$(oc get bmh -n openshift-machine-api |grep compute|awk '{printf $1 " "}')
|
195 |
| -$ for bmh_compute in $compute_bmh_list;do oc annotate bmh -n openshift-machine-api $bmh_compute baremetalhost.metal3.io/detached="";done |
196 |
| -$ oc delete bmh -n openshift-machine-api $bmh_compute;done |
| 275 | +$ for bmh_compute in $compute_bmh_list;do oc annotate bmh -n openshift-machine-api $bmh_compute baremetalhost.metal3.io/detached="";\ |
| 276 | + oc -n openshift-machine-api wait bmh/$bmh_compute --for=jsonpath='{.status.operationalStatus}'=detached --timeout=30s || { |
| 277 | + echo "ERROR: BMH did not enter detatched state" |
| 278 | + exit 1 |
| 279 | + } |
| 280 | +done |
| 281 | +---- |
| 282 | +. Delete the `BareMetalHost` resource after its operational status is detached: |
| 283 | ++ |
| 284 | +---- |
| 285 | + for bmh_compute in $compute_bmh_list;do \ |
| 286 | + oc -n openshift-machine-api delete bmh $bmh_compute; \ |
| 287 | + done |
197 | 288 | ----
|
198 | 289 |
|
199 | 290 | . Delete the OSPdO Operator Lifecycle Manager resources to remove OSPdO:
|
|
0 commit comments