You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for addon deletion-orphan annotation (#518)
This commit adds comprehensive documentation for the
addon.open-cluster-management.io/deletion-orphan annotation that
allows addon developers to preserve specific resources when an
addon is deleted.
Changes include:
- New section "Orphaning manifests on addon deletion" explaining
the deletion-orphan annotation
- Usage examples and use cases for orphaning resources
- Complete example with PersistentVolumeClaim preservation
- Integration with addon template documentation showing the
annotation can be used in AddOnTemplate manifests
- Example in the AddOnTemplate YAML demonstrating the annotation
This documentation is based on the implementation in
addon-framework/pkg/addonmanager/controllers/agentdeploy/utils.go
(getDeletionOrphaningRule function).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Signed-off-by: zhujian <[email protected]>
Co-authored-by: Claude <[email protected]>
Copy file name to clipboardExpand all lines: content/en/docs/developer-guides/addon.md
+98-1Lines changed: 98 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -837,6 +837,101 @@ After the `Jobs` are `Completed` or `Pods` are in the `Succeeded` phase, all the
837
837
838
838
You can find the example from [here](https://github.com/open-cluster-management-io/addon-framework/tree/main/examples/helloworld_helm).
839
839
840
+
## Orphaning manifests on addon deletion
841
+
842
+
By default, when a `ManagedClusterAddOn` is deleted, all the resources deployed by the addon will be automatically removed from the managed cluster. However, in some cases, you may want to preserve certain resources even after the addon is deleted. The addon-framework provides the `addon.open-cluster-management.io/deletion-orphan` annotation to support this use case.
843
+
844
+
When you add this annotation to any resource in your addon manifests, that resource will be "orphaned" (left behind) when the addon is deleted, instead of being automatically cleaned up.
845
+
846
+
### How to use the deletion-orphan annotation
847
+
848
+
Add the `addon.open-cluster-management.io/deletion-orphan` annotation to any resources in your addon manifests that you want to preserve after addon deletion:
* The PersistentVolumeClaim will be preserved with its data intact
933
+
* You can reinstall the addon later and it will reconnect to the existing PVC
934
+
840
935
## What happened under the scene
841
936
842
937
<div style="text-align: center; padding: 20px;">
@@ -937,7 +1032,7 @@ volumes, health probe for daemonsets) from OCM v0.14.0.
937
1032
938
1033
1. Create an `AddOnTemplate` object to define the addon:
939
1034
The `AddOnTemplate` API provides two parts of information to build an addon:
940
-
* `manifests`: what resources will be deployed to the managed cluster
1035
+
* `manifests`: what resources will be deployed to the managed cluster. You can add the `addon.open-cluster-management.io/deletion-orphan` annotation to any resource to preserve it when the addon is deleted (see [Orphaning manifests on addon deletion](#orphaning-manifests-on-addon-deletion)).
941
1036
* `registration`: how to register the addon to the hub cluster
942
1037
943
1038
For example, the following yaml file defines the `hello-template` addon, which will:
@@ -994,6 +1089,8 @@ volumes, health probe for daemonsets) from OCM v0.14.0.
994
1089
metadata:
995
1090
name: hello-template-agent-sa
996
1091
namespace: open-cluster-management-agent-addon
1092
+
annotations:
1093
+
addon.open-cluster-management.io/deletion-orphan: "" # Optional: preserve this resource when addon is deleted
0 commit comments