Skip to content

Commit

Permalink
Create clusterroles/bindings when service account is not managed
Browse files Browse the repository at this point in the history
rbac.enabled only should toggle these objects' creation
so they can be used with a pre-existing service account.

Signed-off-by: Jonathan Amiez <jonathan.amiez@gmail.com>
  • Loading branch information
josqu4red committed Oct 18, 2023
1 parent 9036018 commit 336b78d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/policy-reporter/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.serviceAccount.create -}}
{{- if .Values.rbac.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down
4 changes: 2 additions & 2 deletions charts/policy-reporter/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (and .Values.serviceAccount.create .Values.rbac.enabled) (or .Values.leaderElection.enabled (gt (int .Values.replicaCount) 1)) -}}
{{- if and .Values.rbac.enabled (or .Values.leaderElection.enabled (gt (int .Values.replicaCount) 1)) -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
Expand All @@ -21,4 +21,4 @@ rules:
- get
- patch
- update
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/policy-reporter/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (and .Values.serviceAccount.create .Values.rbac.enabled) (or .Values.leaderElection.enabled (gt (int .Values.replicaCount) 1)) -}}
{{- if and .Values.rbac.enabled (or .Values.leaderElection.enabled (gt (int .Values.replicaCount) 1)) -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
Expand Down
4 changes: 2 additions & 2 deletions charts/policy-reporter/templates/secret-role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.serviceAccount.create .Values.rbac.enabled -}}
{{- if .Values.rbac.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
Expand All @@ -16,4 +16,4 @@ rules:
- secrets
verbs:
- get
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/policy-reporter/templates/secret-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.serviceAccount.create .Values.rbac.enabled -}}
{{- if .Values.rbac.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
Expand Down

0 comments on commit 336b78d

Please sign in to comment.