-
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
Open
dockerymick
wants to merge
4
commits into
2.15_stage
Choose a base branch
from
mj-ACM-24933-2
base: 2.15_stage
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+257
−194
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| [#create-cluster-permission] | ||
| = Creating a cluster permission | ||
|
|
||
| When the service account is created there are no associated permissions. 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 | ||
|
|
||
| - If you want to bind to the `ManagedServiceAccount` resource, you must have the `ManagedServiceAccount` add-on. For more information about enabling the `ManagedServiceAccount` add-on, see link:../add-ons/configure_klusterlet_addons.adoc[Configuring klusterlet add-ons]. | ||
|
|
||
| .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: | ||
|
|
||
| + | ||
| [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 your YAML file. | ||
|
|
||
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. | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fxiang1