Skip to content

Commit ddf9520

Browse files
authored
add resourceCleanup featureGate introduction (#473)
Signed-off-by: Zhiwei Yin <zyin@redhat.com>
1 parent b335e25 commit ddf9520

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

content/en/docs/getting-started/installation/register-a-cluster.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,39 @@ Check the klusterlet is removed from the managed cluster.
316316
kubectl get klusterlet --context ${CTX_MANAGED_CLUSTER}
317317
error: the server doesn't have a resource type "klusterlet
318318
```
319+
320+
### Resource cleanup when the managed cluster is deleted
321+
322+
When a user deletes the managedCluster resource, all associated resources within the cluster namespace must also be removed. This includes managedClusterAddons, manifestWorks, and the roleBindings for the klusterlet agent. Resource cleanup follows a specific sequence to prevent resources from being stuck in a terminating state:
323+
324+
1. managedClusterAddons are deleted first.
325+
2. manifestWorks are removed subsequently after all managedClusterAddons are deleted.
326+
3. For the same resource as managedClusterAddon or manifestWork, custom deletion ordering can be defined using the `open-cluster-management.io/cleanup-priority` annotation:
327+
- Priority values range from 0 to 100 (lower values execute first).
328+
329+
The `open-cluster-management.io/cleanup-priority` annotation controls deletion order when resource instances have dependencies. For example:
330+
331+
A manifestWork that applies a CRD and operator should be deleted after a manifestWork that creates a CR instance, allowing the operator to perform cleanup after the CR is removed.
332+
333+
334+
The `ResourceCleanup` featureGate for cluster registration on the Hub cluster enables automatic cleanup of managedClusterAddons and manifestWorks within the cluster namespace after cluster unjoining.
335+
336+
**Version Compatibility:**
337+
- The `ResourceCleanup` featureGate was introdueced in OCM v0.13.0, and was **disabled by default** in OCM v0.16.0 and earlier versions. To activate it, need to modify the clusterManager CR configuration:
338+
```yaml
339+
registrationConfiguration:
340+
featureGates:
341+
- feature: ResourceCleanup
342+
mode: Enable
343+
```
344+
345+
- Starting with OCM v0.17.0, the `ResourceCleanup` featureGate has been upgraded from Alpha to Beta status and is **enabled by default**.
346+
347+
**Disabling the Feature:**
348+
To deactivate this functionality, update the clusterManager CR on the hub cluster:
349+
```yaml
350+
registrationConfiguration:
351+
featureGates:
352+
- feature: ResourceCleanup
353+
mode: Disable
354+
```

0 commit comments

Comments
 (0)