Skip to content

Commit 355bf86

Browse files
ibm-ci-bothoris233
andauthored
feat: reduce the permission of restricted mode (#75)
Co-authored-by: Jiaming Hu <[email protected]>
1 parent 7b87a1d commit 355bf86

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
@@ -115,7 +115,13 @@ spec:
115115
resources:
116116
- '*'
117117
verbs:
118-
- '*'
118+
- create
119+
- delete
120+
- get
121+
- list
122+
- patch
123+
- update
124+
- watch
119125
serviceAccountName: ibm-namespace-scope-operator
120126
strategy: deployment
121127
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)