@@ -132,8 +132,7 @@ func (r *NamespaceScopeReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
132
132
if rolesList , _ := r .GetRolesFromNamespace (namespaceMember ); len (rolesList ) != 0 {
133
133
var summarizedRules []rbacv1.PolicyRule
134
134
for _ , role := range rolesList {
135
- if role .Name != constant .NamespaceScopeManagedPrefix + instance .Namespace &&
136
- role .Name != constant .NamespaceScopeRuntimePrefix + instance .Namespace {
135
+ if role .Name != constant .NamespaceScopeManagedPrefix + instance .Namespace {
137
136
summarizedRules = append (summarizedRules , role .Rules ... )
138
137
}
139
138
}
@@ -405,13 +404,9 @@ func (r *NamespaceScopeReconciler) generateRBACForNSS(instance *operatorv1.Names
405
404
}
406
405
407
406
func (r * NamespaceScopeReconciler ) generateRuntimeRoleForNSS (instance * operatorv1.NamespaceScope , summarizedRules []rbacv1.PolicyRule , fromNs , toNs string ) error {
408
- labels := map [string ]string {
409
- "namespace-scope-configmap" : instance .Namespace + "-" + instance .Spec .ConfigmapName ,
410
- }
411
-
412
- if err := r .createRuntimeRoleForNSS (labels , summarizedRules , fromNs , toNs ); err != nil {
407
+ if err := r .createRuntimeRoleForNSS (summarizedRules , fromNs , toNs ); err != nil {
413
408
if errors .IsAlreadyExists (err ) {
414
- if err := r .updateRuntimeRoleForNSS (labels , summarizedRules , fromNs , toNs ); err != nil {
409
+ if err := r .updateRuntimeRoleForNSS (summarizedRules , fromNs , toNs ); err != nil {
415
410
return err
416
411
}
417
412
return nil
@@ -425,14 +420,13 @@ func (r *NamespaceScopeReconciler) generateRuntimeRoleForNSS(instance *operatorv
425
420
return nil
426
421
}
427
422
428
- func (r * NamespaceScopeReconciler ) createRuntimeRoleForNSS (labels map [ string ] string , summarizedRules []rbacv1.PolicyRule , fromNs , toNs string ) error {
423
+ func (r * NamespaceScopeReconciler ) createRuntimeRoleForNSS (summarizedRules []rbacv1.PolicyRule , fromNs , toNs string ) error {
429
424
name := constant .NamespaceScopeRuntimePrefix + fromNs
430
425
namespace := toNs
431
426
role := & rbacv1.Role {
432
427
ObjectMeta : metav1.ObjectMeta {
433
428
Name : name ,
434
429
Namespace : namespace ,
435
- Labels : labels ,
436
430
},
437
431
Rules : summarizedRules ,
438
432
}
@@ -448,15 +442,14 @@ func (r *NamespaceScopeReconciler) createRuntimeRoleForNSS(labels map[string]str
448
442
return nil
449
443
}
450
444
451
- func (r * NamespaceScopeReconciler ) updateRuntimeRoleForNSS (labels map [ string ] string , summarizedRules []rbacv1.PolicyRule , fromNs , toNs string ) error {
445
+ func (r * NamespaceScopeReconciler ) updateRuntimeRoleForNSS (summarizedRules []rbacv1.PolicyRule , fromNs , toNs string ) error {
452
446
name := constant .NamespaceScopeRuntimePrefix + fromNs
453
447
namespace := toNs
454
448
455
449
role := & rbacv1.Role {
456
450
ObjectMeta : metav1.ObjectMeta {
457
451
Name : name ,
458
452
Namespace : namespace ,
459
- Labels : labels ,
460
453
},
461
454
Rules : summarizedRules ,
462
455
}
0 commit comments