[templates] Add RBAC ClusterRoles for module CRDs (astef-prototype)#658
Open
duckhawk wants to merge 1 commit into
Open
[templates] Add RBAC ClusterRoles for module CRDs (astef-prototype)#658duckhawk wants to merge 1 commit into
duckhawk wants to merge 1 commit into
Conversation
Mirror the user-authz / admin.conf / rbacv2 layout used in the main
branch RBAC PR, but for the new CRDs introduced in astef-prototype:
DRBD-related and ReplicatedVolume* resources.
- templates/user-authz-cluster-roles.yaml: User read, ClusterEditor CRUD
on all module CRDs.
- templates/rbac-for-us.yaml: ClusterRole d8:sds-replicated-volume:
admin-kubeconfig + ClusterRoleBinding to Group/kubeadm:cluster-admins.
- templates/rbacv2/manage/{view,edit}.yaml: aggregated to the storage
subsystem.
Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add RBAC
ClusterRoles for the module CRDs in two complementary layers.1. Current model —
templates/user-authz-cluster-roles.yamlClusterRoleannotated withuser-authz.deckhouse.io/access-level.user-authzcreates bindings for subjects of everyClusterAuthorizationRule/AuthorizationRulewith the matching level.User— read-only (get/list/watch).ClusterEditor— full CRUD (create/update/patch/delete/deletecollection).2. admin.conf —
templates/rbac-for-us.yamlClusterRole d8:sds-replicated-volume:admin-kubeconfig— full CRUD on the module CRDs.ClusterRoleBinding d8:sds-replicated-volume:admin-kubeconfig— toGroup/kubeadm:cluster-admins.Subjects authenticated through the cluster
admin.confget the same access asClusterEditoron module resources without going throughuser-authz.3. rbacv2 —
templates/rbacv2/ClusterRoles aggregated via labels into Deckhouse rbacv2 roles.manage (cluster-scoped CRDs) —
templates/rbacv2/manage/:view.yaml→d8:manage:permission:module:sds-replicated-volume:viewwithrbac.deckhouse.io/aggregate-to-storage-as: viewer, read verbs.edit.yaml→d8:manage:permission:module:sds-replicated-volume:editwithrbac.deckhouse.io/aggregate-to-storage-as: manager, write verbs.Covered resources
Cluster-scoped (via manage permissions):
drbdmappersdrbdnodeoperationsdrbdresourceoperationsdrbdresourcesreplicatedstorageclassesreplicatedstoragepoolsreplicatedvolumeattachmentsreplicatedvolumereplicasreplicatedvolumesWhy do we need it, and what problem does it solve?
Exposes module CRDs to both Deckhouse RBAC layers so that the standard roles actually grant access to module resources:
ClusterAuthorizationRule/AuthorizationRuleat the matching level (e.g.User,ClusterEditor) get the expected access automatically.kubeadm:cluster-adminsgroup (used by the clusteradmin.conf) is bound directly to the module's full-CRUDClusterRole, bypassinguser-authz.d8:manage:storage:*(cluster-scoped) pull the module permissions in via the aggregation labels.What is the expected result?
After applying, the following
ClusterRoles are created:d8:user-authz:sds-replicated-volume:user(read)d8:user-authz:sds-replicated-volume:cluster-editor(CRUD)ClusterRole d8:sds-replicated-volume:admin-kubeconfig(CRUD)ClusterRoleBinding d8:sds-replicated-volume:admin-kubeconfig→Group/kubeadm:cluster-adminsd8:manage:permission:module:sds-replicated-volume:viewd8:manage:permission:module:sds-replicated-volume:editChecklist