Skip to content

Commit

Permalink
helm: improve labels and selector labels set on the DaemonSet
Browse files Browse the repository at this point in the history
Improve the usage of labels and selector logic in accordance with
Helm best practices for Balloons and TA plugins.

Signed-off-by: Feruzjon Muyassarov <[email protected]>
  • Loading branch information
fmuyassarov authored and klihub committed Oct 5, 2023
1 parent 325cfbf commit abafe68
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
spec:
selector:
matchLabels:
{{- include "balloons-plugin.labels" . | nindent 6 }}
{{- include "balloons-plugin.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit abafe68

Please sign in to comment.