Skip to content

Commit 37c1c47

Browse files
exdxankitathomas
authored andcommitted
feat: add cleanup phase; fixup cleanup api
(upstream api commit: dca3a00702c3921ca5e124e08761e6a310e9ed3a)
1 parent 65223df commit 37c1c47

File tree

3 files changed

+15
-48
lines changed

3 files changed

+15
-48
lines changed

staging/api/crds/operators.coreos.com_clusterserviceversions.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4698,20 +4698,18 @@ spec:
46984698
description: PendingDeletion is the list of custom resource objects that are pending deletion and blocked on finalizers. This indicates the progress of cleanup that is blocking CSV deletion or operator uninstall.
46994699
type: array
47004700
items:
4701-
description: ResourceList represents a list of resources which are of the same GVK
4701+
description: ResourceList represents a list of resources which are of the same Group/Kind
47024702
type: object
47034703
required:
47044704
- group
47054705
- instances
47064706
- kind
4707-
- version
47084707
properties:
47094708
group:
47104709
type: string
47114710
instances:
47124711
type: array
47134712
items:
4714-
description: NamespacedName represents the name and namespace of a resource
47154713
type: object
47164714
required:
47174715
- name
@@ -4723,8 +4721,6 @@ spec:
47234721
type: string
47244722
kind:
47254723
type: string
4726-
version:
4727-
type: string
47284724
conditions:
47294725
description: List of conditions, a history of state transitions
47304726
type: array

staging/api/crds/zz_defs.go

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/api/pkg/operators/v1alpha1/clusterserviceversion_types.go

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"strings"
88

99
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
10-
1110
appsv1 "k8s.io/api/apps/v1"
1211
rbac "k8s.io/api/rbac/v1"
1312
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -389,6 +388,7 @@ const (
389388
CSVReasonDetectedClusterChange ConditionReason = "DetectedClusterChange"
390389
CSVReasonInvalidWebhookDescription ConditionReason = "InvalidWebhookDescription"
391390
CSVReasonOperatorConditionNotUpgradeable ConditionReason = "OperatorConditionNotUpgradeable"
391+
CSVReasonWaitingForCleanupToComplete ConditionReason = "WaitingOnCleanup"
392392
)
393393

394394
// HasCaResources returns true if the CSV has owned APIServices or Webhooks.
@@ -517,48 +517,19 @@ type CleanupStatus struct {
517517
PendingDeletion []ResourceList `json:"pendingDeletion,omitempty"`
518518
}
519519

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
521521
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"`
526525
}
527526

528-
// NamespacedName represents the name and namespace of a resource
529-
type NamespacedName struct {
527+
type ResourceInstance struct {
530528
Name string `json:"name"`
531529
// Namespace can be empty for cluster-scoped resources
532530
Namespace string `json:"namespace,omitempty"`
533531
}
534532

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-
562533
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
563534
// +genclient
564535
// +kubebuilder:storageversion

0 commit comments

Comments
 (0)