Skip to content

Commit aa86ff1

Browse files
committed
OPRUN-4106: remove support for annotation based config
With #2166 and #2163 in place, annotation based config support can be removed. Signed-off-by: Anik Bhattacharjee <[email protected]>
1 parent 27b05e7 commit aa86ff1

File tree

5 files changed

+24
-37
lines changed

5 files changed

+24
-37
lines changed

docs/draft/howto/single-ownnamespace-install.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ apiVersion: olm.operatorframework.io/v1
9191
kind: ClusterExtension
9292
metadata:
9393
name: argocd
94-
annotations:
95-
olm.operatorframework.io/watch-namespace: argocd
9694
spec:
9795
namespace: argocd
9896
serviceAccount:

hack/demo/resources/own-namespace-demo.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apiVersion: olm.operatorframework.io/v1
22
kind: ClusterExtension
33
metadata:
44
name: argocd-operator
5-
annotations:
6-
# watch namespace is the same as intall namespace
7-
olm.operatorframework.io/watch-namespace: argocd-system
85
spec:
96
namespace: argocd-system
107
serviceAccount:
118
name: argocd-installer
9+
config:
10+
inline:
11+
watchNamespace: argocd-system
1212
source:
1313
sourceType: Catalog
1414
catalog:

hack/demo/resources/single-namespace-demo.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apiVersion: olm.operatorframework.io/v1
22
kind: ClusterExtension
33
metadata:
44
name: argocd-operator
5-
annotations:
6-
# watch-namespace is different from install namespace
7-
olm.operatorframework.io/watch-namespace: argocd
85
spec:
96
namespace: argocd-system
107
serviceAccount:
118
name: argocd-installer
9+
config:
10+
inline:
11+
watchNamespace: argocd
1212
source:
1313
sourceType: Catalog
1414
catalog:

internal/operator-controller/applier/watchnamespace.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ import (
1010
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
1111
)
1212

13-
const (
14-
AnnotationClusterExtensionWatchNamespace = "olm.operatorframework.io/watch-namespace"
15-
)
16-
1713
// GetWatchNamespace determines the watch namespace the ClusterExtension should use
1814
// Note: this is a temporary artifice to enable gated use of single/own namespace install modes
1915
// for registry+v1 bundles. This will go away once the ClusterExtension API is updated to include
@@ -32,8 +28,6 @@ func GetWatchNamespace(ext *ocv1.ClusterExtension) (string, error) {
3228
return "", fmt.Errorf("invalid bundle configuration: %w", err)
3329
}
3430
watchNamespace = cfg.WatchNamespace
35-
} else if _, ok := ext.Annotations[AnnotationClusterExtensionWatchNamespace]; ok {
36-
watchNamespace = ext.Annotations[AnnotationClusterExtensionWatchNamespace]
3731
} else {
3832
return "", nil
3933
}

internal/operator-controller/applier/watchnamespace_test.go

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,59 +71,54 @@ func TestGetWatchNamespace(t *testing.T) {
7171
},
7272
expectError: false,
7373
}, {
74-
name: "cluster extension configures a watch namespace through annotation",
74+
name: "cluster extension configures a watch namespace through spec.config.inline",
7575
want: "watch-namespace",
7676
csv: &ocv1.ClusterExtension{
7777
ObjectMeta: metav1.ObjectMeta{
7878
Name: "extension",
79-
Annotations: map[string]string{
80-
"olm.operatorframework.io/watch-namespace": "watch-namespace",
79+
},
80+
Spec: ocv1.ClusterExtensionSpec{
81+
Config: &ocv1.ClusterExtensionConfig{
82+
ConfigType: ocv1.ClusterExtensionConfigTypeInline,
83+
Inline: &apiextensionsv1.JSON{
84+
Raw: []byte(`{"watchNamespace":"watch-namespace"}`),
85+
},
8186
},
8287
},
8388
},
8489
expectError: false,
8590
}, {
86-
name: "cluster extension configures a watch namespace through annotation with invalid ns",
91+
name: "cluster extension configures a watch namespace through spec.config.inline with invalid ns",
8792
csv: &ocv1.ClusterExtension{
8893
ObjectMeta: metav1.ObjectMeta{
8994
Name: "extension",
90-
Annotations: map[string]string{
91-
"olm.operatorframework.io/watch-namespace": "watch-namespace-",
92-
},
9395
},
94-
},
95-
expectError: true,
96-
}, {
97-
name: "cluster extension configures a watch namespace through annotation with empty ns",
98-
csv: &ocv1.ClusterExtension{
99-
ObjectMeta: metav1.ObjectMeta{
100-
Name: "extension",
101-
Annotations: map[string]string{
102-
"olm.operatorframework.io/watch-namespace": "",
96+
Spec: ocv1.ClusterExtensionSpec{
97+
Config: &ocv1.ClusterExtensionConfig{
98+
ConfigType: ocv1.ClusterExtensionConfigTypeInline,
99+
Inline: &apiextensionsv1.JSON{
100+
Raw: []byte(`{"watchNamespace":"watch-namespace-"}`),
101+
},
103102
},
104103
},
105104
},
106105
expectError: true,
107106
}, {
108-
name: "cluster extension configures a watch namespace through annotation and config (take config)",
109-
want: "watch-namespace",
107+
name: "cluster extension configures a watch namespace through spec.config.inline with empty ns",
110108
csv: &ocv1.ClusterExtension{
111109
ObjectMeta: metav1.ObjectMeta{
112110
Name: "extension",
113-
Annotations: map[string]string{
114-
"olm.operatorframework.io/watch-namespace": "dont-use-this-watch-namespace",
115-
},
116111
},
117112
Spec: ocv1.ClusterExtensionSpec{
118113
Config: &ocv1.ClusterExtensionConfig{
119114
ConfigType: ocv1.ClusterExtensionConfigTypeInline,
120115
Inline: &apiextensionsv1.JSON{
121-
Raw: []byte(`{"watchNamespace":"watch-namespace"}`),
116+
Raw: []byte(`{"watchNamespace":""}`),
122117
},
123118
},
124119
},
125120
},
126-
expectError: false,
121+
expectError: true,
127122
}, {
128123
name: "cluster extension configures an invalid watchNamespace: multiple watch namespaces",
129124
want: "",

0 commit comments

Comments
 (0)