Skip to content

Commit

Permalink
add clusterDeleting condition and cleanup-priority annotation
Browse files Browse the repository at this point in the history
Signed-off-by: ZhiweiYin <zyin@redhat.com>
  • Loading branch information
zhiweiyin318 committed Oct 12, 2023
1 parent eb6bdf7 commit 8d45f64
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 (
// CleanupPriorityAnnotationKey is a annotation for the resources deployed in cluster ns which are waiting to
// be cleaned up after cluster is deleted.
// The value is an integer value [0,100], The larger the value, the later the order of deletion.
// The deletion order is :
// 1. delete resources without this annotation firstly.
// 2. delete resources with invalid value of this annotation (!= [0,100]).
// 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.
CleanupPriorityAnnotationKey string = "open-cluster-management.io/cleanup-priority"
)

0 comments on commit 8d45f64

Please sign in to comment.