diff --git a/charts/prometheus-nginx-exporter/Chart.yaml b/charts/prometheus-nginx-exporter/Chart.yaml index e5a48e6775b7..90a1d88bd928 100644 --- a/charts/prometheus-nginx-exporter/Chart.yaml +++ b/charts/prometheus-nginx-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 description: A Helm chart for the Prometheus NGINX Exporter name: prometheus-nginx-exporter -version: 0.2.0 +version: 0.2.1 appVersion: 0.11.0 home: https://github.com/nginxinc/nginx-prometheus-exporter sources: diff --git a/charts/prometheus-nginx-exporter/templates/_helpers.tpl b/charts/prometheus-nginx-exporter/templates/_helpers.tpl index fda7fe09434a..08bf752c9fe2 100644 --- a/charts/prometheus-nginx-exporter/templates/_helpers.tpl +++ b/charts/prometheus-nginx-exporter/templates/_helpers.tpl @@ -77,3 +77,27 @@ Selector labels app.kubernetes.io/name: {{ include "prometheus-nginx-exporter.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{/* +Pod annotations +*/}} +{{- define "prometheus-nginx-exporter.podAnnotations" }} +{{- if .Values.additionalAnnotations }} +{{ toYaml .Values.additionalAnnotations }} +{{- end }} +{{- if .Values.podAnnotations }} +{{ toYaml .Values.podAnnotations }} +{{- end }} +{{- end }} + +{{/* +Service annotations +*/}} +{{- define "prometheus-nginx-exporter.serviceAnnotations" }} +{{- if .Values.additionalAnnotations }} +{{ toYaml .Values.additionalAnnotations }} +{{- end }} +{{- if .Values.service.annotations }} +{{ toYaml .Values.service.annotations }} +{{- end }} +{{- end }} diff --git a/charts/prometheus-nginx-exporter/templates/deployment.yaml b/charts/prometheus-nginx-exporter/templates/deployment.yaml index 0936368ced2a..1ae04acca18b 100644 --- a/charts/prometheus-nginx-exporter/templates/deployment.yaml +++ b/charts/prometheus-nginx-exporter/templates/deployment.yaml @@ -5,8 +5,7 @@ metadata: name: {{ include "prometheus-nginx-exporter.fullname" . }} namespace: {{ template "prometheus-nginx-exporter.namespace" . }} {{- with .Values.additionalAnnotations }} - annotations: - {{ toYaml . | indent 4 }} + annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: {{- include "prometheus-nginx-exporter.labels" . | indent 4 }} @@ -24,9 +23,9 @@ spec: metadata: labels: {{- include "prometheus-nginx-exporter.labels" . | indent 8 }} + {{- if or .Values.additionalAnnotations .Values.podAnnotations }} annotations: - {{- with .Values.additionalAnnotations }} - {{ toYaml . | indent 6 }} + {{- include "prometheus-nginx-exporter.podAnnotations" . | indent 8 }} {{- end }} spec: serviceAccountName: {{ template "prometheus-nginx-exporter.serviceAccountName" . }} diff --git a/charts/prometheus-nginx-exporter/templates/role.yaml b/charts/prometheus-nginx-exporter/templates/role.yaml index 0526dfeec286..3f8c9e6c1c9c 100644 --- a/charts/prometheus-nginx-exporter/templates/role.yaml +++ b/charts/prometheus-nginx-exporter/templates/role.yaml @@ -5,9 +5,8 @@ apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ template "prometheus-nginx-exporter.fullname" . }} namespace: {{ template "prometheus-nginx-exporter.namespace" . }} - {{- if .Values.additionalAnnotations }} - annotations: - {{ toYaml .Values.additionalAnnotations | indent 4 }} + {{- with .Values.additionalAnnotations }} + annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: {{- include "prometheus-nginx-exporter.labels" . | indent 4 }} diff --git a/charts/prometheus-nginx-exporter/templates/rolebinding.yaml b/charts/prometheus-nginx-exporter/templates/rolebinding.yaml index c92b805cf731..64a3c03b00ee 100644 --- a/charts/prometheus-nginx-exporter/templates/rolebinding.yaml +++ b/charts/prometheus-nginx-exporter/templates/rolebinding.yaml @@ -5,9 +5,8 @@ apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ template "prometheus-nginx-exporter.fullname" . }} namespace: {{ template "prometheus-nginx-exporter.namespace" . }} - {{- if .Values.additionalAnnotations }} - annotations: - {{ toYaml .Values.additionalAnnotations | indent 4 }} + {{- with .Values.additionalAnnotations }} + annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: {{- include "prometheus-nginx-exporter.labels" . | indent 4 }} diff --git a/charts/prometheus-nginx-exporter/templates/service.yaml b/charts/prometheus-nginx-exporter/templates/service.yaml index 7705cf4f79a9..5903ec4b39a4 100644 --- a/charts/prometheus-nginx-exporter/templates/service.yaml +++ b/charts/prometheus-nginx-exporter/templates/service.yaml @@ -4,12 +4,9 @@ kind: Service metadata: name: {{ include "prometheus-nginx-exporter.fullname" . }} namespace: {{ template "prometheus-nginx-exporter.namespace" . }} - {{- if or .Values.service.annotations .Values.additionalAnnotations }} + {{- if or .Values.additionalAnnotations .Values.service.annotations }} annotations: - {{ toYaml .Values.service.annotations | indent 4 }} - {{- with .Values.additionalAnnotations }} - {{ toYaml . | indent 4 }} - {{- end }} + {{- include "prometheus-nginx-exporter.serviceAnnotations" . | indent 4 }} {{- end }} labels: {{- include "prometheus-nginx-exporter.labels" . | indent 4 }} diff --git a/charts/prometheus-nginx-exporter/templates/serviceaccount.yaml b/charts/prometheus-nginx-exporter/templates/serviceaccount.yaml index 9119fb55d77f..740ad19e2585 100644 --- a/charts/prometheus-nginx-exporter/templates/serviceaccount.yaml +++ b/charts/prometheus-nginx-exporter/templates/serviceaccount.yaml @@ -3,9 +3,8 @@ apiVersion: v1 kind: ServiceAccount metadata: - {{- if .Values.additionalAnnotations }} - annotations: - {{ toYaml .Values.additionalAnnotations | indent 4 }} + {{- with .Values.additionalAnnotations }} + annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: {{- include "prometheus-nginx-exporter.labels" . | indent 4 }} diff --git a/charts/prometheus-nginx-exporter/templates/servicemonitor.yaml b/charts/prometheus-nginx-exporter/templates/servicemonitor.yaml index fc6ee51b2834..a8e60960e505 100644 --- a/charts/prometheus-nginx-exporter/templates/servicemonitor.yaml +++ b/charts/prometheus-nginx-exporter/templates/servicemonitor.yaml @@ -5,9 +5,8 @@ kind: ServiceMonitor metadata: name: {{ template "prometheus-nginx-exporter.fullname" . }} namespace: {{ template "prometheus-nginx-exporter.namespace" . }} - {{- if .Values.additionalAnnotations }} - annotations: - {{ toYaml .Values.additionalAnnotations | indent 4 }} + {{- with .Values.additionalAnnotations }} + annotations: {{ toYaml . | nindent 4 }} {{- end }} labels: {{- include "prometheus-nginx-exporter.labels" . | indent 4 }}