-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clusterset delete policy #53
Open
ldpliu
wants to merge
1
commit into
open-cluster-management-io:main
Choose a base branch
from
ldpliu:clusterset-delete
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
enhancements/sig-architecture/34-clusterset-delete/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# ManagedClusterSet Delete policy | ||
|
||
## Release Signoff Checklist | ||
- [ ] Enhancement is `implementable` | ||
- [ ] Design details are appropriately documented from clear requirements | ||
- [ ] Test plan is defined | ||
- [ ] Graduation criteria for dev preview, tech preview, GA | ||
- [ ] User-facing documentation is created in [website](https://github.com/open-cluster-management/website/) | ||
|
||
## Summary | ||
The proposed work enhances the managedClusterSet API to handle managedClusterSet Delete policy. | ||
|
||
## Motivation | ||
Currently, when we add a cluster to a clusterset, we will add a label `cluster.open-cluster-management.io/clusterset:<Clusterset Name>` to the cluster. But when the clusterset is deleted, this label will not be removed. | ||
|
||
So we need to design the delete policy for clusterset. | ||
|
||
## Proposal Detail | ||
Actually, we always use clusterset as a group of clusters. So when deleting a clusterset, there are some options for the delete policy. | ||
1. When clusterset deleted, delete the clusterset labels in managedClusters. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still think this is an unnatural behavior to remove a thing not managed by it. |
||
2. When clusterset deleted, delete the managedClusters in clusterset. | ||
3. Hold the clusterset deletion if there are clusters in the set. | ||
|
||
### API Change | ||
We add a new field `DeletePolicy` in `ManagedClusterSetSpec`. | ||
|
||
```go | ||
type ManagedClusterSetSpec struct { | ||
// Selector represents a selector of ManagedClusters. | ||
ClusterSelector ManagedClusterSelector `json:"clusterSelector"` | ||
|
||
// Only works for the ClusterSelector.SelectorType is "LegacyClusterSetLabel" | ||
// +optional | ||
DeletePolicy DeletePolicyType | ||
} | ||
|
||
type DeletePolicyType string | ||
|
||
type ManagedClusterSelector struct{ | ||
SelectorType SelectorType `json:"selectorType"` | ||
} | ||
|
||
type SelectorType string | ||
|
||
const ( | ||
LegacyClusterSetLabel SelectorType = "LegacyClusterSetLabel" | ||
) | ||
|
||
const ( | ||
DeleteClusterSetLabel DeletePolicyType = "DeleteClusterSetLabel" | ||
HoldClusterSetDeletion DeletePolicyType = "HoldClusterSetDeletion" | ||
DeleteClusters DeletePolicyType = "DeleteClusters" | ||
) | ||
|
||
``` | ||
### Details | ||
Notes: the `DeletePolicy` only works for the `ClusterSelector.SelectorType` is `LegacyClusterSetLabel`. It means the clusterset uses the label `cluster.open-cluster-management.io/clusterset:<Clusterset Name>` to select target clusters. So In the doc, we only cover the clusterset which `ClusterSelector.SelectorType` is `LegacyClusterSetLabel` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reason? |
||
There are some options to delete a clusterset. | ||
|
||
1. DeleteClusterSetLabel | ||
In each managed cluster in a clusterset, it should have a label `cluster.open-cluster-management.io/clusterset:<Clusterset Name>`. When the clusterset is deleted. This label is useless. So we could delete the label in each managedClusters when the clusterset is deleted. | ||
|
||
2. HoldClusterSetDeletion | ||
In this option, when a clusterset is deleted, if there still have clusters in this set, we will hold the clusterset deletion. | ||
|
||
3. DeleteClusters | ||
In this option, when a clusterset is deleted, we will delete all clusters in this set. | ||
|
||
4. "" | ||
As this field is optional, so if the value is "", we will only delete the clusterset, and all other related resources will remain. | ||
|
||
## Upgrade / Downgrade Strategy | ||
The new api is compatible with the previous version. So there is no external work needed when upgrading |
13 changes: 13 additions & 0 deletions
13
enhancements/sig-architecture/34-clusterset-delete/metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
title: update-managedcluster-status-to-include-clusterinfo | ||
authors: | ||
- "@ldpliu" | ||
reviewers: | ||
- "@qiujian16" | ||
- "@elgnay" | ||
approvers: | ||
- "@qiujian16" | ||
- "@elgnay" | ||
- "@deads2k" | ||
creation-date: 2022-4-22 | ||
last-updated: 2022-04-22 | ||
status: provisional |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please clarify why this is a problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this need more clarification on use cases.