|
7 | 7 | "strings" |
8 | 8 |
|
9 | 9 | admissionregistrationv1 "k8s.io/api/admissionregistration/v1" |
10 | | - |
11 | 10 | appsv1 "k8s.io/api/apps/v1" |
12 | 11 | rbac "k8s.io/api/rbac/v1" |
13 | 12 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
@@ -388,6 +387,7 @@ const ( |
388 | 387 | CSVReasonDetectedClusterChange ConditionReason = "DetectedClusterChange" |
389 | 388 | CSVReasonInvalidWebhookDescription ConditionReason = "InvalidWebhookDescription" |
390 | 389 | CSVReasonOperatorConditionNotUpgradeable ConditionReason = "OperatorConditionNotUpgradeable" |
| 390 | + CSVReasonWaitingForCleanupToComplete ConditionReason = "WaitingOnCleanup" |
391 | 391 | ) |
392 | 392 |
|
393 | 393 | // HasCaResources returns true if the CSV has owned APIServices or Webhooks. |
@@ -516,48 +516,19 @@ type CleanupStatus struct { |
516 | 516 | PendingDeletion []ResourceList `json:"pendingDeletion,omitempty"` |
517 | 517 | } |
518 | 518 |
|
519 | | -// ResourceList represents a list of resources which are of the same GVK |
| 519 | +// ResourceList represents a list of resources which are of the same Group/Kind |
520 | 520 | type ResourceList struct { |
521 | | - Group string `json:"group"` |
522 | | - Version string `json:"version"` |
523 | | - Kind string `json:"kind"` |
524 | | - Instances []NamespacedName `json:"instances"` |
| 521 | + Group string `json:"group"` |
| 522 | + Kind string `json:"kind"` |
| 523 | + Instances []ResourceInstance `json:"instances"` |
525 | 524 | } |
526 | 525 |
|
527 | | -// NamespacedName represents the name and namespace of a resource |
528 | | -type NamespacedName struct { |
| 526 | +type ResourceInstance struct { |
529 | 527 | Name string `json:"name"` |
530 | 528 | // Namespace can be empty for cluster-scoped resources |
531 | 529 | Namespace string `json:"namespace,omitempty"` |
532 | 530 | } |
533 | 531 |
|
534 | | -// HasFinalizer returns true if the CSV has the specified finalizer string |
535 | | -func (c *ClusterServiceVersion) HasFinalizer(finalizer string) bool { |
536 | | - for _, f := range c.Finalizers { |
537 | | - if f == finalizer { |
538 | | - return true |
539 | | - } |
540 | | - } |
541 | | - return false |
542 | | -} |
543 | | - |
544 | | -// AppendFinalizer appends the specified finalizer to the CSV |
545 | | -func (c *ClusterServiceVersion) AppendFinalizer(finalizer string) { |
546 | | - c.Finalizers = append(c.Finalizers, finalizer) |
547 | | -} |
548 | | - |
549 | | -// RemoveFinalizer removes the specified finalizer from the CSV if it exists |
550 | | -func (c *ClusterServiceVersion) RemoveFinalizer(finalizer string) { |
551 | | - result := []string{} |
552 | | - for _, f := range c.Finalizers { |
553 | | - if f == finalizer { |
554 | | - continue |
555 | | - } |
556 | | - result = append(result, f) |
557 | | - } |
558 | | - c.Finalizers = result |
559 | | -} |
560 | | - |
561 | 532 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
562 | 533 | // +genclient |
563 | 534 | // +kubebuilder:storageversion |
|
0 commit comments