Skip to content

Commit a6dc4cf

Browse files
committed
Create custom RBAC for osac
Signed-off-by: Manuel Lorenzo <mlorenzofr@redhat.com>
1 parent abca134 commit a6dc4cf

3 files changed

Lines changed: 57 additions & 7 deletions

File tree

playbooks/tasks/vmaas.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,23 @@
148148
delay: 5
149149
until: __r_create_aap_osac_sa is success
150150

151-
- name: "Create osac-sa ClusterRoleBinding in AAP namespace"
151+
- name: "Create osac ClusterRole"
152152
kubernetes.core.k8s:
153153
state: present
154-
definition: "{{ lookup('ansible.builtin.template', '../templates/aap-osac-clusterrolebinding.yaml.j2') | from_yaml }}"
155-
register: __r_create_aap_osac_clusterrolebinding
154+
definition: "{{ lookup('ansible.builtin.template', '../templates/aap-osac-clusterrole.yaml.j2') | from_yaml }}"
155+
register: __r_create_aap_osac_clusterrole
156156
retries: 10
157157
delay: 5
158-
until: __r_create_aap_osac_clusterrolebinding is success
158+
until: __r_create_aap_osac_clusterrole is success
159+
160+
- name: "Create osac-rolebinding RoleBinding in AAP namespace"
161+
kubernetes.core.k8s:
162+
state: present
163+
definition: "{{ lookup('ansible.builtin.template', '../templates/aap-osac-rolebinding.yaml.j2') | from_yaml }}"
164+
register: __r_create_aap_osac_rolebinding
165+
retries: 10
166+
delay: 5
167+
until: __r_create_aap_osac_rolebinding is success
159168

160169
- name: "Create AnsibleAutomationPlatform resource"
161170
kubernetes.core.k8s:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: osac
6+
rules:
7+
- apiGroups:
8+
- "osac.openshift.io"
9+
resources:
10+
- "tenants"
11+
verbs:
12+
- "get"
13+
- "list"
14+
- "watch"
15+
16+
- apiGroups:
17+
- "osac.openshift.io"
18+
resources:
19+
- "computeinstances"
20+
verbs:
21+
- "get"
22+
- "list"
23+
- "watch"
24+
- "create"
25+
- "update"
26+
- "patch"
27+
- "delete"
28+
29+
- apiGroups:
30+
- ""
31+
resources:
32+
- "secrets"
33+
verbs:
34+
- "get"
35+
- "list"
36+
- "watch"
37+
- "create"
38+
- "update"
39+
- "patch"
40+
- "delete"

playbooks/templates/aap-osac-clusterrolebinding.yaml.j2 renamed to playbooks/templates/aap-osac-rolebinding.yaml.j2

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
22
apiVersion: rbac.authorization.k8s.io/v1
3-
kind: ClusterRoleBinding
3+
kind: RoleBinding
44
metadata:
5-
name: osac-sa
5+
name: osac-rolebinding
6+
namespace: {{ aap_ns }}
67
roleRef:
78
apiGroup: rbac.authorization.k8s.io
89
kind: ClusterRole
9-
name: cluster-admin
10+
name: osac
1011
subjects:
1112
- kind: ServiceAccount
1213
name: osac-sa

0 commit comments

Comments
 (0)