From 1c3b0cfb8afb28b9565732b87efb8af46c54ee83 Mon Sep 17 00:00:00 2001 From: Feruzjon Muyassarov Date: Thu, 5 Oct 2023 10:16:11 +0300 Subject: [PATCH] helm: improve labels and selector labels set on the DaemonSet Improve the usage of labels and selector logic in accordance with Helm best practices for Balloons and TA plugins. Signed-off-by: Feruzjon Muyassarov --- .../balloons/templates/_helpers.tpl | 12 ++++++++++-- .../balloons/templates/daemonset.yaml | 2 +- .../topology-aware/templates/_helpers.tpl | 12 ++++++++++-- .../topology-aware/templates/daemonset.yaml | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl b/deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl index 35112e696..d720dae84 100644 --- a/deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl +++ b/deployment/helm/resource-management-policies/balloons/templates/_helpers.tpl @@ -2,7 +2,15 @@ Common labels */}} {{- define "balloons-plugin.labels" -}} -app: nri-resource-policy-balloons -app.kubernetes.io/instance: {{ .Release.Name }} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} app.kubernetes.io/managed-by: {{ .Release.Service }} +{{ include "balloons-plugin.selectorLabels" . }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "balloons-plugin.selectorLabels" -}} +app.kubernetes.io/name: nri-resource-policy-balloons +app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} diff --git a/deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml b/deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml index 33133bdd6..e0410387d 100644 --- a/deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml +++ b/deployment/helm/resource-management-policies/balloons/templates/daemonset.yaml @@ -8,7 +8,7 @@ metadata: spec: selector: matchLabels: - {{- include "balloons-plugin.labels" . | nindent 6 }} + {{- include "balloons-plugin.selectorLabels" . | nindent 6 }} template: metadata: labels: diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl b/deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl index f2d584abd..f5307f872 100644 --- a/deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl +++ b/deployment/helm/resource-management-policies/topology-aware/templates/_helpers.tpl @@ -2,7 +2,15 @@ Common labels */}} {{- define "topology-aware-plugin.labels" -}} -app: nri-resource-policy-topology-aware -app.kubernetes.io/instance: {{ .Release.Name }} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} app.kubernetes.io/managed-by: {{ .Release.Service }} +{{ include "topology-aware-plugin.selectorLabels" . }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "topology-aware-plugin.selectorLabels" -}} +app.kubernetes.io/name: nri-resource-policy-topology-aware +app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} diff --git a/deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml b/deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml index 467655acc..db1abb531 100644 --- a/deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml +++ b/deployment/helm/resource-management-policies/topology-aware/templates/daemonset.yaml @@ -8,7 +8,7 @@ metadata: spec: selector: matchLabels: - {{- include "topology-aware-plugin.labels" . | nindent 6 }} + {{- include "topology-aware-plugin.selectorLabels" . | nindent 6 }} template: metadata: labels: