From 1906766002349be286d5a41725c176e027ceaa72 Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Fri, 8 Apr 2022 17:41:17 +0100 Subject: [PATCH] Fix Helm chart service labels Signed-off-by: Steve Hipwell --- .../templates/_helpers.tpl | 17 ++++++++++++++++- .../templates/daemonset.linux.yaml | 2 +- .../templates/daemonset.windows.yaml | 2 +- .../templates/deployment.yaml | 2 +- .../templates/service.yaml | 2 +- .../templates/servicemonitor.yaml | 2 +- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/config/helm/aws-node-termination-handler/templates/_helpers.tpl b/config/helm/aws-node-termination-handler/templates/_helpers.tpl index 45f06f4b..3513d2a9 100644 --- a/config/helm/aws-node-termination-handler/templates/_helpers.tpl +++ b/config/helm/aws-node-termination-handler/templates/_helpers.tpl @@ -48,7 +48,6 @@ Common labels {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} -app.kubernetes.io/component: {{ .Release.Name }} app.kubernetes.io/part-of: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} helm.sh/chart: {{ include "aws-node-termination-handler.chart" . }} @@ -57,6 +56,22 @@ helm.sh/chart: {{ include "aws-node-termination-handler.chart" . }} {{- end }} {{- end -}} +{{/* +Deployment labels +*/}} +{{- define "aws-node-termination-handler.labelsDeployment" -}} +{{ include "aws-node-termination-handler.labels" . }} +app.kubernetes.io/component: deployment +{{- end -}} + +{{/* +Daemonset labels +*/}} +{{- define "aws-node-termination-handler.labelsDaemonset" -}} +{{ include "aws-node-termination-handler.labels" . }} +app.kubernetes.io/component: daemonset +{{- end -}} + {{/* Selector labels */}} diff --git a/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml b/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml index 1e250e70..5fcac07e 100644 --- a/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml +++ b/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml @@ -5,7 +5,7 @@ metadata: name: {{ include "aws-node-termination-handler.fullname" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "aws-node-termination-handler.labels" . | nindent 4 }} + {{- include "aws-node-termination-handler.labelsDaemonset" . | nindent 4 }} spec: {{- with .Values.updateStrategy }} updateStrategy: diff --git a/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml b/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml index f4e2935e..f021db8b 100644 --- a/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml +++ b/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml @@ -5,7 +5,7 @@ metadata: name: {{ include "aws-node-termination-handler.fullnameWindows" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "aws-node-termination-handler.labels" . | nindent 4 }} + {{- include "aws-node-termination-handler.labelsDaemonset" . | nindent 4 }} spec: {{- with .Values.updateStrategy }} updateStrategy: diff --git a/config/helm/aws-node-termination-handler/templates/deployment.yaml b/config/helm/aws-node-termination-handler/templates/deployment.yaml index 0fdd2961..7887eae5 100644 --- a/config/helm/aws-node-termination-handler/templates/deployment.yaml +++ b/config/helm/aws-node-termination-handler/templates/deployment.yaml @@ -5,7 +5,7 @@ metadata: name: {{ include "aws-node-termination-handler.fullname" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "aws-node-termination-handler.labels" . | nindent 4 }} + {{- include "aws-node-termination-handler.labelsDeployment" . | nindent 4 }} spec: replicas: {{ .Values.replicas }} {{- with .Values.strategy }} diff --git a/config/helm/aws-node-termination-handler/templates/service.yaml b/config/helm/aws-node-termination-handler/templates/service.yaml index 1779749e..19f7b067 100644 --- a/config/helm/aws-node-termination-handler/templates/service.yaml +++ b/config/helm/aws-node-termination-handler/templates/service.yaml @@ -5,7 +5,7 @@ metadata: name: {{ include "aws-node-termination-handler.fullname" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "aws-node-termination-handler.labels" . | nindent 4 }} + {{- include "aws-node-termination-handler.labelsDeployment" . | nindent 4 }} spec: type: ClusterIP selector: diff --git a/config/helm/aws-node-termination-handler/templates/servicemonitor.yaml b/config/helm/aws-node-termination-handler/templates/servicemonitor.yaml index 06fcadcd..d5fe1479 100644 --- a/config/helm/aws-node-termination-handler/templates/servicemonitor.yaml +++ b/config/helm/aws-node-termination-handler/templates/servicemonitor.yaml @@ -25,5 +25,5 @@ spec: {{- end }} selector: matchLabels: - {{- include "aws-node-termination-handler.labels" . | nindent 6 }} + {{- include "aws-node-termination-handler.selectorLabelsDeployment" . | nindent 6 }} {{- end -}}