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