Skip to content

Commit 3819b8d

Browse files
authored
https://issues.redhat.com/browse/ACM-23588 validate spec for cluster permissions (#8350)
* https://issues.redhat.com/browse/ACM-23588 * Fixing linter * Fixing linter second attempt * Update release_notes/acm_new.adoc * Update secure_clusters/cluster_val.adoc * Rename file and section for cluster permission validation * Apply suggestion from @dockerymick * Apply suggestion from @dockerymick
1 parent f1af9cd commit 3819b8d

File tree

4 files changed

+56
-1
lines changed

4 files changed

+56
-1
lines changed

governance/template_functions.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ spec:
161161
data:
162162
something: '{{ default "empty" (lookupClusterClaim "possibly.nonexistent") }}'
163163
----
164-
<1> When the `possibly.nonexistent` `ClusterClaim` is found, its value gets used in the ConfigMap. If the `ClusterClaim` does not exist, `empty` gets used instead through the `default` function that is provided by Sprig.
164+
<1> When the `possibly.nonexistent` `ClusterClaim` is found, its value gets used in the ConfigMap. If the `ClusterClaim` does not exist, `empty` gets used instead through the `default` function that is provided by Sprig.
165165

166166
[#lookup-func]
167167
=== _lookup_

release_notes/acm_new.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ For new features that are related to {mce-short}, see link:../clusters/release_n
6262

6363
For cluster management with {acm-short}, see the following new features and enhancements:
6464

65+
- You can now enable the `validate` specification to check the existence of your `Role` and `ClusterRole` resources. For more information, see link:../secure_clusters/cluster_permission_validate.adoc#enable-cluster-permission-validate[Enabling validation for cluster permissions].
66+
6567
- You can now enable role-based access control for cluster management to create multiple cluster role bindings for your `ClusterPermission` resources. For more details, see link:../secure_cluster/rbac_implement_rhacm.adoc[Implementing role-based access control].
6668
6769
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[#enable-cluster-permission-validate]
2+
= Enabling validation for cluster permissions
3+
4+
Enable the `validate` specification within your `ClusterPermission` resources to check the existence of your `Role` and `ClusterRole` resources.
5+
6+
*Required access:* Cluster administrator
7+
8+
Complete the following steps:
9+
10+
. Create a `ClusterPermission` resource where you set the `validate` specification to `true`.Define the `roleBindings` and `clusterRoleBinding` that you want to validate.
11+
+
12+
Your YAML file might resemble the following example where you configure the `ClusteerRole` to validate the `edit` `ClusterRole` for the `sa-sample-existing` `ServiceAccount`, and the `view` `ClusterRole` for `Group1`:
13+
14+
+
15+
[source,yaml]
16+
----
17+
apiVersion: rbac.open-cluster-management.io/v1alpha1
18+
kind: ClusterPermission
19+
metadata:
20+
name: clusterpermission-validate-sample
21+
spec:
22+
validate: true
23+
roleBindings:
24+
- name: default-existing
25+
namespace: default
26+
roleRef:
27+
apiGroup: rbac.authorization.k8s.io
28+
kind: ClusterRole
29+
name: edit
30+
subject:
31+
namespace: openshift-gitops
32+
kind: ServiceAccount
33+
name: sa-sample-existing
34+
clusterRoleBinding:
35+
name: crb-cluster1-argo-app-con-3-existing
36+
roleRef:
37+
apiGroup: rbac.authorization.k8s.io
38+
kind: ClusterRole
39+
name: view
40+
subject:
41+
apiGroup: rbac.authorization.k8s.io
42+
kind: Group
43+
name: group1
44+
----
45+
46+
. Apply your `clusterpermission-validate-sample` `ClusterPermission` by running the following command:
47+
48+
+
49+
[source,bash]
50+
----
51+
oc apply clusterpermission-validate-sample.yaml
52+
----

secure_clusters/main.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ include::fine_grain_rbac_cli.adoc[leveloffset=+2]
1010
include::certificates.adoc[leveloffset=+2]
1111
include::cert_manage.adoc[leveloffset=+2]
1212
include::cert_byo.adoc[leveloffset=+2]
13+
include::cluster_permission_validate.adoc[leveloffset=+2]
1314

0 commit comments

Comments
 (0)