diff --git a/helm/charts/nats/files/config-map.yaml b/helm/charts/nats/files/config-map.yaml index 89ee3c28..0c4eaf59 100644 --- a/helm/charts/nats/files/config-map.yaml +++ b/helm/charts/nats/files/config-map.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.configMap.name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} data: nats.conf: | {{- include "nats.formatConfig" .config | nindent 4 }} diff --git a/helm/charts/nats/files/headless-service.yaml b/helm/charts/nats/files/headless-service.yaml index da6552b3..24efa98f 100644 --- a/helm/charts/nats/files/headless-service.yaml +++ b/helm/charts/nats/files/headless-service.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.headlessService.name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} spec: selector: {{- include "nats.selectorLabels" $ | nindent 4 }} diff --git a/helm/charts/nats/files/ingress.yaml b/helm/charts/nats/files/ingress.yaml index b59f0fa5..df63458c 100644 --- a/helm/charts/nats/files/ingress.yaml +++ b/helm/charts/nats/files/ingress.yaml @@ -6,6 +6,8 @@ metadata: name: {{ .name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} spec: {{- with .className }} ingressClassName: {{ . | quote }} diff --git a/helm/charts/nats/files/nats-box/contents-secret.yaml b/helm/charts/nats/files/nats-box/contents-secret.yaml index 6e8fdb26..d3869ecf 100644 --- a/helm/charts/nats/files/nats-box/contents-secret.yaml +++ b/helm/charts/nats/files/nats-box/contents-secret.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.natsBox.contentsSecret.name }} labels: {{- include "natsBox.labels" $ | nindent 4 }} + annotations: + {{- include "natsBox.annotations" $ | nindent 4 }} type: Opaque stringData: {{- range $ctxKey, $ctxVal := .Values.natsBox.contexts }} diff --git a/helm/charts/nats/files/nats-box/contexts-secret/contexts-secret.yaml b/helm/charts/nats/files/nats-box/contexts-secret/contexts-secret.yaml index 0ce8d1d8..962198d3 100644 --- a/helm/charts/nats/files/nats-box/contexts-secret/contexts-secret.yaml +++ b/helm/charts/nats/files/nats-box/contexts-secret/contexts-secret.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.natsBox.contextsSecret.name }} labels: {{- include "natsBox.labels" $ | nindent 4 }} + annotations: + {{- include "natsBox.annotations" $ | nindent 4 }} type: Opaque stringData: {{- range $ctxKey, $ctxVal := .Values.natsBox.contexts }} diff --git a/helm/charts/nats/files/nats-box/deployment/deployment.yaml b/helm/charts/nats/files/nats-box/deployment/deployment.yaml index bf39dd8d..9c03e04c 100644 --- a/helm/charts/nats/files/nats-box/deployment/deployment.yaml +++ b/helm/charts/nats/files/nats-box/deployment/deployment.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.natsBox.deployment.name }} labels: {{- include "natsBox.labels" $ | nindent 4 }} + annotations: + {{- include "natsBox.annotations" $ | nindent 4 }} spec: selector: matchLabels: diff --git a/helm/charts/nats/files/nats-box/deployment/pod-template.yaml b/helm/charts/nats/files/nats-box/deployment/pod-template.yaml index 71056bfb..f7a0e781 100644 --- a/helm/charts/nats/files/nats-box/deployment/pod-template.yaml +++ b/helm/charts/nats/files/nats-box/deployment/pod-template.yaml @@ -1,6 +1,8 @@ metadata: labels: {{- include "natsBox.labels" $ | nindent 4 }} + annotations: + {{- include "natsBox.annotations" $ | nindent 4 }} spec: containers: {{- with .Values.natsBox.container }} diff --git a/helm/charts/nats/files/nats-box/service-account.yaml b/helm/charts/nats/files/nats-box/service-account.yaml index c31e52f1..86ea957d 100644 --- a/helm/charts/nats/files/nats-box/service-account.yaml +++ b/helm/charts/nats/files/nats-box/service-account.yaml @@ -5,3 +5,5 @@ metadata: name: {{ .Values.natsBox.serviceAccount.name }} labels: {{- include "natsBox.labels" $ | nindent 4 }} + annotations: + {{- include "natsBox.annotations" $ | nindent 4 }} diff --git a/helm/charts/nats/files/pod-disruption-budget.yaml b/helm/charts/nats/files/pod-disruption-budget.yaml index fd1fdead..488cac01 100644 --- a/helm/charts/nats/files/pod-disruption-budget.yaml +++ b/helm/charts/nats/files/pod-disruption-budget.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.podDisruptionBudget.name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} spec: maxUnavailable: 1 selector: diff --git a/helm/charts/nats/files/pod-monitor.yaml b/helm/charts/nats/files/pod-monitor.yaml index c6c8eae0..8e80620e 100644 --- a/helm/charts/nats/files/pod-monitor.yaml +++ b/helm/charts/nats/files/pod-monitor.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.promExporter.podMonitor.name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} spec: selector: matchLabels: diff --git a/helm/charts/nats/files/service-account.yaml b/helm/charts/nats/files/service-account.yaml index 22c18cc7..28d6fd50 100644 --- a/helm/charts/nats/files/service-account.yaml +++ b/helm/charts/nats/files/service-account.yaml @@ -5,3 +5,5 @@ metadata: name: {{ .Values.serviceAccount.name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} diff --git a/helm/charts/nats/files/service.yaml b/helm/charts/nats/files/service.yaml index db08fe5b..01d8025e 100644 --- a/helm/charts/nats/files/service.yaml +++ b/helm/charts/nats/files/service.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.service.name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} spec: selector: {{- include "nats.selectorLabels" $ | nindent 4 }} diff --git a/helm/charts/nats/files/stateful-set/pod-template.yaml b/helm/charts/nats/files/stateful-set/pod-template.yaml index bb1d8d7b..0ec14d22 100644 --- a/helm/charts/nats/files/stateful-set/pod-template.yaml +++ b/helm/charts/nats/files/stateful-set/pod-template.yaml @@ -2,6 +2,7 @@ metadata: labels: {{- include "nats.labels" $ | nindent 4 }} annotations: + {{- include "nats.annotations" $ | nindent 4 }} {{- if .Values.podTemplate.configChecksumAnnotation }} {{- $configMap := include "nats.loadMergePatch" (merge (dict "file" "config-map.yaml" "ctx" $) $.Values.configMap) }} checksum/config: {{ sha256sum $configMap }} diff --git a/helm/charts/nats/files/stateful-set/stateful-set.yaml b/helm/charts/nats/files/stateful-set/stateful-set.yaml index cd8082cb..7fb470e2 100644 --- a/helm/charts/nats/files/stateful-set/stateful-set.yaml +++ b/helm/charts/nats/files/stateful-set/stateful-set.yaml @@ -5,6 +5,8 @@ metadata: name: {{ .Values.statefulSet.name }} labels: {{- include "nats.labels" $ | nindent 4 }} + annotations: + {{- include "nats.annotations" $ | nindent 4 }} spec: selector: matchLabels: diff --git a/helm/charts/nats/templates/_helpers.tpl b/helm/charts/nats/templates/_helpers.tpl index ba831397..513d6dd7 100644 --- a/helm/charts/nats/templates/_helpers.tpl +++ b/helm/charts/nats/templates/_helpers.tpl @@ -143,6 +143,25 @@ app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: nats-box {{- end }} +{{/* +NATS annotations +*/}} +{{- define "nats.annotations" -}} +{{- with .Values.global.annotations -}} +{{ toYaml . }} +{{ end -}} +{{- end }} + + +{{/* +NATS Box annotations +*/}} +{{- define "natsBox.annotations" -}} +{{- with .Values.global.annotations -}} +{{ toYaml . }} +{{ end -}} +{{- end }} + {{/* Print the image */}} diff --git a/helm/charts/nats/values.yaml b/helm/charts/nats/values.yaml index 0d98f832..b0bfa630 100644 --- a/helm/charts/nats/values.yaml +++ b/helm/charts/nats/values.yaml @@ -17,6 +17,9 @@ global: # global labels will be applied to all resources deployed by the chart labels: {} + # global annotations will be applied to all resources deployed by the chart + annotations: {} + ################################################################################ # Common options ################################################################################