Skip to content

Commit b2330e9

Browse files
authored
Merge pull request #92038 from lahinson/no-jira-format-fix-hcp
[OSDOCS-14043]: Fix formatting in HCP on AWS backup procedure
2 parents 1748059 + 482cf15 commit b2330e9

File tree

1 file changed

+155
-45
lines changed

1 file changed

+155
-45
lines changed

Diff for: modules/dr-hosted-cluster-within-aws-region-backup.adoc

+155-45
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,46 @@
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="dr-hosted-cluster-within-aws-region-backup_{context}"]
7-
= Backing up a hosted cluster
7+
= Backing up a hosted cluster on {aws-short}
88

99
To recover your hosted cluster in your target management cluster, you first need to back up all of the relevant data.
1010

1111
.Procedure
1212

13-
. Create a configmap file to declare the source management cluster by entering this command:
13+
. Create a config map file to declare the source management cluster by entering the following command:
1414
+
1515
[source,terminal]
1616
----
1717
$ oc create configmap mgmt-parent-cluster -n default \
1818
--from-literal=from=${MGMT_CLUSTER_NAME}
1919
----
2020

21-
. Shut down the reconciliation in the hosted cluster and in the node pools by entering these commands:
21+
. Shut down the reconciliation in the hosted cluster and in the node pools by entering the following commands:
2222
+
2323
[source,terminal]
2424
----
2525
$ PAUSED_UNTIL="true"
26-
$ oc patch -n ${HC_CLUSTER_NS} hostedclusters/${HC_CLUSTER_NAME} \
27-
-p '{"spec":{"pausedUntil":"'${PAUSED_UNTIL}'"}}' --type=merge
28-
$ oc scale deployment -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} --replicas=0 \
29-
kube-apiserver openshift-apiserver openshift-oauth-apiserver control-plane-operator
3026
----
3127
+
3228
[source,terminal]
3329
----
34-
$ PAUSED_UNTIL="true"
3530
$ oc patch -n ${HC_CLUSTER_NS} hostedclusters/${HC_CLUSTER_NAME} \
3631
-p '{"spec":{"pausedUntil":"'${PAUSED_UNTIL}'"}}' --type=merge
32+
----
33+
+
34+
[source,terminal]
35+
----
3736
$ oc patch -n ${HC_CLUSTER_NS} nodepools/${NODEPOOLS} \
3837
-p '{"spec":{"pausedUntil":"'${PAUSED_UNTIL}'"}}' --type=merge
38+
----
39+
+
40+
[source,terminal]
41+
----
3942
$ oc scale deployment -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} --replicas=0 \
4043
kube-apiserver openshift-apiserver openshift-oauth-apiserver control-plane-operator
4144
----
4245

