Skip to content

Commit c95efc7

Browse files
authored
Merge pull request #1 from hasbro17/feat/cleanup-api
feat: fixup cleanup api
2 parents 6fbc5d8 + dca3a00 commit c95efc7

File tree

3 files changed

+15
-48
lines changed

3 files changed

+15
-48
lines changed

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

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.

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"
@@ -388,6 +387,7 @@ const (
388387
CSVReasonDetectedClusterChange ConditionReason = "DetectedClusterChange"
389388
CSVReasonInvalidWebhookDescription ConditionReason = "InvalidWebhookDescription"
390389
CSVReasonOperatorConditionNotUpgradeable ConditionReason = "OperatorConditionNotUpgradeable"
390+
CSVReasonWaitingForCleanupToComplete ConditionReason = "WaitingOnCleanup"
391391
)
392392

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

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
520520
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"`
525524
}
526525

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

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

0 commit comments

Comments
 (0)