Skip to content

Commit

Permalink
add clusterDeleting condition and deletion-priority label
Browse files Browse the repository at this point in the history
Signed-off-by: ZhiweiYin <[email protected]>
  • Loading branch information
zhiweiyin318 committed Sep 25, 2023
1 parent eb6bdf7 commit f12e86f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cluster/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,16 @@ const (
// relating to the ManagedCluster is removed when the ManagedCluster is deleted.
ManagedClusterFinalizer = "cluster.open-cluster-management.io/api-resource-cleanup"
)

const (
// ManagedClusterConditionDeleting is a condition which means the cluster is in deletion process.
ManagedClusterConditionDeleting string = "ManagedClusterIsDeleting"

// ConditionDeletingReasonResourceRemaining is a reason for the condition ManagedClusterIsDeleting, which means
// there are resources are remaining during deletion process.
ConditionDeletingReasonResourceRemaining string = "ResourceRemaining"

// ConditionDeletingReasonResourceError is a reason for the condition ManagedClusterIsDeleting, which means
// meet errors during the deletion process.
ConditionDeletingReasonResourceError string = "DeletingError"
)
13 changes: 13 additions & 0 deletions utils/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package utils

const (
// LabelDeletionPriority is a label for the resources deployed in cluster ns which are waiting to be cleaned up
// after cluster is deleted.
// The value is an integer value, The larger the value, the later the order of deletion.
// The deletion order is :
// 1. delete resources without this label firstly.
// 2. delete resources with invalid value of this label.
// 3. delete resources following the priority value. For example, there are 2 manifestWorks, one value is set 100
// and another is set 10, the manifestWorks with 10 will be deleted before the one with 100.
LabelDeletionPriority string = "open-cluster-management.io/deletion-priority"
)

0 comments on commit f12e86f

Please sign in to comment.