Skip to content

Commit 4357756

Browse files
committed
Generate RBAC role directly into Chart template, adapt hardcoded path.
helmify before did convert the controller-gen generated rbac role to helm, but now we can just use it directly in the charts. Seperated out the rbac role. Should work as before.
1 parent 098d444 commit 4357756

5 files changed

Lines changed: 18 additions & 104 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ check: FORCE static-check build/cover.html build-all
113113

114114
generate: install-controller-gen
115115
@printf "\e[1;36m>> controller-gen\e[0m\n"
116-
@controller-gen crd:allowDangerousTypes=true rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=charts/openstack-hypervisor-operator/crds output:rbac:artifacts:config=config/rbac
116+
@controller-gen crd:allowDangerousTypes=true rbac:roleName=hypervisor-operator-manager-role webhook paths="./..." output:crd:artifacts:config=charts/openstack-hypervisor-operator/crds output:rbac:artifacts:config=charts/openstack-hypervisor-operator/templates
117117
@controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
118118
@controller-gen applyconfiguration paths="./..."
119119

Makefile.maker.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ controllerGen:
99
enabled: true
1010
crdOutputPath: charts/openstack-hypervisor-operator/crds
1111
objectHeaderFile: hack/boilerplate.go.txt
12-
rbacRoleName: manager-role
12+
rbacRoleName: hypervisor-operator-manager-role
13+
rbacOutputPath: charts/openstack-hypervisor-operator/templates
1314
allowDangerousTypes: true
1415

1516
coverageTest:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: {{ include "openstack-hypervisor-operator.fullname" . }}-manager-rolebinding
5+
labels:
6+
{{- include "openstack-hypervisor-operator.labels" . | nindent 4 }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: hypervisor-operator-manager-role
11+
subjects:
12+
- kind: ServiceAccount
13+
name: '{{ include "openstack-hypervisor-operator.serviceAccountName" . }}'
14+
namespace: '{{ .Release.Namespace }}'

charts/openstack-hypervisor-operator/templates/manager-rbac.yaml

Lines changed: 0 additions & 101 deletions
This file was deleted.

config/rbac/role.yaml renamed to charts/openstack-hypervisor-operator/templates/role.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
5-
name: manager-role
5+
name: hypervisor-operator-manager-role
66
rules:
77
- apiGroups:
88
- ""

0 commit comments

Comments
 (0)