mirror of
https://github.com/2martens/cloud-configuration.git
synced 2026-10-17 16:46:51 +02:00
feat(template): Add support for leader election
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{{- include "template.leaderRole" . -}}
|
||||
---
|
||||
{{- include "template.leaderRoleBinding" . -}}
|
||||
@@ -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
|
||||
|
||||
@@ -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 }}
|
||||
Reference in New Issue
Block a user