From 140a4192dea1a8927522129d9a3cc96b464e812a Mon Sep 17 00:00:00 2001 From: Julien Levesy Date: Fri, 16 Sep 2022 19:09:18 +0200 Subject: [PATCH] feat(helm): populate config in a configmap and use-it --- helm/templates/_helpers.tpl | 9 ++++++++- helm/templates/configmap.yaml | 9 +++++++++ helm/templates/deployment.yaml | 18 ++++++++---------- helm/values.yaml | 18 +++++++++++++++--- 4 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 helm/templates/configmap.yaml diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index c7b980c..dccb696 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -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 diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml new file mode 100644 index 0000000..9424380 --- /dev/null +++ b/helm/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "helm.configConfigMapName" . }} +data: +{{- with .Values.config }} + config.yaml: |- + {{- toYaml . | nindent 4 }} +{{- end }} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index a3e25c9..e6312f7 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -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 @@ -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 }} @@ -91,3 +86,6 @@ spec: - name: certs secret: secretName: {{ template "helm.certSecretName" . }} + - name: config + configMap: + name: {{ template "helm.configConfigMapName" . }} diff --git a/helm/values.yaml b/helm/values.yaml index 3354b6b..a8b6ba3 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -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