From c7d6b3f979874c2dbd683b9079d5633f4287139d Mon Sep 17 00:00:00 2001 From: dnskr Date: Sat, 4 Mar 2023 16:44:54 +0100 Subject: [PATCH] Reformat chart templates --- chart/templates/cleanup/cleanup-cronjob.yaml | 38 ++++----- .../cleanup/cleanup-serviceaccount.yaml | 7 +- chart/templates/configmaps/configmap.yaml | 58 +++++++------- .../configmaps/extra-configmaps.yaml | 14 ++-- .../configmaps/statsd-configmap.yaml | 22 +++--- .../configmaps/webserver-configmap.yaml | 8 +- .../dag-processor-deployment.yaml | 79 ++++++++----------- .../dag-processor-serviceaccount.yaml | 5 +- .../templates/redis/redis-networkpolicy.yaml | 6 +- chart/templates/redis/redis-service.yaml | 6 +- .../templates/redis/redis-serviceaccount.yaml | 5 +- chart/templates/redis/redis-statefulset.yaml | 50 ++++++------ chart/templates/statsd/statsd-deployment.yaml | 33 ++++---- .../statsd/statsd-networkpolicy.yaml | 12 +-- chart/templates/statsd/statsd-service.yaml | 12 +-- .../statsd/statsd-serviceaccount.yaml | 5 +- tests/charts/test_configmap.py | 4 +- 17 files changed, 167 insertions(+), 197 deletions(-) diff --git a/chart/templates/cleanup/cleanup-cronjob.yaml b/chart/templates/cleanup/cleanup-cronjob.yaml index fa93a73075e0ca..2a7dd3d6081814 100644 --- a/chart/templates/cleanup/cleanup-cronjob.yaml +++ b/chart/templates/cleanup/cleanup-cronjob.yaml @@ -38,9 +38,9 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: {{ .Release.Name }} heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: schedule: "{{ .Values.cleanup.schedule }}" # The cron job does not allow concurrent runs; if it is time for a new job run and the previous job run hasn't finished yet, the cron job skips the new job run @@ -60,27 +60,23 @@ spec: tier: airflow component: airflow-cleanup-pods release: {{ .Release.Name }} - {{- if or (.Values.labels) (.Values.cleanup.labels) }} - {{- mustMerge .Values.cleanup.labels .Values.labels | toYaml | nindent 12 }} - {{- end }} + {{- if or (.Values.labels) (.Values.cleanup.labels) }} + {{- mustMerge .Values.cleanup.labels .Values.labels | toYaml | nindent 12 }} + {{- end }} annotations: sidecar.istio.io/inject: "false" {{- if .Values.airflowPodAnnotations }} - {{- toYaml .Values.airflowPodAnnotations | nindent 12 }} + {{- toYaml .Values.airflowPodAnnotations | nindent 12 }} {{- end }} {{- if .Values.cleanup.podAnnotations }} - {{- toYaml .Values.cleanup.podAnnotations | nindent 12 }} + {{- toYaml .Values.cleanup.podAnnotations | nindent 12 }} {{- end }} spec: restartPolicy: Never - nodeSelector: -{{ toYaml $nodeSelector | indent 12 }} - affinity: -{{ toYaml $affinity | indent 12 }} - tolerations: -{{ toYaml $tolerations | indent 12 }} - topologySpreadConstraints: -{{ toYaml $topologySpreadConstraints | indent 12 }} + nodeSelector: {{- toYaml $nodeSelector | nindent 12 }} + affinity: {{- toYaml $affinity | nindent 12 }} + tolerations: {{- toYaml $tolerations | nindent 12 }} + topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 12 }} serviceAccountName: {{ include "cleanup.serviceAccountName" . }} {{- if or .Values.registry.secretName .Values.registry.connection }} imagePullSecrets: @@ -98,12 +94,10 @@ spec: args: {{ tpl (toYaml .Values.cleanup.args) . | nindent 16 }} {{- end }} env: - {{- include "standard_airflow_environment" . | indent 12 }} - {{- include "container_extra_envs" (list . .Values.cleanup.env) | indent 12 }} - volumeMounts: -{{- include "airflow_config_mount" . | nindent 16 }} - resources: -{{ toYaml .Values.cleanup.resources | indent 16 }} + {{- include "standard_airflow_environment" . | indent 12 }} + {{- include "container_extra_envs" (list . .Values.cleanup.env) | indent 12 }} + volumeMounts: {{- include "airflow_config_mount" . | nindent 16 }} + resources: {{- toYaml .Values.cleanup.resources | nindent 16 }} volumes: - name: config configMap: diff --git a/chart/templates/cleanup/cleanup-serviceaccount.yaml b/chart/templates/cleanup/cleanup-serviceaccount.yaml index faaa809ba7bd10..5f004fb137a6a0 100644 --- a/chart/templates/cleanup/cleanup-serviceaccount.yaml +++ b/chart/templates/cleanup/cleanup-serviceaccount.yaml @@ -28,11 +28,10 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} - {{- if or (.Values.labels) (.Values.cleanup.labels) }} + {{- if or (.Values.labels) (.Values.cleanup.labels) }} {{- mustMerge .Values.cleanup.labels .Values.labels | toYaml | nindent 4 }} - {{- end }} + {{- end }} {{- with .Values.cleanup.serviceAccount.annotations }} - annotations: - {{ toYaml . | nindent 4 }} + annotations: {{- toYaml . | nindent 4 }} {{- end }} {{- end }} diff --git a/chart/templates/configmaps/configmap.yaml b/chart/templates/configmaps/configmap.yaml index c3a4ced89f555a..4911c525b42db9 100644 --- a/chart/templates/configmaps/configmap.yaml +++ b/chart/templates/configmaps/configmap.yaml @@ -28,13 +28,12 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end -}} -{{- if .Values.airflowConfigAnnotations }} - annotations: -{{- toYaml .Values.airflowConfigAnnotations | nindent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end -}} + {{- if .Values.airflowConfigAnnotations }} + annotations: {{- toYaml .Values.airflowConfigAnnotations | nindent 4 }} + {{- end }} {{- $Global := . }} data: # These are system-specified config overrides. @@ -46,25 +45,28 @@ data: {{- end }} {{ end }} -{{- if .Values.airflowLocalSettings }} - airflow_local_settings.py: | - {{ tpl .Values.airflowLocalSettings . | nindent 4 }} -{{- end }} -{{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.knownHosts }} - known_hosts: | - {{ .Values.dags.gitSync.knownHosts | nindent 4 }} -{{- end }} -{{- if or (eq $.Values.executor "LocalKubernetesExecutor") (eq $.Values.executor "KubernetesExecutor") (eq $.Values.executor "CeleryKubernetesExecutor") }} -{{- if semverCompare ">=1.10.12" .Values.airflowVersion }} + {{- if .Values.airflowLocalSettings }} + airflow_local_settings.py: |- + {{- tpl .Values.airflowLocalSettings . | nindent 4 }} + {{- end }} + + {{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.knownHosts }} + known_hosts: |- + {{- .Values.dags.gitSync.knownHosts | nindent 4 }} + {{- end }} + + {{- if or (eq $.Values.executor "LocalKubernetesExecutor") (eq $.Values.executor "KubernetesExecutor") (eq $.Values.executor "CeleryKubernetesExecutor") }} + {{- if semverCompare ">=1.10.12" .Values.airflowVersion }} pod_template_file.yaml: |- -{{- if .Values.podTemplate }} - {{ tpl .Values.podTemplate . | nindent 4 }} -{{- else }} -{{ tpl (.Files.Get "files/pod-template-file.kubernetes-helm-yaml") . | nindent 4 }} -{{- end }} -{{- end }} -{{- end }} -{{- if .Values.kerberos.enabled }} - krb5.conf: | - {{ tpl .Values.kerberos.config . | nindent 4 }} -{{- end }} + {{- if .Values.podTemplate }} + {{- tpl .Values.podTemplate . | nindent 4 }} + {{- else }} + {{- tpl (.Files.Get "files/pod-template-file.kubernetes-helm-yaml") . | nindent 4 }} + {{- end }} + {{- end }} + {{- end }} + + {{- if .Values.kerberos.enabled }} + krb5.conf: |- + {{- tpl .Values.kerberos.config . | nindent 4 }} + {{- end }} diff --git a/chart/templates/configmaps/extra-configmaps.yaml b/chart/templates/configmaps/extra-configmaps.yaml index 58805a827a81db..1ac0d6ab485e19 100644 --- a/chart/templates/configmaps/extra-configmaps.yaml +++ b/chart/templates/configmaps/extra-configmaps.yaml @@ -29,12 +29,12 @@ metadata: release: {{ $Global.Release.Name }} chart: "{{ $Global.Chart.Name }}-{{ $Global.Chart.Version }}" heritage: {{ $Global.Release.Service }} -{{- with $Global.Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} -{{- if $configMapContent.labels }} -{{ toYaml $configMapContent.labels | indent 4 }} -{{- end }} + {{- with $Global.Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if $configMapContent.labels }} + {{- toYaml $configMapContent.labels | nindent 4 }} + {{- end }} annotations: "helm.sh/hook": "pre-install,pre-upgrade" "helm.sh/hook-delete-policy": "before-hook-creation" @@ -42,7 +42,7 @@ metadata: {{- if $configMapContent.data }} data: {{- with $configMapContent.data }} - {{- tpl . $Global | nindent 2 }} + {{- tpl . $Global | nindent 2 }} {{- end }} {{- end }} {{- end }} diff --git a/chart/templates/configmaps/statsd-configmap.yaml b/chart/templates/configmaps/statsd-configmap.yaml index 2139d4ac06f2e6..a41bfcba455cb0 100644 --- a/chart/templates/configmaps/statsd-configmap.yaml +++ b/chart/templates/configmaps/statsd-configmap.yaml @@ -29,18 +29,18 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} data: mappings.yml: |- -{{- if .Values.statsd.overrideMappings }} + {{- if .Values.statsd.overrideMappings }} mappings: -{{ toYaml .Values.statsd.overrideMappings | indent 6 }} -{{- else }} -{{ .Files.Get "files/statsd-mappings.yml" | indent 4 }} -{{- if .Values.statsd.extraMappings }} -{{ toYaml .Values.statsd.extraMappings | indent 6 }} -{{- end }} -{{- end }} + {{- toYaml .Values.statsd.overrideMappings | nindent 6 }} + {{- else }} + {{- .Files.Get "files/statsd-mappings.yml" | nindent 4 }} + {{- if .Values.statsd.extraMappings }} + {{- toYaml .Values.statsd.extraMappings | nindent 6 }} + {{- end }} + {{- end }} {{- end }} diff --git a/chart/templates/configmaps/webserver-configmap.yaml b/chart/templates/configmaps/webserver-configmap.yaml index 26fb5094d969e6..757fb60f3ad4ba 100644 --- a/chart/templates/configmaps/webserver-configmap.yaml +++ b/chart/templates/configmaps/webserver-configmap.yaml @@ -29,10 +29,10 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} data: - webserver_config.py: | + webserver_config.py: |- {{- tpl .Values.webserver.webserverConfig . | nindent 4 }} {{- end }} diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml b/chart/templates/dag-processor/dag-processor-deployment.yaml index eaab6f58245368..44ffe8d85078f6 100644 --- a/chart/templates/dag-processor/dag-processor-deployment.yaml +++ b/chart/templates/dag-processor/dag-processor-deployment.yaml @@ -37,11 +37,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} {{- with .Values.labels }} - {{- toYaml . | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- if .Values.dagProcessor.annotations }} - annotations: - {{- toYaml .Values.dagProcessor.annotations | nindent 4 }} + annotations: {{- toYaml .Values.dagProcessor.annotations | nindent 4 }} {{- end }} spec: replicas: {{ .Values.dagProcessor.replicas }} @@ -54,8 +53,7 @@ spec: component: dag-processor release: {{ .Release.Name }} {{- if .Values.dagProcessor.strategy }} - strategy: - {{- toYaml .Values.dagProcessor.strategy | nindent 4 }} + strategy: {{- toYaml .Values.dagProcessor.strategy | nindent 4 }} {{- end }} template: metadata: @@ -64,7 +62,7 @@ spec: component: dag-processor release: {{ .Release.Name }} {{- with .Values.labels }} - {{- toYaml . | nindent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} annotations: checksum/metadata-secret: {{ include (print $.Template.BasePath "/secrets/metadata-connection-secret.yaml") . | sha256sum }} @@ -76,17 +74,16 @@ spec: cluster-autoscaler.kubernetes.io/safe-to-evict: "true" {{- end }} {{- if .Values.airflowPodAnnotations }} - {{- toYaml .Values.airflowPodAnnotations | nindent 8 }} + {{- toYaml .Values.airflowPodAnnotations | nindent 8 }} {{- end }} {{- if .Values.dagProcessor.podAnnotations }} - {{- toYaml .Values.dagProcessor.podAnnotations | nindent 8 }} + {{- toYaml .Values.dagProcessor.podAnnotations | nindent 8 }} {{- end }} spec: {{- if .Values.dagProcessor.priorityClassName }} priorityClassName: {{ .Values.dagProcessor.priorityClassName }} {{- end }} - nodeSelector: - {{- toYaml $nodeSelector | nindent 8 }} + nodeSelector: {{- toYaml $nodeSelector | nindent 8 }} affinity: {{- if $affinity }} {{- toYaml $affinity | nindent 8 }} @@ -100,10 +97,8 @@ spec: topologyKey: kubernetes.io/hostname weight: 100 {{- end }} - tolerations: - {{- toYaml $tolerations | nindent 8 }} - topologySpreadConstraints: - {{- toYaml $topologySpreadConstraints | nindent 8 }} + tolerations: {{- toYaml $tolerations | nindent 8 }} + topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 8 }} terminationGracePeriodSeconds: {{ .Values.dagProcessor.terminationGracePeriodSeconds }} restartPolicy: Always serviceAccountName: {{ include "dagProcessor.serviceAccountName" . }} @@ -115,28 +110,24 @@ spec: initContainers: {{- if .Values.dagProcessor.waitForMigrations.enabled }} - name: wait-for-airflow-migrations - resources: - {{- toYaml .Values.dagProcessor.resources | nindent 12 }} + resources: {{- toYaml .Values.dagProcessor.resources | nindent 12 }} image: {{ template "airflow_image_for_migrations" . }} imagePullPolicy: {{ .Values.images.airflow.pullPolicy }} - volumeMounts: -{{- include "airflow_config_mount" . | nindent 12 }} - args: - {{- include "wait-for-migrations-command" . | nindent 10 }} - envFrom: - {{- include "custom_airflow_environment_from" . | default "\n []" | nindent 10 }} + volumeMounts: {{- include "airflow_config_mount" . | nindent 12 }} + args: {{- include "wait-for-migrations-command" . | nindent 10 }} + envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | nindent 10 }} env: - {{- include "custom_airflow_environment" . | nindent 10 }} - {{- include "standard_airflow_environment" . | nindent 10 }} -{{- if .Values.dagProcessor.waitForMigrations.env }} -{{ tpl (toYaml .Values.dagProcessor.waitForMigrations.env) $ | indent 12 }} -{{- end }} + {{- include "custom_airflow_environment" . | nindent 10 }} + {{- include "standard_airflow_environment" . | nindent 10 }} + {{- if .Values.dagProcessor.waitForMigrations.env }} + {{- tpl (toYaml .Values.dagProcessor.waitForMigrations.env) $ | nindent 12 }} + {{- end }} {{- end }} {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} - {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }} + {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }} {{- end }} {{- if .Values.dagProcessor.extraInitContainers }} - {{- toYaml .Values.dagProcessor.extraInitContainers | nindent 8 }} + {{- toYaml .Values.dagProcessor.extraInitContainers | nindent 8 }} {{- end }} containers: - name: dag-processor @@ -148,27 +139,25 @@ spec: {{- if .Values.dagProcessor.args }} args: {{ tpl (toYaml .Values.dagProcessor.args) . | nindent 12 }} {{- end }} - resources: - {{ toYaml .Values.dagProcessor.resources | nindent 12 }} + resources: {{- toYaml .Values.dagProcessor.resources | nindent 12 }} volumeMounts: {{- if .Values.volumeMounts }} - {{- toYaml .Values.volumeMounts | nindent 12 }} + {{- toYaml .Values.volumeMounts | nindent 12 }} {{- end }} {{- if .Values.dagProcessor.extraVolumeMounts }} - {{ toYaml .Values.dagProcessor.extraVolumeMounts | nindent 12 }} + {{ toYaml .Values.dagProcessor.extraVolumeMounts | nindent 12 }} {{- end }} - name: logs mountPath: {{ template "airflow_logs" . }} -{{- include "airflow_config_mount" . | nindent 12 }} + {{- include "airflow_config_mount" . | nindent 12 }} {{- if or .Values.dags.persistence.enabled .Values.dags.gitSync.enabled }} - {{- include "airflow_dags_mount" . | nindent 12 }} + {{- include "airflow_dags_mount" . | nindent 12 }} {{- end }} - envFrom: - {{- include "custom_airflow_environment_from" . | default "\n []" | nindent 10 }} + envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | nindent 10 }} env: - {{- include "custom_airflow_environment" . | nindent 10 }} - {{- include "standard_airflow_environment" . | nindent 10 }} - {{- include "container_extra_envs" (list . .Values.dagProcessor.env) | indent 10 }} + {{- include "custom_airflow_environment" . | nindent 10 }} + {{- include "standard_airflow_environment" . | nindent 10 }} + {{- include "container_extra_envs" (list . .Values.dagProcessor.env) | indent 10 }} livenessProbe: initialDelaySeconds: {{ .Values.dagProcessor.livenessProbe.initialDelaySeconds }} timeoutSeconds: {{ .Values.dagProcessor.livenessProbe.timeoutSeconds }} @@ -182,10 +171,10 @@ spec: {{- include "dag_processor_liveness_check_command" . | nindent 16 }} {{- end }} {{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} - {{- include "git_sync_container" . | indent 8 }} + {{- include "git_sync_container" . | indent 8 }} {{- end }} {{- if .Values.dagProcessor.extraContainers }} - {{- toYaml .Values.dagProcessor.extraContainers | nindent 8 }} + {{- toYaml .Values.dagProcessor.extraContainers | nindent 8 }} {{- end }} volumes: - name: config @@ -200,13 +189,13 @@ spec: emptyDir: {} {{- end }} {{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.sshKeySecret }} - {{- include "git_sync_ssh_key_volume" . | indent 8 }} + {{- include "git_sync_ssh_key_volume" . | indent 8 }} {{- end }} {{- if .Values.volumes }} - {{- toYaml .Values.volumes | nindent 8 }} + {{- toYaml .Values.volumes | nindent 8 }} {{- end }} {{- if .Values.dagProcessor.extraVolumes }} - {{- toYaml .Values.dagProcessor.extraVolumes | nindent 8 }} + {{- toYaml .Values.dagProcessor.extraVolumes | nindent 8 }} {{- end }} {{- if .Values.logs.persistence.enabled }} - name: logs diff --git a/chart/templates/dag-processor/dag-processor-serviceaccount.yaml b/chart/templates/dag-processor/dag-processor-serviceaccount.yaml index 4cab5ba26b7a6e..7ca64e440ba6d7 100644 --- a/chart/templates/dag-processor/dag-processor-serviceaccount.yaml +++ b/chart/templates/dag-processor/dag-processor-serviceaccount.yaml @@ -31,11 +31,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} {{- with .Values.labels }} - {{ toYaml . | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.dagProcessor.serviceAccount.annotations}} - annotations: - {{ toYaml . | nindent 4 }} + annotations: {{- toYaml . | nindent 4 }} {{- end }} {{- end }} {{- end }} diff --git a/chart/templates/redis/redis-networkpolicy.yaml b/chart/templates/redis/redis-networkpolicy.yaml index b0f62b2426578a..0855cca8243c5a 100644 --- a/chart/templates/redis/redis-networkpolicy.yaml +++ b/chart/templates/redis/redis-networkpolicy.yaml @@ -29,9 +29,9 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: podSelector: matchLabels: diff --git a/chart/templates/redis/redis-service.yaml b/chart/templates/redis/redis-service.yaml index bcd1b21744b9be..753644b096e721 100644 --- a/chart/templates/redis/redis-service.yaml +++ b/chart/templates/redis/redis-service.yaml @@ -29,9 +29,9 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: ClusterIP selector: diff --git a/chart/templates/redis/redis-serviceaccount.yaml b/chart/templates/redis/redis-serviceaccount.yaml index cf3fe9f5dfb8c2..e656698f17ac8c 100644 --- a/chart/templates/redis/redis-serviceaccount.yaml +++ b/chart/templates/redis/redis-serviceaccount.yaml @@ -30,10 +30,9 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} {{- with .Values.labels }} - {{ toYaml . | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.redis.serviceAccount.annotations }} - annotations: - {{ toYaml . | nindent 4 }} + annotations: {{- toYaml . | nindent 4 }} {{- end }} {{- end }} diff --git a/chart/templates/redis/redis-statefulset.yaml b/chart/templates/redis/redis-statefulset.yaml index ca538fa29c3807..770207de13fbea 100644 --- a/chart/templates/redis/redis-statefulset.yaml +++ b/chart/templates/redis/redis-statefulset.yaml @@ -34,9 +34,9 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: serviceName: {{ .Release.Name }}-redis selector: @@ -50,27 +50,23 @@ spec: tier: airflow component: redis release: {{ .Release.Name }} -{{- with .Values.labels }} -{{ toYaml . | indent 8 }} -{{- end }} -{{- if or .Values.redis.safeToEvict .Values.redis.podAnnotations }} + {{- with .Values.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if or .Values.redis.safeToEvict .Values.redis.podAnnotations }} annotations: -{{- if .Values.redis.podAnnotations }} -{{- toYaml .Values.redis.podAnnotations | nindent 8 }} -{{- end }} + {{- if .Values.redis.podAnnotations }} + {{- toYaml .Values.redis.podAnnotations | nindent 8 }} + {{- end }} {{- if .Values.redis.safeToEvict }} cluster-autoscaler.kubernetes.io/safe-to-evict: "true" {{- end }} -{{- end }} + {{- end }} spec: - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - affinity: -{{ toYaml $affinity | indent 8 }} - tolerations: -{{ toYaml $tolerations | indent 8 }} - topologySpreadConstraints: -{{ toYaml $topologySpreadConstraints | indent 8 }} + nodeSelector: {{- toYaml $nodeSelector | nindent 8 }} + affinity: {{- toYaml $affinity | nindent 8 }} + tolerations: {{- toYaml $tolerations | nindent 8 }} + topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 8 }} serviceAccountName: {{ include "redis.serviceAccountName" . }} {{- if or .Values.registry.secretName .Values.registry.connection }} imagePullSecrets: @@ -82,8 +78,7 @@ spec: image: {{ template "redis_image" . }} imagePullPolicy: {{ .Values.images.redis.pullPolicy }} command: ["/bin/sh"] - resources: -{{ toYaml .Values.redis.resources | indent 12 }} + resources: {{- toYaml .Values.redis.resources | nindent 12 }} args: ["-c", "redis-server --requirepass ${REDIS_PASSWORD}"] ports: - name: redis-db @@ -97,25 +92,24 @@ spec: secretKeyRef: name: {{ template "redis_password_secret" . }} key: password -{{- if not .Values.redis.persistence.enabled }} + {{- if not .Values.redis.persistence.enabled }} volumes: - name: redis-db emptyDir: {} -{{- else }} + {{- else }} volumeClaimTemplates: - metadata: name: redis-db {{- if .Values.redis.persistence.annotations }} - annotations: - {{- toYaml .Values.redis.persistence.annotations | nindent 10 }} + annotations: {{- toYaml .Values.redis.persistence.annotations | nindent 10 }} {{- end }} spec: - {{- if .Values.redis.persistence.storageClassName }} + {{- if .Values.redis.persistence.storageClassName }} storageClassName: {{ .Values.redis.persistence.storageClassName }} - {{- end }} + {{- end }} accessModes: ["ReadWriteOnce"] resources: requests: storage: {{ .Values.redis.persistence.size }} -{{- end }} + {{- end }} {{- end }} diff --git a/chart/templates/statsd/statsd-deployment.yaml b/chart/templates/statsd/statsd-deployment.yaml index b8d0323349eef8..4772a1f3c6db87 100644 --- a/chart/templates/statsd/statsd-deployment.yaml +++ b/chart/templates/statsd/statsd-deployment.yaml @@ -35,9 +35,9 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: replicas: 1 {{- if $revisionHistoryLimit }} @@ -54,28 +54,24 @@ spec: tier: airflow component: statsd release: {{ .Release.Name }} -{{- with .Values.labels }} -{{ toYaml . | indent 8 }} -{{- end }} -{{- if or .Values.statsd.extraMappings .Values.statsd.podAnnotations }} + {{- with .Values.labels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if or .Values.statsd.extraMappings .Values.statsd.podAnnotations }} annotations: checksum/statsd-config: {{ include (print $.Template.BasePath "/configmaps/statsd-configmap.yaml") . | sha256sum }} {{- if .Values.statsd.podAnnotations }} - {{- toYaml .Values.statsd.podAnnotations | nindent 8 }} + {{- toYaml .Values.statsd.podAnnotations | nindent 8 }} {{- end }} -{{- end }} + {{- end }} spec: {{- if .Values.statsd.priorityClassName }} priorityClassName: {{ .Values.statsd.priorityClassName }} {{- end }} - nodeSelector: -{{ toYaml $nodeSelector | indent 8 }} - affinity: -{{ toYaml $affinity | indent 8 }} - tolerations: -{{ toYaml $tolerations | indent 8 }} - topologySpreadConstraints: -{{ toYaml $topologySpreadConstraints | indent 8 }} + nodeSelector: {{- toYaml $nodeSelector | nindent 8 }} + affinity: {{- toYaml $affinity | nindent 8 }} + tolerations: {{- toYaml $tolerations | nindent 8 }} + topologySpreadConstraints: {{- toYaml $topologySpreadConstraints | nindent 8 }} serviceAccountName: {{ include "statsd.serviceAccountName" . }} securityContext: {{ $securityContext | nindent 8 }} restartPolicy: Always @@ -90,8 +86,7 @@ spec: {{- if .Values.statsd.args }} args: {{ tpl (toYaml .Values.statsd.args) . | nindent 12 }} {{- end }} - resources: -{{ toYaml .Values.statsd.resources | indent 12 }} + resources: {{- toYaml .Values.statsd.resources | nindent 12 }} ports: - name: statsd-ingest protocol: UDP diff --git a/chart/templates/statsd/statsd-networkpolicy.yaml b/chart/templates/statsd/statsd-networkpolicy.yaml index 6c42a45ede17eb..8c292cb22b25c2 100644 --- a/chart/templates/statsd/statsd-networkpolicy.yaml +++ b/chart/templates/statsd/statsd-networkpolicy.yaml @@ -29,9 +29,9 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: podSelector: matchLabels: @@ -46,9 +46,9 @@ spec: matchLabels: tier: airflow release: {{ .Release.Name }} -{{- if .Values.statsd.extraNetworkPolicies }} -{{ toYaml .Values.statsd.extraNetworkPolicies | indent 4 }} -{{- end }} + {{- if .Values.statsd.extraNetworkPolicies }} + {{- toYaml .Values.statsd.extraNetworkPolicies | nindent 4 }} + {{- end }} ports: - protocol: UDP port: {{ .Values.ports.statsdIngest }} diff --git a/chart/templates/statsd/statsd-service.yaml b/chart/templates/statsd/statsd-service.yaml index 561dcf9fff8408..573c4d740d5388 100644 --- a/chart/templates/statsd/statsd-service.yaml +++ b/chart/templates/statsd/statsd-service.yaml @@ -29,15 +29,15 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} -{{- with .Values.labels }} -{{ toYaml . | indent 4 }} -{{- end }} + {{- with .Values.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} annotations: prometheus.io/scrape: "true" prometheus.io/port: {{ .Values.ports.statsdScrape | quote }} -{{- if .Values.statsd.service.extraAnnotations }} -{{- toYaml .Values.statsd.service.extraAnnotations | nindent 4 }} -{{- end }} + {{- if .Values.statsd.service.extraAnnotations }} + {{- toYaml .Values.statsd.service.extraAnnotations | nindent 4 }} + {{- end }} spec: type: ClusterIP selector: diff --git a/chart/templates/statsd/statsd-serviceaccount.yaml b/chart/templates/statsd/statsd-serviceaccount.yaml index a387c09590f747..1b116283f50651 100644 --- a/chart/templates/statsd/statsd-serviceaccount.yaml +++ b/chart/templates/statsd/statsd-serviceaccount.yaml @@ -30,10 +30,9 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} {{- with .Values.labels }} - {{ toYaml . | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.statsd.serviceAccount.annotations }} - annotations: - {{ toYaml . | nindent 4 }} + annotations: {{- toYaml . | nindent 4 }} {{- end }} {{- end }} diff --git a/tests/charts/test_configmap.py b/tests/charts/test_configmap.py index 9d44e17d0d93b7..86f35e6c6ea2b5 100644 --- a/tests/charts/test_configmap.py +++ b/tests/charts/test_configmap.py @@ -88,12 +88,12 @@ def test_kerberos_config_available_with_celery_executor(self): docs = render_chart( values={ "executor": "CeleryExecutor", - "kerberos": {"enabled": True, "config": "krb5content"}, + "kerberos": {"enabled": True, "config": "krb5\ncontent"}, }, show_only=["templates/configmaps/configmap.yaml"], ) - assert jmespath.search('data."krb5.conf"', docs[0]) == "\nkrb5content\n" + assert jmespath.search('data."krb5.conf"', docs[0]) == "krb5\ncontent" def test_pod_template_is_templated(self): docs = render_chart(