From 2e0c4ef0c6adeb30628a4cc2ea38aa32119d954e Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Fri, 18 Feb 2022 08:51:24 -0300 Subject: [PATCH] Fix selector labels --- .../mailproxy/v0.1.0/templates/_helpers.tpl | 19 +++++++++++++++---- .../v0.1.0/templates/mailauth-deployment.yaml | 4 ++-- .../v0.1.0/templates/mailauth-service.yaml | 2 +- .../v0.1.0/templates/nginx-deployment.yaml | 4 ++-- .../v0.1.0/templates/nginx-service.yaml | 2 +- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/charts/mailproxy/v0.1.0/templates/_helpers.tpl b/charts/mailproxy/v0.1.0/templates/_helpers.tpl index 3cd5733..3835848 100644 --- a/charts/mailproxy/v0.1.0/templates/_helpers.tpl +++ b/charts/mailproxy/v0.1.0/templates/_helpers.tpl @@ -33,9 +33,15 @@ Create chart name and version as used by the chart label. {{/* Common labels */}} +{{- define "mailproxy.common.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mailproxy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + + {{- define "mailproxy.labels" -}} helm.sh/chart: {{ include "mailproxy.chart" . }} -{{ include "mailproxy.selectorLabels" . }} +{{ include "mailproxy.common.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,7 +51,12 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "mailproxy.selectorLabels" -}} -app.kubernetes.io/name: {{ include "mailproxy.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} +{{- define "mailproxy.nginx.selectorLabels" -}} +{{ include "mailproxy.common.selectorLabels" . }} +app.kubernetes.io/component: nginx +{{- end }} + +{{- define "mailproxy.mailauth.selectorLabels" -}} +{{ include "mailproxy.common.selectorLabels" . }} +app.kubernetes.io/component: mailauth {{- end }} \ No newline at end of file diff --git a/charts/mailproxy/v0.1.0/templates/mailauth-deployment.yaml b/charts/mailproxy/v0.1.0/templates/mailauth-deployment.yaml index eae8b77..de79fcb 100644 --- a/charts/mailproxy/v0.1.0/templates/mailauth-deployment.yaml +++ b/charts/mailproxy/v0.1.0/templates/mailauth-deployment.yaml @@ -8,7 +8,7 @@ spec: replicas: {{ .Values.mailauth.replicaCount }} selector: matchLabels: - {{- include "mailproxy.selectorLabels" . | nindent 6 }} + {{- include "mailproxy.mailauth.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -16,7 +16,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "mailproxy.selectorLabels" . | nindent 8 }} + {{- include "mailproxy.mailauth.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/mailproxy/v0.1.0/templates/mailauth-service.yaml b/charts/mailproxy/v0.1.0/templates/mailauth-service.yaml index defcb0e..070d8fa 100644 --- a/charts/mailproxy/v0.1.0/templates/mailauth-service.yaml +++ b/charts/mailproxy/v0.1.0/templates/mailauth-service.yaml @@ -14,4 +14,4 @@ spec: name: {{ $port.name }} {{- end }} selector: - {{- include "mailproxy.selectorLabels" . | nindent 4 }} + {{- include "mailproxy.mailauth.selectorLabels" . | nindent 4 }} diff --git a/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml index ab13f1d..c344891 100644 --- a/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml +++ b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml @@ -8,7 +8,7 @@ spec: replicas: {{ .Values.nginx.replicaCount }} selector: matchLabels: - {{- include "mailproxy.selectorLabels" . | nindent 6 }} + {{- include "mailproxy.nginx.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -16,7 +16,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "mailproxy.selectorLabels" . | nindent 8 }} + {{- include "mailproxy.nginx.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/mailproxy/v0.1.0/templates/nginx-service.yaml b/charts/mailproxy/v0.1.0/templates/nginx-service.yaml index 52da966..c5bdf6e 100644 --- a/charts/mailproxy/v0.1.0/templates/nginx-service.yaml +++ b/charts/mailproxy/v0.1.0/templates/nginx-service.yaml @@ -14,4 +14,4 @@ spec: name: {{ $port.name }} {{- end }} selector: - {{- include "mailproxy.selectorLabels" . | nindent 4 }} + {{- include "mailproxy.nginx.selectorLabels" . | nindent 4 }}