Skip to content

Commit

Permalink
Move common pod label definitions to helpers (#5179)
Browse files Browse the repository at this point in the history
move common pod label definitions to helpers
  • Loading branch information
oseoin authored Feb 28, 2024
1 parent 2b02d07 commit 630c19e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
15 changes: 15 additions & 0 deletions charts/nginx-ingress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Pod labels
*/}}
{{- define "nginx-ingress.podLabels" -}}
{{- include "nginx-ingress.selectorLabels" . }}
{{- if .Values.nginxServiceMesh.enable }}
nsm.nginx.com/enable-ingress: "true"
nsm.nginx.com/enable-egress: "{{ .Values.nginxServiceMesh.enableEgress }}"
nsm.nginx.com/{{ .Values.controller.kind }}: {{ include "nginx-ingress.controller.fullname" . }}
{{- end }}
{{- if .Values.controller.pod.extraLabels }}
{{ toYaml .Values.controller.pod.extraLabels }}
{{- end }}
{{- end }}

{{/*
Selector labels
*/}}
Expand Down
10 changes: 1 addition & 9 deletions charts/nginx-ingress/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ spec:
template:
metadata:
labels:
{{- include "nginx-ingress.selectorLabels" . | nindent 8 }}
{{- if .Values.nginxServiceMesh.enable }}
nsm.nginx.com/enable-ingress: "true"
nsm.nginx.com/enable-egress: "{{ .Values.nginxServiceMesh.enableEgress }}"
nsm.nginx.com/daemonset: {{ include "nginx-ingress.controller.fullname" . }}
{{- end }}
{{- if .Values.controller.pod.extraLabels }}
{{ toYaml .Values.controller.pod.extraLabels | indent 8 }}
{{- end }}
{{- include "nginx-ingress.podLabels" . | nindent 8 }}
{{- if or .Values.prometheus.create .Values.controller.pod.annotations }}
annotations:
{{- if .Values.prometheus.create }}
Expand Down
10 changes: 1 addition & 9 deletions charts/nginx-ingress/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ spec:
template:
metadata:
labels:
{{- include "nginx-ingress.selectorLabels" . | nindent 8 }}
{{- if .Values.nginxServiceMesh.enable }}
nsm.nginx.com/enable-ingress: "true"
nsm.nginx.com/enable-egress: "{{ .Values.nginxServiceMesh.enableEgress }}"
nsm.nginx.com/deployment: {{ include "nginx-ingress.controller.fullname" . }}
{{- end }}
{{- if .Values.controller.pod.extraLabels }}
{{ toYaml .Values.controller.pod.extraLabels | indent 8 }}
{{- end }}
{{- include "nginx-ingress.podLabels" . | nindent 8 }}
{{- if or .Values.prometheus.create .Values.controller.pod.annotations }}
annotations:
{{- if .Values.prometheus.create }}
Expand Down

0 comments on commit 630c19e

Please sign in to comment.