diff --git a/helm/template/Chart.yaml b/helm/template/Chart.yaml index 968433c..d27a955 100644 --- a/helm/template/Chart.yaml +++ b/helm/template/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: template description: A Helm library chart containing common templates, keeping application templates short type: library -version: 0.2.4 +version: 0.3.0 maintainers: - name: Jim Martens url: https://2martens.de @@ -11,7 +11,7 @@ sources: annotations: artifacthub.io/changes: | - kind: added - description: Added "template.annotations" + description: Added role to allow watching on artifacthub.io/signKey: | fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8 url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc diff --git a/helm/template/_templates/role.yaml b/helm/template/_templates/role.yaml new file mode 100644 index 0000000..2b1e70b --- /dev/null +++ b/helm/template/_templates/role.yaml @@ -0,0 +1,3 @@ +{{- include "template.leaderRole" . -}} +--- +{{- include "template.leaderRoleBinding" . -}} \ No newline at end of file diff --git a/helm/template/_values.yaml b/helm/template/_values.yaml index 59e75e0..2642768 100644 --- a/helm/template/_values.yaml +++ b/helm/template/_values.yaml @@ -136,6 +136,9 @@ autoscaling: targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 +leaderElection: + enabled: false + vault: # If enabled, no ordinary secret resource will be created, even if secrets value is populated. enabled: false diff --git a/helm/template/templates/rbac/_leader-role.yaml b/helm/template/templates/rbac/_leader-role.yaml new file mode 100644 index 0000000..863f1d4 --- /dev/null +++ b/helm/template/templates/rbac/_leader-role.yaml @@ -0,0 +1,33 @@ +{{- define "template.leaderRole" -}} +{{- if .Values.leaderElection.enabled -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: leader-role + namespace: {{ .Release.Namespace }} +rules: + - verbs: + - watch + resources: + - configmaps + apiGroups: + - "" +{{- end }} +{{- end }} +--- +{{- define "template.leaderRoleBinding" -}} +{{- if .Values.leaderElection.enabled -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: leader-role-binding + namespace: {{ .Release.Namespace }} +roleRef: + name: {{ include "template.fullname" . }} + apiGroup: rbac.authorization.k8s.io + kind: Role +subjects: + - kind: ServiceAccount + name: {{ include "template.serviceAccountName" . }} +{{- end }} +{{- end }} \ No newline at end of file