@@ -266,35 +266,12 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
266
266
},
267
267
},
268
268
{
269
- ObjectMeta : metav1.ObjectMeta {
270
- Name : AdminRoleName ,
271
- Annotations : map [string ]string {
272
- oapi .OpenShiftDescription : "A user that has edit rights within the project and can change the project's membership." ,
273
- },
274
- },
269
+ // a role for a namespace level admin. It is `edit` plus the power to grant permissions to other users.
270
+ ObjectMeta : metav1.ObjectMeta {Name : "system:openshift:aggregate-to-admin" , Labels : map [string ]string {"rbac.authorization.k8s.io/aggregate-to-admin" : "true" }},
275
271
Rules : []rbac.PolicyRule {
276
- rbac .NewRule (readWrite ... ).Groups (kapiGroup ).Resources ("pods" , "pods/attach" , "pods/proxy" , "pods/exec" , "pods/portforward" ).RuleOrDie (),
277
- rbac .NewRule (readWrite ... ).Groups (kapiGroup ).Resources ("replicationcontrollers" , "replicationcontrollers/scale" , "serviceaccounts" ,
278
- "services" , "services/proxy" , "endpoints" , "persistentvolumeclaims" , "configmaps" , "secrets" ).RuleOrDie (),
279
- rbac .NewRule (read ... ).Groups (kapiGroup ).Resources ("limitranges" , "resourcequotas" , "bindings" , "events" ,
280
- "namespaces" , "pods/status" , "resourcequotas/status" , "namespaces/status" , "replicationcontrollers/status" , "pods/log" ).RuleOrDie (),
281
- rbac .NewRule ("impersonate" ).Groups (kapiGroup ).Resources ("serviceaccounts" ).RuleOrDie (),
282
-
283
- rbac .NewRule (readWrite ... ).Groups (autoscalingGroup ).Resources ("horizontalpodautoscalers" ).RuleOrDie (),
284
-
285
- rbac .NewRule (readWrite ... ).Groups (batchGroup ).Resources ("jobs" , "cronjobs" ).RuleOrDie (),
286
-
287
- rbac .NewRule (readWrite ... ).Groups (appsGroup , extensionsGroup ).Resources ("replicationcontrollers/scale" ,
288
- "replicasets" , "replicasets/scale" , "deployments" , "deployments/scale" , "deployments/rollback" ).RuleOrDie (),
289
- rbac .NewRule (read ... ).Groups (appsGroup , extensionsGroup ).Resources ("daemonsets" ).RuleOrDie (),
290
-
291
- rbac .NewRule (readWrite ... ).Groups (appsGroup ).Resources ("statefulsets" , "deployments" , "deployments/scale" , "deployments/status" ).RuleOrDie (),
292
-
293
272
rbac .NewRule (readWrite ... ).Groups (authzGroup , legacyAuthzGroup ).Resources ("roles" , "rolebindings" ).RuleOrDie (),
294
- rbac .NewRule (readWrite ... ).Groups (rbacGroup ).Resources ("roles" , "rolebindings" ).RuleOrDie (),
295
273
rbac .NewRule ("create" ).Groups (authzGroup , legacyAuthzGroup ).Resources ("localresourceaccessreviews" , "localsubjectaccessreviews" , "subjectrulesreviews" ).RuleOrDie (),
296
274
rbac .NewRule ("create" ).Groups (securityGroup , legacySecurityGroup ).Resources ("podsecuritypolicysubjectreviews" , "podsecuritypolicyselfsubjectreviews" , "podsecuritypolicyreviews" ).RuleOrDie (),
297
- rbac .NewRule ("create" ).Groups (kAuthzGroup ).Resources ("localsubjectaccessreviews" ).RuleOrDie (),
298
275
299
276
rbac .NewRule (read ... ).Groups (authzGroup , legacyAuthzGroup ).Resources ("rolebindingrestrictions" ).RuleOrDie (),
300
277
@@ -328,7 +305,7 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
328
305
329
306
rbac .NewRule (readWrite ... ).Groups (templateGroup , legacyTemplateGroup ).Resources ("templates" , "templateconfigs" , "processedtemplates" , "templateinstances" ).RuleOrDie (),
330
307
331
- rbac .NewRule (readWrite ... ).Groups (extensionsGroup , networkingGroup ).Resources ("networkpolicies" ).RuleOrDie (),
308
+ rbac .NewRule (readWrite ... ).Groups (networkingGroup ).Resources ("networkpolicies" ).RuleOrDie (),
332
309
333
310
// backwards compatibility
334
311
rbac .NewRule (readWrite ... ).Groups (buildGroup , legacyBuildGroup ).Resources ("buildlogs" ).RuleOrDie (),
@@ -337,30 +314,11 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
337
314
},
338
315
},
339
316
{
340
- ObjectMeta : metav1.ObjectMeta {
341
- Name : EditRoleName ,
342
- Annotations : map [string ]string {
343
- oapi .OpenShiftDescription : "A user that can create and edit most objects in a project, but can not update the project's membership." ,
344
- },
345
- },
317
+ // a role for a namespace level editor. It grants access to all user level actions in a namespace.
318
+ // It does not grant powers for "privileged" resources which are domain of the system: `/status`
319
+ // subresources or `quota`/`limits` which are used to control namespaces
320
+ ObjectMeta : metav1.ObjectMeta {Name : "system:openshift:aggregate-to-edit" , Labels : map [string ]string {"rbac.authorization.k8s.io/aggregate-to-edit" : "true" }},
346
321
Rules : []rbac.PolicyRule {
347
- rbac .NewRule (readWrite ... ).Groups (kapiGroup ).Resources ("pods" , "pods/attach" , "pods/proxy" , "pods/exec" , "pods/portforward" ).RuleOrDie (),
348
- rbac .NewRule (readWrite ... ).Groups (kapiGroup ).Resources ("replicationcontrollers" , "replicationcontrollers/scale" , "serviceaccounts" ,
349
- "services" , "services/proxy" , "endpoints" , "persistentvolumeclaims" , "configmaps" , "secrets" ).RuleOrDie (),
350
- rbac .NewRule (read ... ).Groups (kapiGroup ).Resources ("limitranges" , "resourcequotas" , "bindings" , "events" ,
351
- "namespaces" , "pods/status" , "resourcequotas/status" , "namespaces/status" , "replicationcontrollers/status" , "pods/log" ).RuleOrDie (),
352
- rbac .NewRule ("impersonate" ).Groups (kapiGroup ).Resources ("serviceaccounts" ).RuleOrDie (),
353
-
354
- rbac .NewRule (readWrite ... ).Groups (autoscalingGroup ).Resources ("horizontalpodautoscalers" ).RuleOrDie (),
355
-
356
- rbac .NewRule (readWrite ... ).Groups (batchGroup ).Resources ("jobs" , "cronjobs" ).RuleOrDie (),
357
-
358
- rbac .NewRule (readWrite ... ).Groups (appsGroup , extensionsGroup ).Resources ("replicationcontrollers/scale" ,
359
- "replicasets" , "replicasets/scale" , "deployments" , "deployments/scale" , "deployments/rollback" ).RuleOrDie (),
360
- rbac .NewRule (read ... ).Groups (appsGroup , extensionsGroup ).Resources ("daemonsets" ).RuleOrDie (),
361
-
362
- rbac .NewRule (readWrite ... ).Groups (appsGroup ).Resources ("statefulsets" , "deployments" , "deployments/scale" , "deployments/status" ).RuleOrDie (),
363
-
364
322
rbac .NewRule (readWrite ... ).Groups (buildGroup , legacyBuildGroup ).Resources ("builds" , "buildconfigs" , "buildconfigs/webhooks" ).RuleOrDie (),
365
323
rbac .NewRule (read ... ).Groups (buildGroup , legacyBuildGroup ).Resources ("builds/log" ).RuleOrDie (),
366
324
rbac .NewRule ("create" ).Groups (buildGroup , legacyBuildGroup ).Resources ("buildconfigs/instantiate" , "buildconfigs/instantiatebinary" , "builds/clone" ).RuleOrDie (),
@@ -389,36 +347,18 @@ func GetOpenshiftBootstrapClusterRoles() []rbac.ClusterRole {
389
347
390
348
rbac .NewRule (readWrite ... ).Groups (templateGroup , legacyTemplateGroup ).Resources ("templates" , "templateconfigs" , "processedtemplates" , "templateinstances" ).RuleOrDie (),
391
349
392
- rbac .NewRule (readWrite ... ).Groups (extensionsGroup , networkingGroup ).Resources ("networkpolicies" ).RuleOrDie (),
350
+ rbac .NewRule (readWrite ... ).Groups (networkingGroup ).Resources ("networkpolicies" ).RuleOrDie (),
393
351
394
352
// backwards compatibility
395
353
rbac .NewRule (readWrite ... ).Groups (buildGroup , legacyBuildGroup ).Resources ("buildlogs" ).RuleOrDie (),
396
354
rbac .NewRule (read ... ).Groups (kapiGroup ).Resources ("resourcequotausages" ).RuleOrDie (),
397
355
},
398
356
},
399
357
{
400
- ObjectMeta : metav1.ObjectMeta {
401
- Name : ViewRoleName ,
402
- Annotations : map [string ]string {
403
- oapi .OpenShiftDescription : "A user who can view but not edit any resources within the project. They can not view secrets or membership." ,
404
- },
405
- },
358
+ // a role for namespace level viewing. It grants Read-only access to non-escalating resources in
359
+ // a namespace.
360
+ ObjectMeta : metav1.ObjectMeta {Name : "system:openshift:aggregate-to-view" , Labels : map [string ]string {"rbac.authorization.k8s.io/aggregate-to-view" : "true" }},
406
361
Rules : []rbac.PolicyRule {
407
- // TODO add "replicationcontrollers/scale" here
408
- rbac .NewRule (read ... ).Groups (kapiGroup ).Resources ("pods" , "replicationcontrollers" , "serviceaccounts" ,
409
- "services" , "endpoints" , "persistentvolumeclaims" , "configmaps" ).RuleOrDie (),
410
- rbac .NewRule (read ... ).Groups (kapiGroup ).Resources ("limitranges" , "resourcequotas" , "bindings" , "events" ,
411
- "namespaces" , "pods/status" , "resourcequotas/status" , "namespaces/status" , "replicationcontrollers/status" , "pods/log" ).RuleOrDie (),
412
-
413
- rbac .NewRule (read ... ).Groups (autoscalingGroup ).Resources ("horizontalpodautoscalers" ).RuleOrDie (),
414
-
415
- rbac .NewRule (read ... ).Groups (batchGroup ).Resources ("jobs" , "cronjobs" ).RuleOrDie (),
416
-
417
- rbac .NewRule (read ... ).Groups (appsGroup , extensionsGroup ).Resources ("deployments" , "deployments/scale" , "replicasets" , "replicasets/scale" ).RuleOrDie (),
418
- rbac .NewRule (read ... ).Groups (appsGroup , extensionsGroup ).Resources ("daemonsets" ).RuleOrDie (),
419
-
420
- rbac .NewRule (read ... ).Groups (appsGroup ).Resources ("statefulsets" , "deployments" , "deployments/scale" ).RuleOrDie (),
421
-
422
362
rbac .NewRule (read ... ).Groups (buildGroup , legacyBuildGroup ).Resources ("builds" , "buildconfigs" , "buildconfigs/webhooks" ).RuleOrDie (),
423
363
rbac .NewRule (read ... ).Groups (buildGroup , legacyBuildGroup ).Resources ("builds/log" ).RuleOrDie (),
424
364
// access to jenkins
@@ -896,6 +836,25 @@ func GetBootstrapClusterRoles() []rbac.ClusterRole {
896
836
}
897
837
role .Annotations [roleSystemOnly ] = roleIsSystemOnly
898
838
}
839
+
840
+ // add a couple selected descriptions
841
+ switch role .Name {
842
+ case "admin" :
843
+ if role .Annotations == nil {
844
+ role .Annotations = map [string ]string {}
845
+ }
846
+ role .Annotations [oapi .OpenShiftDescription ] = "A user that has edit rights within the project and can change the project's membership."
847
+ case "edit" :
848
+ if role .Annotations == nil {
849
+ role .Annotations = map [string ]string {}
850
+ }
851
+ role .Annotations [oapi .OpenShiftDescription ] = "A user that can create and edit most objects in a project, but can not update the project's membership."
852
+ case "view" :
853
+ if role .Annotations == nil {
854
+ role .Annotations = map [string ]string {}
855
+ }
856
+ role .Annotations [oapi .OpenShiftDescription ] = "A user who can view but not edit any resources within the project. They can not view secrets or membership."
857
+ }
899
858
}
900
859
901
860
return finalClusterRoles
@@ -1045,11 +1004,6 @@ func GetBootstrapClusterRoleBindings() []rbac.ClusterRoleBinding {
1045
1004
// clusterRoleConflicts lists the roles which are known to conflict with upstream and which we have manually
1046
1005
// deconflicted with our own.
1047
1006
var clusterRoleConflicts = sets .NewString (
1048
- // these require special treatment to handle origin resources
1049
- "admin" ,
1050
- "edit" ,
1051
- "view" ,
1052
-
1053
1007
// TODO this should probably be re-swizzled to be the delta on top of the kube role
1054
1008
"system:discovery" ,
1055
1009
0 commit comments