Skip to content

Commit b2a6036

Browse files
committed
trying to add cluster scope
1 parent 8110293 commit b2a6036

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Diff for: cmd/main.go

+4
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
414414
return operator.Config{}, operator.Dependencies{}, errors.WithStack(fmt.Errorf("Scope %s is not known by Operator", operatorOptions.scope))
415415
}
416416

417+
if scope.IsCluster() {
418+
namespace = metav1.NamespaceAll
419+
}
420+
417421
cfg := operator.Config{
418422
ID: id,
419423
Namespace: namespace,

Diff for: pkg/operator/scope/scope.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ func AsScope(s string) (Scope, bool) {
2626
return LegacyScope, true
2727
case NamespacedScope.String():
2828
return NamespacedScope, true
29+
case ClusterScope.String():
30+
return ClusterScope, true
2931
}
3032

3133
return "", false
@@ -37,13 +39,18 @@ func (s Scope) String() string {
3739
return string(s)
3840
}
3941

42+
func (s Scope) IsCluster() bool {
43+
return s == ClusterScope
44+
}
45+
4046
func (s Scope) IsNamespaced() bool {
41-
return s == NamespacedScope
47+
return s.IsCluster() || s == NamespacedScope
4248
}
4349

4450
const (
4551
LegacyScope Scope = "legacy"
4652
NamespacedScope Scope = "namespaced"
53+
ClusterScope Scope = "cluster"
4754

4855
DefaultScope = LegacyScope
4956
)

0 commit comments

Comments
 (0)