Skip to content

Commit aad8f08

Browse files
authored
feat: reduce the permission of restricted mode (#74)
1 parent f14ec28 commit aad8f08

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

bundle-restricted/manifests/ibm-namespace-scope-operator-restricted.clusterserviceversion.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ spec:
116116
resources:
117117
- '*'
118118
verbs:
119-
- '*'
119+
- create
120+
- delete
121+
- get
122+
- list
123+
- patch
124+
- update
125+
- watch
120126
serviceAccountName: ibm-namespace-scope-operator
121127
strategy: deployment
122128
installModes:

controllers/namespacescope_controller.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,16 @@ func (r *NamespaceScopeReconciler) checkNamespaceAdminAuth(namespace string) boo
700700

701701
func (r *NamespaceScopeReconciler) getValidatedNamespaces(instance *operatorv1.NamespaceScope) ([]string, error) {
702702
var validatedNs []string
703+
operatorNs, err := util.GetOperatorNamespace()
704+
if err != nil {
705+
klog.Error("get operator namespace failed: ", err)
706+
return validatedNs, err
707+
}
703708
for _, nsMem := range instance.Spec.NamespaceMembers {
709+
if nsMem == operatorNs {
710+
validatedNs = append(validatedNs, nsMem)
711+
continue
712+
}
704713
// Check if operator has target namespace admin permission
705714
if r.checkNamespaceAdminAuth(nsMem) {
706715
// Check if operator has permission to get namespace resource

0 commit comments

Comments
 (0)