Skip to content

Commit 1e1e0a9

Browse files
committed
TELCODOCS-1690 - support node deletion via gitops ztp
1 parent 1ffa2bd commit 1e1e0a9

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

edge_computing/ztp-advanced-install-ztp.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ You can use `SiteConfig` custom resources (CRs) to deploy custom functionality a
1111
include::modules/ztp-customizing-the-install-extra-manifests.adoc[leveloffset=+1]
1212

1313
include::modules/ztp-filtering-ai-crs-using-siteconfig.adoc[leveloffset=+1]
14+
15+
include::modules/ztp-deleting-node-using-siteconfig.adoc[leveloffset=+1]
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * edge_computing/ztp-advanced-install-ztp.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="ztp-deleting-node-siteconfig_{context}"]
7+
= Deleting a node by using the SiteConfig CR
8+
9+
By using a `SiteConfig` custom resource (CR), you can delete and reprovision a node.
10+
This method is more efficient than manually deleting the node.
11+
12+
.Prerequisites
13+
14+
* You have configured the hub cluster to generate the required installation and policy CRs.
15+
16+
* You have created a Git repository in which you can manage your custom site configuration data. The repository must be accessible from the hub cluster and be defined as the source repository for the Argo CD application.
17+
18+
19+
.Procedure
20+
21+
. Update the `SiteConfig` CR to include the `bmac.agent-install.openshift.io/remove-agent-and-node-on-delete=true` annotation:
22+
+
23+
[source,yaml]
24+
----
25+
apiVersion: ran.openshift.io/v1
26+
kind: SiteConfig
27+
metadata:
28+
name: "cnfdf20"
29+
namespace: "cnfdf20"
30+
spec:
31+
Clusters:
32+
nodes:
33+
- hostname: node6
34+
role: "worker"
35+
crAnnotations:
36+
add:
37+
BareMetalHost:
38+
bmac.agent-install.openshift.io/remove-agent-and-node-on-delete: true
39+
# ...
40+
----
41+
42+
. Suppress the generation of the `BareMetalHost` CR by updating the `SiteConfig` CR to include the `crSuppression.BareMetalHost` annotation:
43+
+
44+
[source,yaml]
45+
----
46+
apiVersion: ran.openshift.io/v1
47+
kind: SiteConfig
48+
metadata:
49+
name: "cnfdf20"
50+
namespace: "cnfdf20"
51+
spec:
52+
clusters:
53+
- nodes:
54+
- hostName: node6
55+
role: "worker"
56+
crSuppression:
57+
- BareMetalHost
58+
# ...
59+
----
60+
61+
. Push the changes to the Git repository and wait for deprovisioning to start.
62+
The status of the `BareMetalHost` CR should change to `deprovisioning`. Wait for the `BareMetalHost` to finish deprovisioning, and be fully deleted.
63+
64+
.Verification
65+
66+
. Verify that the `BareMetalHost` and `Agent` CRs for the worker node have been deleted from the hub cluster by running the following commands:
67+
+
68+
[source,terminal]
69+
----
70+
$ oc get bmh -n <cluster-ns>
71+
----
72+
+
73+
[source,terminal]
74+
----
75+
$ oc get agent -n <cluster-ns>
76+
----
77+
78+
. Verify that the node record has been deleted from the spoke cluster by running the following command:
79+
+
80+
[source,terminal]
81+
----
82+
$ oc get nodes
83+
----
84+
+
85+
[NOTE]
86+
====
87+
If you are working with secrets, deleting a secret too early can cause an issue because ArgoCD needs the secret to complete resynchronization after deletion.
88+
Delete the secret only after the node cleanup, when the current ArgoCD synchronization is complete.
89+
====
90+
91+
.Next Steps
92+
93+
To reprovision a node, delete the changes previously added to the `SiteConfig`, push the changes to the Git repository, and wait for the synchronization to complete.
94+
This regenerates the `BareMetalHost` CR of the worker node and triggers the re-install of the node.

0 commit comments

Comments
 (0)