Skip to content

Commit 450b30d

Browse files
committed
chore(olm): remove cleanup func from operator
1 parent 3d33e09 commit 450b30d

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

cmd/olm/main.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ import (
2121
)
2222

2323
const (
24-
envOperatorName = "OPERATOR_NAME"
25-
envOperatorNamespace = "OPERATOR_NAMESPACE"
26-
ALMManagedAnnotationKey = "alm-manager"
27-
2824
defaultWakeupInterval = 5 * time.Minute
2925
)
3026

@@ -75,17 +71,6 @@ func main() {
7571
os.Exit(0)
7672
}
7773

78-
// Env Vars
79-
operatorNamespace := envOrDie(
80-
envOperatorNamespace, "used to set annotation indicating which ALM operator manages a namespace")
81-
82-
operatorName := envOrDie(
83-
envOperatorName, "used to distinguish ALM operators of the same name")
84-
85-
annotation := map[string]string{
86-
ALMManagedAnnotationKey: fmt.Sprintf("%s.%s", operatorNamespace, operatorName),
87-
}
88-
8974
// Set log level to debug if `debug` flag set
9075
if *debug {
9176
log.SetLevel(log.DebugLevel)
@@ -104,12 +89,11 @@ func main() {
10489
opClient := operatorclient.NewClientFromConfig(*kubeConfigPath)
10590

10691
// Create a new instance of the operator.
107-
operator, err := olm.NewOperator(crClient, opClient, &install.StrategyResolver{}, *wakeupInterval, annotation, namespaces)
92+
operator, err := olm.NewOperator(crClient, opClient, &install.StrategyResolver{}, *wakeupInterval, namespaces)
10893

10994
if err != nil {
11095
log.Fatalf("error configuring operator: %s", err.Error())
11196
}
112-
defer operator.Cleanup()
11397

11498
// Serve a health check.
11599
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {

pkg/controller/operators/olm/operator.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,10 @@ type Operator struct {
5454
client versioned.Interface
5555
resolver install.StrategyResolverInterface
5656
lister operatorlister.OperatorLister
57-
// csvLister map[string]csvlister.ClusterServiceVersionLister
58-
// operatorGroupLister map[string]operatorgrouplister.OperatorGroupLister
5957
recorder record.EventRecorder
60-
cleanupFunc func()
6158
}
6259

63-
func NewOperator(crClient versioned.Interface, opClient operatorclient.ClientInterface, resolver install.StrategyResolverInterface, wakeupInterval time.Duration, annotations map[string]string, namespaces []string) (*Operator, error) {
60+
func NewOperator(crClient versioned.Interface, opClient operatorclient.ClientInterface, resolver install.StrategyResolverInterface, wakeupInterval time.Duration, namespaces []string) (*Operator, error) {
6461
if wakeupInterval < 0 {
6562
wakeupInterval = FallbackWakeupInterval
6663
}
@@ -268,11 +265,6 @@ func NewOperator(crClient versioned.Interface, opClient operatorclient.ClientInt
268265
return op, nil
269266
}
270267

271-
// Cleanup cleans up operator resources on the cluster
272-
func (a *Operator) Cleanup() {
273-
a.cleanupFunc()
274-
}
275-
276268
func (a *Operator) requeueCSV(name, namespace string) {
277269
// we can build the key directly, will need to change if queue uses different key scheme
278270
key := fmt.Sprintf("%s/%s", namespace, name)

pkg/controller/operators/olm/operator_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ func NewFakeOperator(clientObjs []runtime.Object, k8sObjs []runtime.Object, extO
125125
k8sClientFake.Resources = apiResourcesForObjects(append(extObjs, regObjs...))
126126
opClientFake := operatorclient.NewClient(k8sClientFake, apiextensionsfake.NewSimpleClientset(extObjs...), apiregistrationfake.NewSimpleClientset(regObjs...))
127127

128-
annotations := map[string]string{"test": "annotation"}
129128
eventRecorder, err := event.NewRecorder(opClientFake.KubernetesInterface().CoreV1().Events(metav1.NamespaceAll))
130129
if err != nil {
131130
return nil, err
@@ -140,9 +139,6 @@ func NewFakeOperator(clientObjs []runtime.Object, k8sObjs []runtime.Object, extO
140139
resolver: resolver,
141140
csvQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "clusterserviceversions"),
142141
recorder: eventRecorder,
143-
cleanupFunc: func() {
144-
namespaceAnnotator.CleanNamespaceAnnotations(namespaces)
145-
},
146142
}
147143

148144
wakeupInterval := 5 * time.Second

0 commit comments

Comments
 (0)