Skip to content
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

Add support for clusterrole in generic #56

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/generic-stateful/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: generic-stateful
description: A generic helm chart that handles a bunch of common stateful set deploy cases
type: application
version: 0.4.0
version: 0.5.0
10 changes: 10 additions & 0 deletions charts/generic-stateful/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if and .Values.serviceAccount.create (gt (len .Values.serviceAccount.clusterRoleRules) 0) -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "generic.fullname" . }}
{{- with .Values.serviceAccount.clusterRoleRules }}
rules:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/generic-stateful/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if and .Values.serviceAccount.create (gt (len .Values.serviceAccount.clusterRoleRules) 0) -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "generic.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "generic.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "generic.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
1 change: 1 addition & 0 deletions charts/generic-stateful/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ serviceAccount:
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
clusterRoleRules: []

# Specifies whether to recreate Pods on a redeploy if nothing else about the underlying Pods changed.
# This is useful for Statefulsets that deploy an unchanging image tag like :latest,
Expand Down
2 changes: 1 addition & 1 deletion charts/generic/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: generic
description: A generic helm chart that handles a bunch of common application deploy cases
type: application
version: 1.13.0
version: 1.14.0
10 changes: 10 additions & 0 deletions charts/generic/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if and .Values.serviceAccount.create (gt (len .Values.serviceAccount.clusterRoleRules) 0) -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "generic.fullname" . }}
{{- with .Values.serviceAccount.clusterRoleRules }}
rules:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/generic/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if and .Values.serviceAccount.create (gt (len .Values.serviceAccount.clusterRoleRules) 0) -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "generic.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "generic.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "generic.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
1 change: 1 addition & 0 deletions charts/generic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ serviceAccount:
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
clusterRoleRules: []

# Specifies whether to recreate Pods on a redeploy if nothing else about the underlying Pods changed.
# This is useful for Deployments that deploy an unchanging image tag like :latest,
Expand Down
Loading