Skip to content

Commit

Permalink
feat(helm): populate config in a configmap and use-it
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevesy committed Sep 16, 2022
1 parent baef3ee commit 140a419
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
9 changes: 8 additions & 1 deletion helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,19 @@ Create the name of the service account to use
{{- end }}

{{/*
Create the name of the service account to use
Create the name of the cert secret to use
*/}}
{{- define "helm.certSecretName" -}}
{{ include "helm.fullname" . }}-cert
{{- end }}

{{/*
Create the name of the config configmap to use
*/}}
{{- define "helm.configConfigMapName" -}}
{{ include "helm.fullname" . }}-config
{{- end }}

{{/*
Returns the name of the image according to values.
Allow to override standard repository / tag by a full ref
Expand Down
9 changes: 9 additions & 0 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helm.configConfigMapName" . }}
data:
{{- with .Values.config }}
config.yaml: |-
{{- toYaml . | nindent 4 }}
{{- end }}
18 changes: 8 additions & 10 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@ spec:
image: {{ include "helm.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-webhook_cert"
- "/var/run/certs/tls.crt"
- "-webhook_key"
- "/var/run/certs/tls.key"
- "-webhook_addr"
- ":8443"
- "-resync_interval"
- {{ .Values.controller.resyncInterval | quote }}
- "-retry_interval"
- {{ .Values.controller.retryInterval | quote }}
- "-config"
- "/var/run/config/config.yaml"
ports:
- name: https
containerPort: 8443
Expand Down Expand Up @@ -73,6 +65,9 @@ spec:
- name: certs
mountPath: /var/run/certs
readOnly: true
- name: config
mountPath: /var/run/config
readOnly: true
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand All @@ -91,3 +86,6 @@ spec:
- name: certs
secret:
secretName: {{ template "helm.certSecretName" . }}
- name: config
configMap:
name: {{ template "helm.configConfigMapName" . }}
18 changes: 15 additions & 3 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
replicaCount: 1

controller:
resyncInterval: 30s
retryInterval: 10s
config:
controller:
resyncInterval: 30s
retryInterval: 10s
informerResyncInterval: 1h
threadiness: 10
auditSinks:
- kind: K8sEvents
namespace: ""
webhook:
certPath: "/var/run/certs/tls.crt"
keyPath: "/var/run/certs/tls.key"
addr: ":8443"
readTimeout: 20s
writeTimeout: 20s

image:
repository: ghcr.io/jlevesy/kudo/controller
Expand Down

0 comments on commit 140a419

Please sign in to comment.