From 5750db036c498030749ded9f9cb7d491b6db0f12 Mon Sep 17 00:00:00 2001 From: Sahil Vazirani Date: Sat, 27 Jul 2024 22:28:08 -0700 Subject: [PATCH 1/3] Templatize resourceLabels for standardization --- charts/temporal/templates/_helpers.tpl | 32 +++++++++++++++++++ .../templates/admintools-deployment.yaml | 17 ++-------- .../templates/admintools-service.yaml | 7 +--- .../temporal/templates/frontend-ingress.yaml | 7 +--- .../temporal/templates/server-configmap.yaml | 7 +--- .../temporal/templates/server-deployment.yaml | 14 ++------ .../templates/server-dynamicconfigmap.yaml | 7 +--- charts/temporal/templates/server-job.yaml | 14 ++------ charts/temporal/templates/server-pdb.yaml | 7 +--- charts/temporal/templates/server-secret.yaml | 7 +--- .../templates/server-service-monitor.yaml | 7 +--- charts/temporal/templates/server-service.yaml | 14 ++------ charts/temporal/templates/serviceaccount.yaml | 7 +--- charts/temporal/templates/tests/test.yaml | 7 +--- charts/temporal/templates/web-deployment.yaml | 14 ++------ charts/temporal/templates/web-ingress.yaml | 7 +--- charts/temporal/templates/web-pdb.yaml | 7 +--- charts/temporal/templates/web-service.yaml | 7 +--- charts/temporal/values.yaml | 1 + 19 files changed, 55 insertions(+), 135 deletions(-) diff --git a/charts/temporal/templates/_helpers.tpl b/charts/temporal/templates/_helpers.tpl index 4d7e91d8..36a9bf44 100644 --- a/charts/temporal/templates/_helpers.tpl +++ b/charts/temporal/templates/_helpers.tpl @@ -58,6 +58,38 @@ and we want to make sure that the component is included in the name. {{- printf "%s-%s" (include "temporal.fullname" $global | trunc (sub 62 (len $component) | int) | trimSuffix "-" ) $component | trimSuffix "-" -}} {{- end -}} +{{/* +Define the AppVersion +*/}} +{{- define "temporal.appVersion" -}} +{{- if .Chart.AppVersion -}} +{{ .Chart.AppVersion | replace "+" "_" | quote }} +{{- else -}} +{{ include "temporal.chart" $ }} +{{- end -}} +{{- end -}} + +{{/* +Create the labels for all resources +*/}} +{{- define "temporal.resourceLabels" -}} +app.kubernetes.io/name: {{ include "temporal.name" $ }} +helm.sh/chart: {{ include "temporal.chart" $ }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/version: {{ include "temporal.appVersion" $ }} +{{ include "temporal.additionalResourceLabels" $ }} +{{- end -}} + +{{/* +Additonal user specified labels for all resources +*/}} +{{- define "temporal.additionalResourceLabels" -}} +{{- range $label_name, $label_value := .Values.addtionalLabels }} +{{ $label_name }}: {{ $label_value }} +{{- end -}} +{{- end -}} + {{/* Call nested templates. Source: https://stackoverflow.com/a/52024583/3027614 diff --git a/charts/temporal/templates/admintools-deployment.yaml b/charts/temporal/templates/admintools-deployment.yaml index 8e5515d8..a52ca068 100644 --- a/charts/temporal/templates/admintools-deployment.yaml +++ b/charts/temporal/templates/admintools-deployment.yaml @@ -4,13 +4,8 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list . "admintools") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: admintools - app.kubernetes.io/part-of: {{ .Chart.Name }} spec: replicas: 1 selector: @@ -21,16 +16,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 8 }} app.kubernetes.io/component: admintools - app.kubernetes.io/part-of: {{ .Chart.Name }} - {{- with $.Values.admintools.podLabels }} - {{- toYaml . | nindent 8 }} - {{- end }} {{- with $.Values.admintools.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} diff --git a/charts/temporal/templates/admintools-service.yaml b/charts/temporal/templates/admintools-service.yaml index 25ffa349..94620a83 100644 --- a/charts/temporal/templates/admintools-service.yaml +++ b/charts/temporal/templates/admintools-service.yaml @@ -4,13 +4,8 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "admintools") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: admintools - app.kubernetes.io/part-of: {{ .Chart.Name }} spec: type: ClusterIP ports: diff --git a/charts/temporal/templates/frontend-ingress.yaml b/charts/temporal/templates/frontend-ingress.yaml index 39a735d7..6fd33329 100644 --- a/charts/temporal/templates/frontend-ingress.yaml +++ b/charts/temporal/templates/frontend-ingress.yaml @@ -10,13 +10,8 @@ kind: Ingress metadata: name: {{ include "temporal.componentname" (list . "frontend") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: frontend - app.kubernetes.io/part-of: {{ .Chart.Name }} {{- with .Values.server.frontend.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} diff --git a/charts/temporal/templates/server-configmap.yaml b/charts/temporal/templates/server-configmap.yaml index 302642d7..a7946fe0 100644 --- a/charts/temporal/templates/server-configmap.yaml +++ b/charts/temporal/templates/server-configmap.yaml @@ -6,12 +6,7 @@ kind: ConfigMap metadata: name: "{{ include "temporal.fullname" $ }}-config" labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} - app.kubernetes.io/part-of: {{ $.Chart.Name }} + {{ include "temporal.resourceLabels" . | nindent 4 }} data: config_template.yaml: |- log: diff --git a/charts/temporal/templates/server-deployment.yaml b/charts/temporal/templates/server-deployment.yaml index 3679c226..efaa7c6b 100644 --- a/charts/temporal/templates/server-deployment.yaml +++ b/charts/temporal/templates/server-deployment.yaml @@ -6,13 +6,8 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list $ $service) }} labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" $ | nindent 4 }} app.kubernetes.io/component: {{ $service }} - app.kubernetes.io/part-of: {{ $.Chart.Name }} spec: replicas: {{ default $.Values.server.replicaCount $serviceValues.replicaCount }} selector: @@ -23,13 +18,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" $ | nindent 8 }} app.kubernetes.io/component: {{ $service }} - app.kubernetes.io/part-of: {{ $.Chart.Name }} {{- with (default $.Values.server.podLabels $serviceValues.podLabels) }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/temporal/templates/server-dynamicconfigmap.yaml b/charts/temporal/templates/server-dynamicconfigmap.yaml index 95ba8f9c..6840022f 100644 --- a/charts/temporal/templates/server-dynamicconfigmap.yaml +++ b/charts/temporal/templates/server-dynamicconfigmap.yaml @@ -4,12 +4,7 @@ kind: ConfigMap metadata: name: "{{ include "temporal.fullname" . }}-dynamic-config" labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} - app.kubernetes.io/part-of: {{ .Chart.Name }} + {{ include "temporal.resourceLabels" . | nindent 4 }} data: dynamic_config.yaml: |- {{- if $.Values.server.dynamicConfig }} diff --git a/charts/temporal/templates/server-job.yaml b/charts/temporal/templates/server-job.yaml index 71778278..36b9808b 100644 --- a/charts/temporal/templates/server-job.yaml +++ b/charts/temporal/templates/server-job.yaml @@ -4,26 +4,16 @@ kind: Job metadata: name: {{ include "temporal.componentname" (list . "schema") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: database - app.kubernetes.io/part-of: {{ .Chart.Name }} spec: backoffLimit: {{ $.Values.schema.setup.backoffLimit }} template: metadata: name: {{ include "temporal.componentname" (list . "schema") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 8 }} app.kubernetes.io/component: database - app.kubernetes.io/part-of: {{ .Chart.Name }} spec: {{ include "temporal.serviceAccount" . }} restartPolicy: OnFailure diff --git a/charts/temporal/templates/server-pdb.yaml b/charts/temporal/templates/server-pdb.yaml index 4371372b..d5546d00 100644 --- a/charts/temporal/templates/server-pdb.yaml +++ b/charts/temporal/templates/server-pdb.yaml @@ -7,13 +7,8 @@ kind: PodDisruptionBudget metadata: name: {{ include "temporal.componentname" (list $ $service) }}-pdb labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: {{ $service }} - app.kubernetes.io/part-of: {{ $.Chart.Name }} spec: {{ toYaml $serviceValues.podDisruptionBudget }} selector: diff --git a/charts/temporal/templates/server-secret.yaml b/charts/temporal/templates/server-secret.yaml index 6b93b085..c8d0db01 100644 --- a/charts/temporal/templates/server-secret.yaml +++ b/charts/temporal/templates/server-secret.yaml @@ -13,12 +13,7 @@ kind: Secret metadata: name: {{ $secretName }} labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} - app.kubernetes.io/part-of: {{ $.Chart.Name }} + {{ include "temporal.resourceLabels" $ | nindent 4 }} {{- with $.Values.server.secretLabels }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/temporal/templates/server-service-monitor.yaml b/charts/temporal/templates/server-service-monitor.yaml index 73909009..23936986 100644 --- a/charts/temporal/templates/server-service-monitor.yaml +++ b/charts/temporal/templates/server-service-monitor.yaml @@ -7,13 +7,8 @@ kind: ServiceMonitor metadata: name: {{ include "temporal.componentname" (list $ $service) }} labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: {{ $service }} - app.kubernetes.io/part-of: {{ $.Chart.Name }} {{- with (default $.Values.server.metrics.serviceMonitor.additionalLabels $serviceValues.metrics.serviceMonitor.additionalLabels) }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/temporal/templates/server-service.yaml b/charts/temporal/templates/server-service.yaml index f1a3a039..85093998 100644 --- a/charts/temporal/templates/server-service.yaml +++ b/charts/temporal/templates/server-service.yaml @@ -4,13 +4,8 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "frontend") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" $ | nindent 4 }} app.kubernetes.io/component: frontend - app.kubernetes.io/part-of: {{ .Chart.Name }} {{- if .Values.server.frontend.service.annotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.server.frontend.service.annotations "context" $) | nindent 4 }} {{- end }} @@ -42,13 +37,8 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list $ (printf "%s-headless" $service)) }} labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" $ | nindent 4 }} app.kubernetes.io/component: {{ $service }} - app.kubernetes.io/part-of: {{ $.Chart.Name }} app.kubernetes.io/headless: 'true' prometheus.io/job: {{ $.Chart.Name }}-{{ $service }} prometheus.io/scrape: 'true' diff --git a/charts/temporal/templates/serviceaccount.yaml b/charts/temporal/templates/serviceaccount.yaml index 7d6e7995..0dd77b55 100644 --- a/charts/temporal/templates/serviceaccount.yaml +++ b/charts/temporal/templates/serviceaccount.yaml @@ -4,12 +4,7 @@ kind: ServiceAccount metadata: name: {{ include "temporal.serviceAccountName" . }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} - app.kubernetes.io/part-of: {{ .Chart.Name }} + {{ include "temporal.resourceLabels" . | nindent 4 }} annotations: helm.sh/hook: pre-install, pre-upgrade helm.sh/hook-weight: "-10" diff --git a/charts/temporal/templates/tests/test.yaml b/charts/temporal/templates/tests/test.yaml index a74b1a34..d568227b 100644 --- a/charts/temporal/templates/tests/test.yaml +++ b/charts/temporal/templates/tests/test.yaml @@ -3,13 +3,8 @@ kind: Pod metadata: name: "{{ include "temporal.fullname" . }}-test-wfl" labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: test - app.kubernetes.io/part-of: {{ .Chart.Name }} annotations: "helm.sh/hook": test spec: diff --git a/charts/temporal/templates/web-deployment.yaml b/charts/temporal/templates/web-deployment.yaml index d6096e70..97e964bc 100644 --- a/charts/temporal/templates/web-deployment.yaml +++ b/charts/temporal/templates/web-deployment.yaml @@ -4,13 +4,8 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: web - app.kubernetes.io/part-of: {{ .Chart.Name }} spec: replicas: {{ .Values.web.replicaCount }} selector: @@ -21,13 +16,8 @@ spec: template: metadata: labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 8 }} app.kubernetes.io/component: web - app.kubernetes.io/part-of: {{ .Chart.Name }} {{- with .Values.web.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/temporal/templates/web-ingress.yaml b/charts/temporal/templates/web-ingress.yaml index 2f8ed446..dfb6970b 100644 --- a/charts/temporal/templates/web-ingress.yaml +++ b/charts/temporal/templates/web-ingress.yaml @@ -10,13 +10,8 @@ kind: Ingress metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: web - app.kubernetes.io/part-of: {{ .Chart.Name }} {{- with .Values.web.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} diff --git a/charts/temporal/templates/web-pdb.yaml b/charts/temporal/templates/web-pdb.yaml index b3350b6b..c1df6242 100644 --- a/charts/temporal/templates/web-pdb.yaml +++ b/charts/temporal/templates/web-pdb.yaml @@ -5,13 +5,8 @@ kind: PodDisruptionBudget metadata: name: {{ include "temporal.componentname" (list . "web") }}-pdb labels: - app.kubernetes.io/name: {{ include "temporal.name" $ }} - helm.sh/chart: {{ include "temporal.chart" $ }} - app.kubernetes.io/managed-by: {{ $.Release.Service }} - app.kubernetes.io/instance: {{ $.Release.Name }} - app.kubernetes.io/version: {{ $.Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: web - app.kubernetes.io/part-of: {{ $.Chart.Name }} spec: {{ toYaml $.Values.web.podDisruptionBudget }} selector: diff --git a/charts/temporal/templates/web-service.yaml b/charts/temporal/templates/web-service.yaml index a2968a7d..19afef13 100644 --- a/charts/temporal/templates/web-service.yaml +++ b/charts/temporal/templates/web-service.yaml @@ -4,13 +4,8 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - app.kubernetes.io/name: {{ include "temporal.name" . }} - helm.sh/chart: {{ include "temporal.chart" . }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} + {{ include "temporal.resourceLabels" . | nindent 4 }} app.kubernetes.io/component: web - app.kubernetes.io/part-of: {{ .Chart.Name }} {{- if .Values.web.service.annotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.web.service.annotations "context" $) | nindent 4 }} {{- end }} diff --git a/charts/temporal/values.yaml b/charts/temporal/values.yaml index 5f8c4fd4..39d91edb 100644 --- a/charts/temporal/values.yaml +++ b/charts/temporal/values.yaml @@ -12,6 +12,7 @@ serviceAccount: name: # extraAnnotations would let users add additional annotations extraAnnotations: +additionalLabels: {} server: enabled: true sidecarContainers: [] From 30b621009824a48a536ae81ffd1b15acca93667a Mon Sep 17 00:00:00 2001 From: Sahil Vazirani Date: Mon, 5 Aug 2024 22:20:59 -0700 Subject: [PATCH 2/3] address review feedback and parametrize resourceLabels function --- charts/temporal/templates/_helpers.tpl | 35 +++++++++++++++---- .../templates/admintools-deployment.yaml | 6 ++-- .../templates/admintools-service.yaml | 3 +- .../temporal/templates/frontend-ingress.yaml | 3 +- .../temporal/templates/server-configmap.yaml | 2 +- .../temporal/templates/server-deployment.yaml | 9 ++--- .../templates/server-dynamicconfigmap.yaml | 2 +- charts/temporal/templates/server-job.yaml | 7 ++-- charts/temporal/templates/server-pdb.yaml | 3 +- charts/temporal/templates/server-secret.yaml | 5 +-- .../templates/server-service-monitor.yaml | 3 +- charts/temporal/templates/server-service.yaml | 6 ++-- charts/temporal/templates/serviceaccount.yaml | 2 +- charts/temporal/templates/tests/test.yaml | 3 +- charts/temporal/templates/web-deployment.yaml | 9 ++--- charts/temporal/templates/web-ingress.yaml | 3 +- charts/temporal/templates/web-pdb.yaml | 3 +- charts/temporal/templates/web-service.yaml | 3 +- 18 files changed, 52 insertions(+), 55 deletions(-) diff --git a/charts/temporal/templates/_helpers.tpl b/charts/temporal/templates/_helpers.tpl index 36a9bf44..4e41ce5c 100644 --- a/charts/temporal/templates/_helpers.tpl +++ b/charts/temporal/templates/_helpers.tpl @@ -73,12 +73,35 @@ Define the AppVersion Create the labels for all resources */}} {{- define "temporal.resourceLabels" -}} -app.kubernetes.io/name: {{ include "temporal.name" $ }} -helm.sh/chart: {{ include "temporal.chart" $ }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -app.kubernetes.io/instance: {{ .Release.Name }} -app.kubernetes.io/version: {{ include "temporal.appVersion" $ }} -{{ include "temporal.additionalResourceLabels" $ }} +{{- $global := index . 0 -}} +{{- $scope := index . 1 -}} +{{- $resourceType := index . 2 -}} +{{- $component := "server" -}} +{{- if (or (eq $scope "admintools") (eq $scope "web")) -}} +{{- $component = $scope -}} +{{- end -}} +{{- with $scope -}} +app.kubernetes.io/component: {{ . }} +{{- end }} +app.kubernetes.io/name: {{ include "temporal.name" $global }} +helm.sh/chart: {{ include "temporal.chart" $global }} +app.kubernetes.io/managed-by: {{ index $global "Release" "Service" }} +app.kubernetes.io/instance: {{ index $global "Release" "Name" }} +app.kubernetes.io/version: {{ include "temporal.appVersion" $global }} +app.kubernetes.io/part-of: {{ $global.Chart.Name }} +{{- with $resourceType -}} +{{- $resourceTypeKey := printf "%sLabels" . -}} +{{- $resourceLabels := dict -}} +{{ if or (eq $scope "") (ne $component "server") -}} +{{- $resourceLabels = (index $global.Values $component $resourceTypeKey) -}} +{{- else -}} +{{- $resourceLabels = (index $global.Values $component $scope $resourceTypeKey) -}} +{{- end -}} +{{- range $label_name, $label_value := $resourceLabels -}} +{{ $label_name}}: {{ $label_value }} +{{- end -}} +{{- end -}} +{{ include "temporal.additionalResourceLabels" $global }} {{- end -}} {{/* diff --git a/charts/temporal/templates/admintools-deployment.yaml b/charts/temporal/templates/admintools-deployment.yaml index a52ca068..b914ab43 100644 --- a/charts/temporal/templates/admintools-deployment.yaml +++ b/charts/temporal/templates/admintools-deployment.yaml @@ -4,8 +4,7 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list . "admintools") }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: admintools + {{ include "temporal.resourceLabels" (list . "admintools" "") | nindent 4 }} spec: replicas: 1 selector: @@ -16,8 +15,7 @@ spec: template: metadata: labels: - {{ include "temporal.resourceLabels" . | nindent 8 }} - app.kubernetes.io/component: admintools + {{ include "temporal.resourceLabels" (list . "admintools" "pod") | nindent 8 }} {{- with $.Values.admintools.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} diff --git a/charts/temporal/templates/admintools-service.yaml b/charts/temporal/templates/admintools-service.yaml index 94620a83..96cd6b5a 100644 --- a/charts/temporal/templates/admintools-service.yaml +++ b/charts/temporal/templates/admintools-service.yaml @@ -4,8 +4,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "admintools") }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: admintools + {{ include "temporal.resourceLabels" (list . "admintools" "") | nindent 4 }} spec: type: ClusterIP ports: diff --git a/charts/temporal/templates/frontend-ingress.yaml b/charts/temporal/templates/frontend-ingress.yaml index 6fd33329..edfb015b 100644 --- a/charts/temporal/templates/frontend-ingress.yaml +++ b/charts/temporal/templates/frontend-ingress.yaml @@ -10,8 +10,7 @@ kind: Ingress metadata: name: {{ include "temporal.componentname" (list . "frontend") }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: frontend + {{ include "temporal.resourceLabels" (list . "frontend" "") | nindent 4 }} {{- with .Values.server.frontend.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} diff --git a/charts/temporal/templates/server-configmap.yaml b/charts/temporal/templates/server-configmap.yaml index a7946fe0..efee49ae 100644 --- a/charts/temporal/templates/server-configmap.yaml +++ b/charts/temporal/templates/server-configmap.yaml @@ -6,7 +6,7 @@ kind: ConfigMap metadata: name: "{{ include "temporal.fullname" $ }}-config" labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} + {{ include "temporal.resourceLabels" (list . "" "") | nindent 4 }} data: config_template.yaml: |- log: diff --git a/charts/temporal/templates/server-deployment.yaml b/charts/temporal/templates/server-deployment.yaml index efaa7c6b..13bf0591 100644 --- a/charts/temporal/templates/server-deployment.yaml +++ b/charts/temporal/templates/server-deployment.yaml @@ -6,8 +6,7 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list $ $service) }} labels: - {{ include "temporal.resourceLabels" $ | nindent 4 }} - app.kubernetes.io/component: {{ $service }} + {{ include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} spec: replicas: {{ default $.Values.server.replicaCount $serviceValues.replicaCount }} selector: @@ -18,11 +17,7 @@ spec: template: metadata: labels: - {{ include "temporal.resourceLabels" $ | nindent 8 }} - app.kubernetes.io/component: {{ $service }} - {{- with (default $.Values.server.podLabels $serviceValues.podLabels) }} - {{- toYaml . | nindent 8 }} - {{- end }} + {{ include "temporal.resourceLabels" (list $ $service "pod") | nindent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/server-configmap.yaml") $ | sha256sum }} {{- if (default $.Values.server.metrics.annotations.enabled $serviceValues.metrics.annotations.enabled) }} diff --git a/charts/temporal/templates/server-dynamicconfigmap.yaml b/charts/temporal/templates/server-dynamicconfigmap.yaml index 6840022f..21ad438a 100644 --- a/charts/temporal/templates/server-dynamicconfigmap.yaml +++ b/charts/temporal/templates/server-dynamicconfigmap.yaml @@ -4,7 +4,7 @@ kind: ConfigMap metadata: name: "{{ include "temporal.fullname" . }}-dynamic-config" labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} + {{ include "temporal.resourceLabels" (list . "" "") | nindent 4 }} data: dynamic_config.yaml: |- {{- if $.Values.server.dynamicConfig }} diff --git a/charts/temporal/templates/server-job.yaml b/charts/temporal/templates/server-job.yaml index 36b9808b..902d39d4 100644 --- a/charts/temporal/templates/server-job.yaml +++ b/charts/temporal/templates/server-job.yaml @@ -4,16 +4,15 @@ kind: Job metadata: name: {{ include "temporal.componentname" (list . "schema") }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: database + {{ include "temporal.resourceLabels" (list . "database" "") | nindent 4 }} spec: backoffLimit: {{ $.Values.schema.setup.backoffLimit }} template: metadata: name: {{ include "temporal.componentname" (list . "schema") }} labels: - {{ include "temporal.resourceLabels" . | nindent 8 }} - app.kubernetes.io/component: database + # Currently there are no labels for job type + {{ include "temporal.resourceLabels" (list . "database" "") | nindent 8 }} spec: {{ include "temporal.serviceAccount" . }} restartPolicy: OnFailure diff --git a/charts/temporal/templates/server-pdb.yaml b/charts/temporal/templates/server-pdb.yaml index d5546d00..2e5d3a6f 100644 --- a/charts/temporal/templates/server-pdb.yaml +++ b/charts/temporal/templates/server-pdb.yaml @@ -7,8 +7,7 @@ kind: PodDisruptionBudget metadata: name: {{ include "temporal.componentname" (list $ $service) }}-pdb labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: {{ $service }} + {{ include "temporal.resourceLabels" (list . $service "") | nindent 4 }} spec: {{ toYaml $serviceValues.podDisruptionBudget }} selector: diff --git a/charts/temporal/templates/server-secret.yaml b/charts/temporal/templates/server-secret.yaml index c8d0db01..2cc5515a 100644 --- a/charts/temporal/templates/server-secret.yaml +++ b/charts/temporal/templates/server-secret.yaml @@ -13,10 +13,7 @@ kind: Secret metadata: name: {{ $secretName }} labels: - {{ include "temporal.resourceLabels" $ | nindent 4 }} - {{- with $.Values.server.secretLabels }} - {{- toYaml . | nindent 4 }} - {{- end }} + {{ include "temporal.resourceLabels" (list $ "" "secret") | nindent 4 }} {{- with $.Values.server.secretAnnotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/temporal/templates/server-service-monitor.yaml b/charts/temporal/templates/server-service-monitor.yaml index 23936986..e1dedf66 100644 --- a/charts/temporal/templates/server-service-monitor.yaml +++ b/charts/temporal/templates/server-service-monitor.yaml @@ -7,8 +7,7 @@ kind: ServiceMonitor metadata: name: {{ include "temporal.componentname" (list $ $service) }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: {{ $service }} + {{ include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} {{- with (default $.Values.server.metrics.serviceMonitor.additionalLabels $serviceValues.metrics.serviceMonitor.additionalLabels) }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/temporal/templates/server-service.yaml b/charts/temporal/templates/server-service.yaml index 85093998..6604ac37 100644 --- a/charts/temporal/templates/server-service.yaml +++ b/charts/temporal/templates/server-service.yaml @@ -4,8 +4,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "frontend") }} labels: - {{ include "temporal.resourceLabels" $ | nindent 4 }} - app.kubernetes.io/component: frontend + {{ include "temporal.resourceLabels" (list $ "frontend" "") | nindent 4 }} {{- if .Values.server.frontend.service.annotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.server.frontend.service.annotations "context" $) | nindent 4 }} {{- end }} @@ -37,8 +36,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list $ (printf "%s-headless" $service)) }} labels: - {{ include "temporal.resourceLabels" $ | nindent 4 }} - app.kubernetes.io/component: {{ $service }} + {{ include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} app.kubernetes.io/headless: 'true' prometheus.io/job: {{ $.Chart.Name }}-{{ $service }} prometheus.io/scrape: 'true' diff --git a/charts/temporal/templates/serviceaccount.yaml b/charts/temporal/templates/serviceaccount.yaml index 0dd77b55..81342eeb 100644 --- a/charts/temporal/templates/serviceaccount.yaml +++ b/charts/temporal/templates/serviceaccount.yaml @@ -4,7 +4,7 @@ kind: ServiceAccount metadata: name: {{ include "temporal.serviceAccountName" . }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} + {{ include "temporal.resourceLabels" (list . "" "") | nindent 4 }} annotations: helm.sh/hook: pre-install, pre-upgrade helm.sh/hook-weight: "-10" diff --git a/charts/temporal/templates/tests/test.yaml b/charts/temporal/templates/tests/test.yaml index d568227b..153d38c8 100644 --- a/charts/temporal/templates/tests/test.yaml +++ b/charts/temporal/templates/tests/test.yaml @@ -3,8 +3,7 @@ kind: Pod metadata: name: "{{ include "temporal.fullname" . }}-test-wfl" labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: test + {{ include "temporal.resourceLabels" (list $ "test" "") | nindent 4 }} annotations: "helm.sh/hook": test spec: diff --git a/charts/temporal/templates/web-deployment.yaml b/charts/temporal/templates/web-deployment.yaml index 97e964bc..5ebdb250 100644 --- a/charts/temporal/templates/web-deployment.yaml +++ b/charts/temporal/templates/web-deployment.yaml @@ -4,8 +4,7 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: web + {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} spec: replicas: {{ .Values.web.replicaCount }} selector: @@ -16,11 +15,7 @@ spec: template: metadata: labels: - {{ include "temporal.resourceLabels" . | nindent 8 }} - app.kubernetes.io/component: web - {{- with .Values.web.podLabels }} - {{- toYaml . | nindent 8 }} - {{- end }} + {{ include "temporal.resourceLabels" (list $ "web" "pod") | nindent 8 }} {{- with .Values.web.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} diff --git a/charts/temporal/templates/web-ingress.yaml b/charts/temporal/templates/web-ingress.yaml index dfb6970b..650f3ad9 100644 --- a/charts/temporal/templates/web-ingress.yaml +++ b/charts/temporal/templates/web-ingress.yaml @@ -10,8 +10,7 @@ kind: Ingress metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: web + {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} {{- with .Values.web.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} diff --git a/charts/temporal/templates/web-pdb.yaml b/charts/temporal/templates/web-pdb.yaml index c1df6242..424fd37a 100644 --- a/charts/temporal/templates/web-pdb.yaml +++ b/charts/temporal/templates/web-pdb.yaml @@ -5,8 +5,7 @@ kind: PodDisruptionBudget metadata: name: {{ include "temporal.componentname" (list . "web") }}-pdb labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: web + {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} spec: {{ toYaml $.Values.web.podDisruptionBudget }} selector: diff --git a/charts/temporal/templates/web-service.yaml b/charts/temporal/templates/web-service.yaml index 19afef13..a70dd59f 100644 --- a/charts/temporal/templates/web-service.yaml +++ b/charts/temporal/templates/web-service.yaml @@ -4,8 +4,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - {{ include "temporal.resourceLabels" . | nindent 4 }} - app.kubernetes.io/component: web + {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} {{- if .Values.web.service.annotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.web.service.annotations "context" $) | nindent 4 }} {{- end }} From be843a552c6d39fcc4b6a650dd48989966219430 Mon Sep 17 00:00:00 2001 From: Sahil Vazirani Date: Tue, 6 Aug 2024 05:21:51 -0700 Subject: [PATCH 3/3] fix typo and whitespace --- charts/temporal/templates/_helpers.tpl | 6 +++--- charts/temporal/templates/admintools-deployment.yaml | 4 ++-- charts/temporal/templates/admintools-service.yaml | 2 +- charts/temporal/templates/frontend-ingress.yaml | 2 +- charts/temporal/templates/server-configmap.yaml | 2 +- charts/temporal/templates/server-deployment.yaml | 4 ++-- charts/temporal/templates/server-dynamicconfigmap.yaml | 2 +- charts/temporal/templates/server-job.yaml | 4 ++-- charts/temporal/templates/server-pdb.yaml | 2 +- charts/temporal/templates/server-secret.yaml | 2 +- charts/temporal/templates/server-service-monitor.yaml | 2 +- charts/temporal/templates/server-service.yaml | 4 ++-- charts/temporal/templates/serviceaccount.yaml | 2 +- charts/temporal/templates/tests/test.yaml | 2 +- charts/temporal/templates/web-deployment.yaml | 4 ++-- charts/temporal/templates/web-ingress.yaml | 2 +- charts/temporal/templates/web-pdb.yaml | 2 +- charts/temporal/templates/web-service.yaml | 2 +- 18 files changed, 25 insertions(+), 25 deletions(-) diff --git a/charts/temporal/templates/_helpers.tpl b/charts/temporal/templates/_helpers.tpl index 4e41ce5c..609ca6b0 100644 --- a/charts/temporal/templates/_helpers.tpl +++ b/charts/temporal/templates/_helpers.tpl @@ -82,7 +82,7 @@ Create the labels for all resources {{- end -}} {{- with $scope -}} app.kubernetes.io/component: {{ . }} -{{- end }} +{{ end -}} app.kubernetes.io/name: {{ include "temporal.name" $global }} helm.sh/chart: {{ include "temporal.chart" $global }} app.kubernetes.io/managed-by: {{ index $global "Release" "Service" }} @@ -92,7 +92,7 @@ app.kubernetes.io/part-of: {{ $global.Chart.Name }} {{- with $resourceType -}} {{- $resourceTypeKey := printf "%sLabels" . -}} {{- $resourceLabels := dict -}} -{{ if or (eq $scope "") (ne $component "server") -}} +{{- if or (eq $scope "") (ne $component "server") -}} {{- $resourceLabels = (index $global.Values $component $resourceTypeKey) -}} {{- else -}} {{- $resourceLabels = (index $global.Values $component $scope $resourceTypeKey) -}} @@ -108,7 +108,7 @@ app.kubernetes.io/part-of: {{ $global.Chart.Name }} Additonal user specified labels for all resources */}} {{- define "temporal.additionalResourceLabels" -}} -{{- range $label_name, $label_value := .Values.addtionalLabels }} +{{- range $label_name, $label_value := .Values.additionalLabels }} {{ $label_name }}: {{ $label_value }} {{- end -}} {{- end -}} diff --git a/charts/temporal/templates/admintools-deployment.yaml b/charts/temporal/templates/admintools-deployment.yaml index b914ab43..1704bc6c 100644 --- a/charts/temporal/templates/admintools-deployment.yaml +++ b/charts/temporal/templates/admintools-deployment.yaml @@ -4,7 +4,7 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list . "admintools") }} labels: - {{ include "temporal.resourceLabels" (list . "admintools" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "admintools" "") | nindent 4 }} spec: replicas: 1 selector: @@ -15,7 +15,7 @@ spec: template: metadata: labels: - {{ include "temporal.resourceLabels" (list . "admintools" "pod") | nindent 8 }} + {{- include "temporal.resourceLabels" (list . "admintools" "pod") | nindent 8 }} {{- with $.Values.admintools.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} diff --git a/charts/temporal/templates/admintools-service.yaml b/charts/temporal/templates/admintools-service.yaml index 96cd6b5a..2a3f8566 100644 --- a/charts/temporal/templates/admintools-service.yaml +++ b/charts/temporal/templates/admintools-service.yaml @@ -4,7 +4,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "admintools") }} labels: - {{ include "temporal.resourceLabels" (list . "admintools" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "admintools" "") | nindent 4 }} spec: type: ClusterIP ports: diff --git a/charts/temporal/templates/frontend-ingress.yaml b/charts/temporal/templates/frontend-ingress.yaml index edfb015b..559c7c36 100644 --- a/charts/temporal/templates/frontend-ingress.yaml +++ b/charts/temporal/templates/frontend-ingress.yaml @@ -10,7 +10,7 @@ kind: Ingress metadata: name: {{ include "temporal.componentname" (list . "frontend") }} labels: - {{ include "temporal.resourceLabels" (list . "frontend" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "frontend" "") | nindent 4 }} {{- with .Values.server.frontend.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} diff --git a/charts/temporal/templates/server-configmap.yaml b/charts/temporal/templates/server-configmap.yaml index efee49ae..e7f93dfd 100644 --- a/charts/temporal/templates/server-configmap.yaml +++ b/charts/temporal/templates/server-configmap.yaml @@ -6,7 +6,7 @@ kind: ConfigMap metadata: name: "{{ include "temporal.fullname" $ }}-config" labels: - {{ include "temporal.resourceLabels" (list . "" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "" "") | nindent 4 }} data: config_template.yaml: |- log: diff --git a/charts/temporal/templates/server-deployment.yaml b/charts/temporal/templates/server-deployment.yaml index 13bf0591..13e0814f 100644 --- a/charts/temporal/templates/server-deployment.yaml +++ b/charts/temporal/templates/server-deployment.yaml @@ -6,7 +6,7 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list $ $service) }} labels: - {{ include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} spec: replicas: {{ default $.Values.server.replicaCount $serviceValues.replicaCount }} selector: @@ -17,7 +17,7 @@ spec: template: metadata: labels: - {{ include "temporal.resourceLabels" (list $ $service "pod") | nindent 8 }} + {{- include "temporal.resourceLabels" (list $ $service "pod") | nindent 8 }} annotations: checksum/config: {{ include (print $.Template.BasePath "/server-configmap.yaml") $ | sha256sum }} {{- if (default $.Values.server.metrics.annotations.enabled $serviceValues.metrics.annotations.enabled) }} diff --git a/charts/temporal/templates/server-dynamicconfigmap.yaml b/charts/temporal/templates/server-dynamicconfigmap.yaml index 21ad438a..94c56886 100644 --- a/charts/temporal/templates/server-dynamicconfigmap.yaml +++ b/charts/temporal/templates/server-dynamicconfigmap.yaml @@ -4,7 +4,7 @@ kind: ConfigMap metadata: name: "{{ include "temporal.fullname" . }}-dynamic-config" labels: - {{ include "temporal.resourceLabels" (list . "" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "" "") | nindent 4 }} data: dynamic_config.yaml: |- {{- if $.Values.server.dynamicConfig }} diff --git a/charts/temporal/templates/server-job.yaml b/charts/temporal/templates/server-job.yaml index 902d39d4..9aeeba5a 100644 --- a/charts/temporal/templates/server-job.yaml +++ b/charts/temporal/templates/server-job.yaml @@ -4,7 +4,7 @@ kind: Job metadata: name: {{ include "temporal.componentname" (list . "schema") }} labels: - {{ include "temporal.resourceLabels" (list . "database" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "database" "") | nindent 4 }} spec: backoffLimit: {{ $.Values.schema.setup.backoffLimit }} template: @@ -12,7 +12,7 @@ spec: name: {{ include "temporal.componentname" (list . "schema") }} labels: # Currently there are no labels for job type - {{ include "temporal.resourceLabels" (list . "database" "") | nindent 8 }} + {{- include "temporal.resourceLabels" (list . "database" "") | nindent 8 }} spec: {{ include "temporal.serviceAccount" . }} restartPolicy: OnFailure diff --git a/charts/temporal/templates/server-pdb.yaml b/charts/temporal/templates/server-pdb.yaml index 2e5d3a6f..db7aace6 100644 --- a/charts/temporal/templates/server-pdb.yaml +++ b/charts/temporal/templates/server-pdb.yaml @@ -7,7 +7,7 @@ kind: PodDisruptionBudget metadata: name: {{ include "temporal.componentname" (list $ $service) }}-pdb labels: - {{ include "temporal.resourceLabels" (list . $service "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . $service "") | nindent 4 }} spec: {{ toYaml $serviceValues.podDisruptionBudget }} selector: diff --git a/charts/temporal/templates/server-secret.yaml b/charts/temporal/templates/server-secret.yaml index 2cc5515a..e6c786d6 100644 --- a/charts/temporal/templates/server-secret.yaml +++ b/charts/temporal/templates/server-secret.yaml @@ -13,7 +13,7 @@ kind: Secret metadata: name: {{ $secretName }} labels: - {{ include "temporal.resourceLabels" (list $ "" "secret") | nindent 4 }} + {{- include "temporal.resourceLabels" (list $ "" "secret") | nindent 4 }} {{- with $.Values.server.secretAnnotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/temporal/templates/server-service-monitor.yaml b/charts/temporal/templates/server-service-monitor.yaml index e1dedf66..d5aedb94 100644 --- a/charts/temporal/templates/server-service-monitor.yaml +++ b/charts/temporal/templates/server-service-monitor.yaml @@ -7,7 +7,7 @@ kind: ServiceMonitor metadata: name: {{ include "temporal.componentname" (list $ $service) }} labels: - {{ include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} {{- with (default $.Values.server.metrics.serviceMonitor.additionalLabels $serviceValues.metrics.serviceMonitor.additionalLabels) }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/charts/temporal/templates/server-service.yaml b/charts/temporal/templates/server-service.yaml index 6604ac37..58c0a0fd 100644 --- a/charts/temporal/templates/server-service.yaml +++ b/charts/temporal/templates/server-service.yaml @@ -4,7 +4,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "frontend") }} labels: - {{ include "temporal.resourceLabels" (list $ "frontend" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list $ "frontend" "") | nindent 4 }} {{- if .Values.server.frontend.service.annotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.server.frontend.service.annotations "context" $) | nindent 4 }} {{- end }} @@ -36,7 +36,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list $ (printf "%s-headless" $service)) }} labels: - {{ include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list $ $service "") | nindent 4 }} app.kubernetes.io/headless: 'true' prometheus.io/job: {{ $.Chart.Name }}-{{ $service }} prometheus.io/scrape: 'true' diff --git a/charts/temporal/templates/serviceaccount.yaml b/charts/temporal/templates/serviceaccount.yaml index 81342eeb..8265bc72 100644 --- a/charts/temporal/templates/serviceaccount.yaml +++ b/charts/temporal/templates/serviceaccount.yaml @@ -4,7 +4,7 @@ kind: ServiceAccount metadata: name: {{ include "temporal.serviceAccountName" . }} labels: - {{ include "temporal.resourceLabels" (list . "" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "" "") | nindent 4 }} annotations: helm.sh/hook: pre-install, pre-upgrade helm.sh/hook-weight: "-10" diff --git a/charts/temporal/templates/tests/test.yaml b/charts/temporal/templates/tests/test.yaml index 153d38c8..3a52a657 100644 --- a/charts/temporal/templates/tests/test.yaml +++ b/charts/temporal/templates/tests/test.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: "{{ include "temporal.fullname" . }}-test-wfl" labels: - {{ include "temporal.resourceLabels" (list $ "test" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list $ "test" "") | nindent 4 }} annotations: "helm.sh/hook": test spec: diff --git a/charts/temporal/templates/web-deployment.yaml b/charts/temporal/templates/web-deployment.yaml index 5ebdb250..f1524e51 100644 --- a/charts/temporal/templates/web-deployment.yaml +++ b/charts/temporal/templates/web-deployment.yaml @@ -4,7 +4,7 @@ kind: Deployment metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} spec: replicas: {{ .Values.web.replicaCount }} selector: @@ -15,7 +15,7 @@ spec: template: metadata: labels: - {{ include "temporal.resourceLabels" (list $ "web" "pod") | nindent 8 }} + {{- include "temporal.resourceLabels" (list $ "web" "pod") | nindent 8 }} {{- with .Values.web.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} diff --git a/charts/temporal/templates/web-ingress.yaml b/charts/temporal/templates/web-ingress.yaml index 650f3ad9..a96644db 100644 --- a/charts/temporal/templates/web-ingress.yaml +++ b/charts/temporal/templates/web-ingress.yaml @@ -10,7 +10,7 @@ kind: Ingress metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} {{- with .Values.web.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} diff --git a/charts/temporal/templates/web-pdb.yaml b/charts/temporal/templates/web-pdb.yaml index 424fd37a..a6dbe445 100644 --- a/charts/temporal/templates/web-pdb.yaml +++ b/charts/temporal/templates/web-pdb.yaml @@ -5,7 +5,7 @@ kind: PodDisruptionBudget metadata: name: {{ include "temporal.componentname" (list . "web") }}-pdb labels: - {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} spec: {{ toYaml $.Values.web.podDisruptionBudget }} selector: diff --git a/charts/temporal/templates/web-service.yaml b/charts/temporal/templates/web-service.yaml index a70dd59f..e88d9e24 100644 --- a/charts/temporal/templates/web-service.yaml +++ b/charts/temporal/templates/web-service.yaml @@ -4,7 +4,7 @@ kind: Service metadata: name: {{ include "temporal.componentname" (list . "web") }} labels: - {{ include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} + {{- include "temporal.resourceLabels" (list . "web" "") | nindent 4 }} {{- if .Values.web.service.annotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.web.service.annotations "context" $) | nindent 4 }} {{- end }}