From 5021882066f3d5dc350faa182ffe62b156d4d75b Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 8 Oct 2020 18:45:19 +0500 Subject: [PATCH] Move common metadata to separate method --- .../ix-chart/2009.0.1/templates/_workload.tpl | 28 +++++++++++-------- .../ix-chart/2009.0.1/templates/workload.yaml | 4 +-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/charts/ix-chart/2009.0.1/templates/_workload.tpl b/charts/ix-chart/2009.0.1/templates/_workload.tpl index 39e4e9e18af..5e420ad542b 100644 --- a/charts/ix-chart/2009.0.1/templates/_workload.tpl +++ b/charts/ix-chart/2009.0.1/templates/_workload.tpl @@ -58,10 +58,10 @@ containers: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- include "containerCommand" | indent 2 }} - {{- include "containerArgs" | indent 2 }} - {{- include "containerEnvVariables" | indent 2 }} - {{- include "containerLivenssProbe" | indent 2 }} + {{- include "containerCommand" . | indent 2 }} + {{- include "containerArgs" . | indent 2 }} + {{- include "containerEnvVariables" . | indent 2 }} + {{- include "containerLivenssProbe" . | indent 2 }} {{- include "volumeConfiguration" . }} {{- end }} @@ -77,6 +77,16 @@ k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurat {{- end }} +{{/* +Metadata for workload +*/}} +{{- define "commonMetadataWorkload" }} +labels: + {{- include "ix-chart.selectorLabels" . | nindent 2 }} +annotations: + {{- include "workloadAnnotations" . | nindent 2 }} +{{- end }} + {{/* Deployment Spec */}} @@ -88,10 +98,7 @@ matchLabels: {{- include "ix-chart.selectorLabels" . | nindent 2 }} template: metadata: - labels: - {{- include "ix-chart.selectorLabels" . | nindent 6 }} - annotations: - {{- include "workloadAnnotations" . | nindent 6 }} + {{ include "commonMetadataWorkload" . | nindent 4 }} spec: {{- include "podSepc" . | indent 4 }} {{- end }} @@ -102,10 +109,7 @@ Job Spec Common */}} {{- define "jobSpecCommon" }} metadata: - labels: - {{- include "ix-chart.selectorLabels" . | nindent 4 }} - annotations: - {{- include "workloadAnnotations" . | nindent 4 }} + {{ include "commonMetadataWorkload" . | nindent 4 }} spec: {{- include "podSepc" . | indent 2 }} {{- end }} diff --git a/charts/ix-chart/2009.0.1/templates/workload.yaml b/charts/ix-chart/2009.0.1/templates/workload.yaml index 5ec39c6a8de..05e23802ccc 100644 --- a/charts/ix-chart/2009.0.1/templates/workload.yaml +++ b/charts/ix-chart/2009.0.1/templates/workload.yaml @@ -6,8 +6,8 @@ metadata: {{- include "ix-chart.labels" . | nindent 4 }} spec: {{- if eq (include "workloadIsDeployment" .) "true" }} - {{ include "deploymentSpec" | nindent 2 }} - {{- else if ne (include "workloadIsCronJob" .) "true" }} + {{ include "deploymentSpec" . | nindent 2 }} + {{- else if eq (include "workloadIsCronJob" .) "true" }} {{ include "cronJobSpec" . | nindent 2 }} {{- else }}} {{ include "jobSpec" . | nindent 2 }}