Skip to content

Commit

Permalink
build(leader-election): configure Helm and manifests
Browse files Browse the repository at this point in the history
Signed-off-by: Clément Nussbaumer <[email protected]>
  • Loading branch information
clementnuss committed May 31, 2023
1 parent 9a047cb commit 0a20837
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions charts/kubelet-csr-approver/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ kind: ClusterRole
metadata:
name: {{ include "kubelet-csr-approver.fullname" . }}
rules:
{{- if .Values.leaderElection }}
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- update
{{- end }}
- apiGroups:
- certificates.k8s.io
resources:
Expand Down
7 changes: 7 additions & 0 deletions charts/kubelet-csr-approver/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metadata:
labels:
{{- include "kubelet-csr-approver.labels" . | nindent 4 }}
spec:
{{- if and (gt .Values.replicas 1.0) (not .Values.leaderElection) }}
{{- fail "leaderElection needs to be enabled in order to use more than 1 replica" }}
{{- end }}
replicas: {{ .Values.replicas }}
selector:
matchLabels:
{{- include "kubelet-csr-approver.selectorLabels" . | nindent 6 }}
Expand Down Expand Up @@ -43,6 +47,9 @@ spec:
- ":{{ .Values.metrics.port }}"
- -health-probe-bind-address
- ":8081"
{{- if .Values.leaderElection }}
- -leader-election
{{- end }}
{{- if .Values.loggingLevel }}
- -level
- {{ .Values.loggingLevel | quote }}
Expand Down
3 changes: 3 additions & 0 deletions charts/kubelet-csr-approver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ providerIpPrefixes: []
# logging level ranges from -5 (Fatal) to 10 (Verbose). default level is 0
loggingLevel: 0

leaderElection: true
replicas: 2

namespace: ""

image:
Expand Down
8 changes: 8 additions & 0 deletions deploy/k8s/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ rules:
- get
- list
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- get
- update
- apiGroups:
- certificates.k8s.io
resources:
Expand Down
4 changes: 3 additions & 1 deletion deploy/k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: kubelet-csr-approver
namespace: kube-system
spec:
replicas: 2
selector:
matchLabels:
app: kubelet-csr-approver
Expand All @@ -20,7 +21,7 @@ spec:
serviceAccountName: kubelet-csr-approver
containers:
- name: kubelet-csr-approver
image: postfinance/kubelet-csr-approver:v0.2.2
image: postfinance/kubelet-csr-approver:v1.0.1
resources:
limits:
memory: "128Mi"
Expand All @@ -31,6 +32,7 @@ spec:
- ":8080"
- -health-probe-bind-address
- ":8081"
- -leader-election

livenessProbe:
httpGet:
Expand Down

0 comments on commit 0a20837

Please sign in to comment.