From a57b9470c9b4f7ed3efbf88627e7546d5a85a415 Mon Sep 17 00:00:00 2001 From: tripathishikha1 <156056746+tripathishikha1@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:00:40 +0530 Subject: [PATCH] Update _helpers.tpl --- charts/microservice/templates/_helpers.tpl | 60 ++++++++++++++++++---- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/charts/microservice/templates/_helpers.tpl b/charts/microservice/templates/_helpers.tpl index 95015ad0..851405d4 100644 --- a/charts/microservice/templates/_helpers.tpl +++ b/charts/microservice/templates/_helpers.tpl @@ -1,19 +1,57 @@ +#{{- define "microservice.fullname" -}} +#{{- printf "%s-%s" (default .Chart.Name .Values.env.microservice.fullname) .Release.Name | trunc 63 | trimSuffix "-" }} +#{{- end -}} + +#{{- define "microservice.labels" -}} +#app.kubernetes.io/name: {{ .Chart.Name | quote }} +#helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | replace ":" "-" | quote }} +#app.kubernetes.io/instance: {{ .Release.Name | quote }} +#app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" | replace ":" "-" | quote }} +#app.kubernetes.io/managed-by: {{ .Release.Service | quote }} +#{{- end -}} + +#{{- define "microservice.selectorLabels" -}} +#app: {{ default .Values.env.microservice.selectorLabels .Chart.Name | quote }} +#{{- end -}} + +#{{- define "microservice.matchLabels" -}} +#app: {{ default .Values.env.microservice.selectorLabels .Chart.Name | quote }} +#{{- end -}} + +{{/* Define the "microservice.fullname" template */}} {{- define "microservice.fullname" -}} -{{- printf "%s-%s" (default .Chart.Name .Values.env.microservice.fullname) .Release.Name | trunc 63 | trimSuffix "-" }} +{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{- define "microservice.labels" -}} -app.kubernetes.io/name: {{ .Chart.Name | quote }} -helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | replace ":" "-" | quote }} -app.kubernetes.io/instance: {{ .Release.Name | quote }} -app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" | replace ":" "-" | quote }} -app.kubernetes.io/managed-by: {{ .Release.Service | quote }} +{{/* Define the "microservice.name" template (if needed) */}} +{{- define "microservice.name" -}} +{{- .Chart.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{- define "microservice.selectorLabels" -}} -app: {{ default .Values.env.microservice.selectorLabels .Chart.Name | quote }} +{{/* Define the "microservice.chart" template (if needed) */}} +{{- define "microservice.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* Define other templates as necessary */}} +{{/* Define the "microservice.labels" template */}} +{{- define "microservice.labels" -}} +{{- with .Values.labels }} +{{- toYaml . | nindent 4 }} +{{- end }} +{{- end }} + +{{/* Define the "microservice.matchLabels" template */}} {{- define "microservice.matchLabels" -}} -app: {{ default .Values.env.microservice.selectorLabels .Chart.Name | quote }} -{{- end -}} +{{- with .Values.app.name }} + app: {{ . }} +{{- end }} +{{- end }} + +{{/* Define the "microservice.selectorLabels" template */}} +{{- define "microservice.selectorLabels" -}} +{{- with .Values.app.name }} + app: {{ . }} +{{- end }} +{{- end }} +