-
Notifications
You must be signed in to change notification settings - Fork 117
https://issues.redhat.com/browse/ACM-24933 part 2 #8413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
57cca04
6bce1d2
dfee0f2
77e18cf
d5960b7
8dd49f8
473d834
dbf3157
8fd3ec4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| [#create-cluster-permission] | ||
| = Creating a cluster permission | ||
|
|
||
| When the service account is created, it does not have any permission associated to it. To grant permissions to the new service account, use the `ClusterPermission` resource. Create the `ClusterPermission` resource in the managed cluster namespace on the hub cluster. Use the `ClusterPermission` resource to create roles, cluster roles resources on the managed clusters, and bind them to a service account through a `RoleBinding` or `ClusterRoleBinding` resource. | ||
|
||
|
|
||
| *Required access:* Cluster administrator | ||
|
|
||
| .Prerequisites | ||
|
|
||
| - are there any prereqs for this? | ||
fxiang1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
fxiang1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .Procedure | ||
|
|
||
| Complete the following steps to create a `ClusterPermission` resource that grants permissions to a managed service account: | ||
|
|
||
| . To grant the `<managed-sa-sample>` service account permission to the sample mortgage application that is deployed to the `mortgage` namespace on `<managed-cluster>`, create a YAML file with the following content: | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to introduce this YAML better. I would rather not have most of the file a YAML file with no explanation. We need to introduce the kind, then we should have separate steps about the roles, role bindings, etc... It's not good practice to give a large about of YAML in one step and say Create this YAML.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See here that the bindings were created in a step in 2.14 and pieces of the YAML were defined in a step or the intro: https://github.com/stolostron/rhacm-docs/blob/2.14_stage/secure_clusters/fine_grain_rbac_cli.adoc We got away from that for some reason here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is old content. I just didn't focus on updating all of the content because we were up against time.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right I agree with @dockerymick , I thought we were just moving this from the ALC Gitops section. This is not something new we've introduced recently.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have gotten away from pushing large YAML samples without directions for them, but now I understand that this is previous content. I suggest we introduce the pieces that make the cluster permission, without reorganizing. Going forward the team agrees that this is not best practice and that important pieces of YAML need to be implemented as part of a larger process for understanding. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep understood, going through our docs I see we have many large YAML samples without explanation. Maybe we need to create a separate story/task for each of the component teams to just check and add explanation steps for these?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fxiang1 yup that's a great idea. I will improve the examples in this PR and then focus on other areas in the tech debt/refresh doc issue
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, these changes are more than I even expected here for this PR. I thought we could just add some intro info and be good but you took it even further to improve it. Great job.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fxiang1 I think for the newer info that is being used a lot, yes, we can improve that YAML presentation. We have as a team mostly been doing that in new content. I don't think we will have time to fix everything, but certainly highly used doc we can improve. |
||
| + | ||
| [source,yaml] | ||
| ---- | ||
| apiVersion: rbac.open-cluster-management.io/v1alpha1 | ||
| kind: ClusterPermission | ||
| metadata: | ||
| name: <clusterpermission-msa-subject-sample> | ||
| namespace: <managed-cluster> | ||
| spec: | ||
| roles: | ||
| - namespace: default | ||
| rules: | ||
| - apiGroups: ["apps"] | ||
| resources: ["deployments"] | ||
| verbs: ["get", "list", "create", "update", "delete", "patch"] | ||
| - apiGroups: [""] | ||
| resources: ["configmaps", "secrets", "pods", "podtemplates", "persistentvolumeclaims", "persistentvolumes"] | ||
| verbs: ["get", "update", "list", "create", "delete", "patch"] | ||
| - apiGroups: ["storage.k8s.io"] | ||
| resources: ["*"] | ||
| verbs: ["list"] | ||
| - namespace: mortgage | ||
| rules: | ||
| - apiGroups: ["apps"] | ||
| resources: ["deployments"] | ||
| verbs: ["get", "list", "create", "update", "delete", "patch"] | ||
| - apiGroups: [""] | ||
| resources: ["configmaps", "secrets", "pods", "services", "namespace"] | ||
| verbs: ["get", "update", "list", "create", "delete", "patch"] | ||
| clusterRole: | ||
| rules: | ||
| - apiGroups: ["*"] | ||
| resources: ["*"] | ||
| verbs: ["get", "list"] | ||
| roleBindings: | ||
| - namespace: default | ||
| roleRef: | ||
| kind: Role | ||
| subject: | ||
| apiGroup: authentication.open-cluster-management.io | ||
| kind: ManagedServiceAccount | ||
| name: <managed-sa-sample> | ||
| - namespace: mortgage | ||
| roleRef: | ||
| kind: Role | ||
| subject: | ||
| apiGroup: authentication.open-cluster-management.io | ||
| kind: ManagedServiceAccount | ||
| name: <managed-sa-sample> | ||
| clusterRoleBinding: | ||
| subject: | ||
| apiGroup: authentication.open-cluster-management.io | ||
| kind: ManagedServiceAccount | ||
| name: <managed-sa-sample> | ||
| ---- | ||
|
|
||
| . Save the YAML file and name the file, `cluster-permission.yaml`. | ||
| //should the name match the name in the previous example? | ||
fxiang1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
fxiang1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| . Apply your YAML file by running the following command: | ||
|
|
||
| + | ||
| [source,bash] | ||
| ---- | ||
| oc apply -f cluster-permission.yaml | ||
| ---- | ||
|
|
||
| . The sample `<clusterpermission>` creates a role called `<clusterpermission-msa-subject-sample>` in the `mortgage` namespace. If one does not already exist, create a namespace `mortgage`. | ||
| . Review the resources that are created on the `<managed-cluster>` namespace. | ||
|
|
||
| After you create the sample, `<clusterpermission>`, the following resources are created in the sample managed cluster: | ||
|
|
||
| * One `Role` called `<clusterpermission-msa-subject-sample>` in the default namespace. | ||
| * One `RoleBinding` called `<clusterpermission-msa-subject-sample>` in the default namespace for binding the role to the managed service account. | ||
| * One `Role` called `<clusterpermission-msa-subject-sample>` in the mortgage namespace. | ||
| * One `RoleBinding` called `<clusterpermission-msa-subject-sample>` in the mortgage namespace for binding the role to the managed service account. | ||
| * One `ClusterRole` called `<clusterpermission-msa-subject-sample>`. | ||
| * One `ClusterRoleBinding` called `<clusterpermission-msa-subject-sample>` for binding the `ClusterRole` to the managed service account. | ||
Uh oh!
There was an error while loading. Please reload this page.