43-
. Back up etcd and upload the data to an S3 bucket by running this bash script:
46+
. Back up etcd and upload the data to an S3 bucket by running the following bash script:
4447
+
4548
[TIP]
4649
====
@@ -93,82 +96,189 @@ For more information about backing up etcd, see "Backing up and restoring etcd o
9396
* `MachineDeployments`, `MachineSets`, and `Machines` from the Hosted Control Plane namespace
9497
* `ControlPlane` secrets from the Hosted Control Plane namespace
9598
+
99+
.. Enter the following commands:
100+
+
96101
[source,terminal]
97102
----
98103
$ mkdir -p ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS} \
99104
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}
105+
----
106+
+
107+
[source,terminal]
108+
----
100109
$ chmod 700 ${BACKUP_DIR}/namespaces/
101-
102-
# HostedCluster
110+
----
111+
+
112+
.. Back up the `HostedCluster` objects from the `HostedCluster` namespace by entering the following commands:
113+
+
114+
[source,terminal]
115+
----
103116
$ echo "Backing Up HostedCluster Objects:"
104-
$ oc get hc ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS} -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/hc-${HC_CLUSTER_NAME}.yaml
117+
----
118+
+
119+
[source,terminal]
120+
----
121+
$ oc get hc ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS} -o yaml > \
122+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/hc-${HC_CLUSTER_NAME}.yaml
123+
----
124+
+
125+
[source,terminal]
126+
----
105127
$ echo "--> HostedCluster"
106-
$ sed -i '' -e '/^status:$/,$d' ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/hc-${HC_CLUSTER_NAME}.yaml
107-
108-
# NodePool
109-
$ oc get np ${NODEPOOLS} -n ${HC_CLUSTER_NS} -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/np-${NODEPOOLS}.yaml
128+
----
129+
+
130+
[source,terminal]
131+
----
132+
$ sed -i '' -e '/^status:$/,$d' \
133+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/hc-${HC_CLUSTER_NAME}.yaml
134+
----
135+
+
136+
.. Back up the `NodePool` objects from the `HostedCluster` namespace by entering the following commands:
137+
+
138+
[source,terminal]
139+
----
140+
$ oc get np ${NODEPOOLS} -n ${HC_CLUSTER_NS} -o yaml > \
141+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/np-${NODEPOOLS}.yaml
142+
----
143+
+
144+
[source,terminal]
145+
----
110146
$ echo "--> NodePool"
111-
$ sed -i '' -e '/^status:$/,$ d' ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/np-${NODEPOOLS}.yaml
112-
113-
# Secrets in the HC Namespace
147+
----
148+
+
149+
[source,terminal]
150+
----
151+
$ sed -i '' -e '/^status:$/,$ d' \
152+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/np-${NODEPOOLS}.yaml
153+
----
154+
+
155+
.. Back up the secrets in the `HostedCluster` namespace by running the following shell script:
156+
+
157+
[source,terminal]
158+
----
114159
$ echo "--> HostedCluster Secrets:"
115160
for s in $(oc get secret -n ${HC_CLUSTER_NS} | grep "^${HC_CLUSTER_NAME}" | awk '{print $1}'); do
116161
oc get secret -n ${HC_CLUSTER_NS} $s -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}/secret-${s}.yaml
117162
done
118-
119-
# Secrets in the HC Control Plane Namespace
163+
----
164+
+
165+
.. Back up the secrets in the `HostedCluster` control plane namespace by running the following shell script:
166+
+
167+
[source,terminal]
168+
----
120169
$ echo "--> HostedCluster ControlPlane Secrets:"
121170
for s in $(oc get secret -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} | egrep -v "docker|service-account-token|oauth-openshift|NAME|token-${HC_CLUSTER_NAME}" | awk '{print $1}'); do
122171
oc get secret -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} $s -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/secret-${s}.yaml
123172
done
124-
125-
# Hosted Control Plane
173+
----
174+
+
175+
.. Back up the hosted control plane by entering the following commands:
176+
+
177+
[source,terminal]
178+
----
126179
$ echo "--> HostedControlPlane:"
127-
$ oc get hcp ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/hcp-${HC_CLUSTER_NAME}.yaml
128-
129-
# Cluster
180+
----
181+
+
182+
[source,terminal]
183+
----
184+
$ oc get hcp ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > \
185+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/hcp-${HC_CLUSTER_NAME}.yaml
186+
----
187+
+
188+
.. Back up the cluster by entering the following commands:
189+
+
190+
[source,terminal]
191+
----
130192
$ echo "--> Cluster:"
131-
$ CL_NAME=$(oc get hcp ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o jsonpath={.metadata.labels.\*} | grep ${HC_CLUSTER_NAME})
132-
$ oc get cluster ${CL_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/cl-${HC_CLUSTER_NAME}.yaml
133-
134-
# AWS Cluster
193+
----
194+
+
195+
[source,terminal]
196+
----
197+
$ CL_NAME=$(oc get hcp ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} \
198+
-o jsonpath={.metadata.labels.\*} | grep ${HC_CLUSTER_NAME})
199+
----
200+
+
201+
[source,terminal]
202+
----
203+
$ oc get cluster ${CL_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > \
204+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/cl-${HC_CLUSTER_NAME}.yaml
205+
----
206+
+
207+
.. Back up the {aws-short} cluster by entering the following commands:
208+
+
209+
[source,terminal]
210+
----
135211
$ echo "--> AWS Cluster:"
136-
$ oc get awscluster ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/awscl-${HC_CLUSTER_NAME}.yaml
137-
138-
# AWS MachineTemplate
212+
----
213+
+
214+
[source,terminal]
215+
----
216+
$ oc get awscluster ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > \
217+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/awscl-${HC_CLUSTER_NAME}.yaml
218+
----
219+
+
220+
.. Back up the {aws-short} `MachineTemplate` objects by entering the following commands:
221+
+
222+
[source,terminal]
223+
----
139224
$ echo "--> AWS Machine Template:"
140-
$ oc get awsmachinetemplate ${NODEPOOLS} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/awsmt-${HC_CLUSTER_NAME}.yaml
141-
142-
# AWS Machines
225+
----
226+
+
227+
[source,terminal]
228+
----
229+
$ oc get awsmachinetemplate ${NODEPOOLS} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o yaml > \
230+
${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/awsmt-${HC_CLUSTER_NAME}.yaml
231+
----
232+
+
233+
.. Back up the {aws-short} `Machines` objects by running the following shell script:
234+
+
235+
[source,terminal]
236+
----
143237
$ echo "--> AWS Machine:"
238+
----
239+
+
240+
[source,terminal]
241+
----
144242
$ CL_NAME=$(oc get hcp ${HC_CLUSTER_NAME} -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o jsonpath={.metadata.labels.\*} | grep ${HC_CLUSTER_NAME})
145243
for s in $(oc get awsmachines -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} --no-headers | grep ${CL_NAME} | cut -f1 -d\ ); do
146244
oc get -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} awsmachines $s -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/awsm-${s}.yaml
147245
done
148-
149-
# MachineDeployments
246+
----
247+
+
248+
.. Back up the `MachineDeployments` objects by running the following shell script:
249+
+
250+
[source,terminal]
251+
----
150252
$ echo "--> HostedCluster MachineDeployments:"
151253
for s in $(oc get machinedeployment -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o name); do
152254
mdp_name=$(echo ${s} | cut -f 2 -d /)
153255
oc get -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} $s -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/machinedeployment-${mdp_name}.yaml
154256
done
155-
156-
# MachineSets
257+
----
258+
+
259+
.. Back up the `MachineSets` objects by running the following shell script:
260+
+
261+
[source,terminal]
262+
----
157263
$ echo "--> HostedCluster MachineSets:"
158264
for s in $(oc get machineset -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o name); do
159265
ms_name=$(echo ${s} | cut -f 2 -d /)
160266
oc get -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} $s -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/machineset-${ms_name}.yaml
161267
done
162-
163-
# Machines
268+
----
269+
+
270+
.. Back up the `Machines` objects from the Hosted Control Plane namespace by running the following shell script:
271+
+
272+
[source,terminal]
273+
----
164274
$ echo "--> HostedCluster Machine:"
165275
for s in $(oc get machine -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} -o name); do
166276
m_name=$(echo ${s} | cut -f 2 -d /)
167277
oc get -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} $s -o yaml > ${BACKUP_DIR}/namespaces/${HC_CLUSTER_NS}-${HC_CLUSTER_NAME}/machine-${m_name}.yaml
168278
done
169279
----
170280

171-
. Clean up the `ControlPlane` routes by entering this command:
281+
. Clean up the `ControlPlane` routes by entering the following command:
172282
+
173283
[source,terminal]
174284
----
@@ -177,7 +287,7 @@ $ oc delete routes -n ${HC_CLUSTER_NS}-${HC_CLUSTER_NAME} --all
177287
+
178288
By entering that command, you enable the ExternalDNS Operator to delete the Route53 entries.
179289

180-
. Verify that the Route53 entries are clean by running this script:
290+
. Verify that the Route53 entries are clean by running the following script:
181291
+
182292
[source,terminal]
183293
----
@@ -226,4 +336,4 @@ Check all of the {product-title} objects and the S3 bucket to verify that everyt
226336

227337
.Next steps
228338

229-
Restore your hosted cluster.
339+
Restore your hosted cluster.

0 commit comments

Comments
 (0)