From 98a3db2fb3492f168ccab5a15bdead5d393fecaf Mon Sep 17 00:00:00 2001 From: Kartik-Garg Date: Wed, 12 Apr 2023 10:43:19 +0530 Subject: [PATCH] Adding global annotation for all objects created by the eks,8s and k0s charts Added annotation of all objects created by the eks,8s and k0s charts. Signed-off-by: Kartik-Garg --- charts/eks/templates/api-deployment.yaml | 5 +++-- charts/eks/templates/controller-deployment.yaml | 5 +++-- charts/eks/templates/coredns.yaml | 4 ++++ charts/eks/templates/daemonset-hostpath-mapper.yaml | 5 +++-- charts/eks/templates/etcd-statefulset.yaml | 5 +++-- charts/eks/templates/ingress.yaml | 5 +++-- charts/eks/templates/init-configmap.yaml | 4 ++++ charts/eks/templates/limitrange.yaml | 4 ++++ charts/eks/templates/networkpolicy.yaml | 8 ++++++++ charts/eks/templates/pre-install-hook-job-role.yaml | 3 +++ .../eks/templates/pre-install-hook-job-rolebinding.yaml | 3 +++ .../templates/pre-install-hook-job-serviceaccount.yaml | 3 +++ charts/eks/templates/pre-install-hook-job.yaml | 3 +++ charts/eks/templates/resourcequota.yaml | 4 ++++ charts/eks/templates/serviceaccount.yaml | 4 ++++ charts/eks/templates/syncer-deployment.yaml | 5 +++-- charts/eks/templates/workloadserviceaccount.yaml | 4 ++++ charts/k0s/templates/coredns.yaml | 4 ++++ charts/k0s/templates/daemonset-hostpath-mapper.yaml | 5 +++-- charts/k0s/templates/ingress.yaml | 5 +++-- charts/k0s/templates/init-configmap.yaml | 4 ++++ charts/k0s/templates/limitrange.yaml | 4 ++++ charts/k0s/templates/resourcequota.yaml | 4 ++++ charts/k0s/templates/secret.yaml | 4 ++++ charts/k0s/templates/serviceaccount.yaml | 4 ++++ charts/k0s/templates/statefulset.yaml | 5 +++-- charts/k0s/templates/workloadserviceaccount.yaml | 4 ++++ charts/k8s/templates/controller-deployment.yaml | 5 +++-- charts/k8s/templates/coredns.yaml | 4 ++++ charts/k8s/templates/daemonset-hostpath-mapper.yaml | 5 +++-- charts/k8s/templates/etcd-statefulset.yaml | 5 +++-- charts/k8s/templates/ingress.yaml | 6 +++--- charts/k8s/templates/init-configmap.yaml | 4 ++++ charts/k8s/templates/limitrange.yaml | 4 ++++ charts/k8s/templates/resourcequota.yaml | 4 ++++ charts/k8s/templates/serviceaccount.yaml | 4 ++++ charts/k8s/templates/syncer-deployment.yaml | 5 +++-- charts/k8s/templates/workloadserviceaccount.yaml | 4 ++++ 38 files changed, 138 insertions(+), 29 deletions(-) diff --git a/charts/eks/templates/api-deployment.yaml b/charts/eks/templates/api-deployment.yaml index aefc6b450e..bc66d2bca2 100644 --- a/charts/eks/templates/api-deployment.yaml +++ b/charts/eks/templates/api-deployment.yaml @@ -12,9 +12,10 @@ metadata: {{- if .Values.api.labels }} {{ toYaml .Values.api.labels | indent 4 }} {{- end }} - {{- if .Values.api.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.api.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.api.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: replicas: {{ .Values.api.replicas }} diff --git a/charts/eks/templates/controller-deployment.yaml b/charts/eks/templates/controller-deployment.yaml index b952b35fae..a6771d71ca 100644 --- a/charts/eks/templates/controller-deployment.yaml +++ b/charts/eks/templates/controller-deployment.yaml @@ -12,9 +12,10 @@ metadata: {{- if .Values.controller.labels }} {{ toYaml .Values.controller.labels | indent 4 }} {{- end }} - {{- if .Values.controller.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.controller.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.controller.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: replicas: {{ .Values.controller.replicas }} diff --git a/charts/eks/templates/coredns.yaml b/charts/eks/templates/coredns.yaml index 24430777bf..4a72e7f9f7 100644 --- a/charts/eks/templates/coredns.yaml +++ b/charts/eks/templates/coredns.yaml @@ -3,6 +3,10 @@ kind: ConfigMap metadata: name: custom-deployments namespace: {{ .Release.Namespace }} + {{- if .Values.globalAnnotations}} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4}} + {{- end}} data: {{- if .Values.coredns.manifests }} coredns.yaml: |- diff --git a/charts/eks/templates/daemonset-hostpath-mapper.yaml b/charts/eks/templates/daemonset-hostpath-mapper.yaml index 78b7a89d46..11e22e5cb6 100644 --- a/charts/eks/templates/daemonset-hostpath-mapper.yaml +++ b/charts/eks/templates/daemonset-hostpath-mapper.yaml @@ -17,9 +17,10 @@ metadata: {{- if .Values.labels }} {{ toYaml .Values.labels | indent 4 }} {{- end }} - {{- if .Values.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: {{- if .Values.hostpathMapper.dev }} diff --git a/charts/eks/templates/etcd-statefulset.yaml b/charts/eks/templates/etcd-statefulset.yaml index f7eff5c54c..ee35d3937c 100644 --- a/charts/eks/templates/etcd-statefulset.yaml +++ b/charts/eks/templates/etcd-statefulset.yaml @@ -12,9 +12,10 @@ metadata: {{- if .Values.etcd.labels }} {{ toYaml .Values.etcd.labels | indent 4 }} {{- end }} - {{- if .Values.etcd.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.etcd.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.etcd.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: serviceName: {{ .Release.Name }}-etcd-headless diff --git a/charts/eks/templates/ingress.yaml b/charts/eks/templates/ingress.yaml index 0705358bb2..3c833d5ced 100644 --- a/charts/eks/templates/ingress.yaml +++ b/charts/eks/templates/ingress.yaml @@ -2,9 +2,10 @@ apiVersion: {{ .Values.ingress.apiVersion }} kind: Ingress metadata: - {{- if .Values.ingress.annotations }} +{{- $annotations := merge .Values.ingress.annotations .Values.globalAnnotations }} + {{- if $annotations }} annotations: - {{- toYaml .Values.ingress.annotations | nindent 4 }} + {{- toYaml $annotations | nindent 4 }} {{- end }} name: {{ .Release.Name }} namespace: {{ .Release.Namespace }} diff --git a/charts/eks/templates/init-configmap.yaml b/charts/eks/templates/init-configmap.yaml index d68a13a4e0..9f89a6bb93 100644 --- a/charts/eks/templates/init-configmap.yaml +++ b/charts/eks/templates/init-configmap.yaml @@ -9,6 +9,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations}} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} data: manifests: |- {{ .Values.init.manifests | nindent 4 | trim }} diff --git a/charts/eks/templates/limitrange.yaml b/charts/eks/templates/limitrange.yaml index 235f2cd3ea..ed219d0631 100644 --- a/charts/eks/templates/limitrange.yaml +++ b/charts/eks/templates/limitrange.yaml @@ -4,6 +4,10 @@ kind: LimitRange metadata: name: {{ .Release.Name }}-limit-range namespace: {{ .Values.isolation.namespace | default .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: limits: - default: diff --git a/charts/eks/templates/networkpolicy.yaml b/charts/eks/templates/networkpolicy.yaml index c932065e05..81886898b7 100644 --- a/charts/eks/templates/networkpolicy.yaml +++ b/charts/eks/templates/networkpolicy.yaml @@ -4,6 +4,10 @@ kind: NetworkPolicy metadata: name: {{ .Release.Name }}-workloads namespace: {{ .Values.isolation.namespace | default .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: podSelector: matchLabels: @@ -43,6 +47,10 @@ kind: NetworkPolicy metadata: name: {{ .Release.Name }}-control-plane namespace: {{ .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: podSelector: matchLabels: diff --git a/charts/eks/templates/pre-install-hook-job-role.yaml b/charts/eks/templates/pre-install-hook-job-role.yaml index d7fbf05a52..d865b491a3 100644 --- a/charts/eks/templates/pre-install-hook-job-role.yaml +++ b/charts/eks/templates/pre-install-hook-job-role.yaml @@ -4,7 +4,10 @@ apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ .Release.Name }}-job namespace: {{ .Release.Namespace }} + {{- if .Values.globalAnnotations }} annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} "helm.sh/hook": pre-install "helm.sh/hook-weight": "3" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded diff --git a/charts/eks/templates/pre-install-hook-job-rolebinding.yaml b/charts/eks/templates/pre-install-hook-job-rolebinding.yaml index 795957131f..d820e28f92 100644 --- a/charts/eks/templates/pre-install-hook-job-rolebinding.yaml +++ b/charts/eks/templates/pre-install-hook-job-rolebinding.yaml @@ -4,7 +4,10 @@ apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ .Release.Name }}-job namespace: {{ .Release.Namespace }} + {{- if .Values.globalAnnotations}} annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} "helm.sh/hook": pre-install "helm.sh/hook-weight": "3" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded diff --git a/charts/eks/templates/pre-install-hook-job-serviceaccount.yaml b/charts/eks/templates/pre-install-hook-job-serviceaccount.yaml index e32d53c4be..c1dd475587 100644 --- a/charts/eks/templates/pre-install-hook-job-serviceaccount.yaml +++ b/charts/eks/templates/pre-install-hook-job-serviceaccount.yaml @@ -4,7 +4,10 @@ kind: ServiceAccount metadata: name: {{ .Release.Name }}-job namespace: {{ .Release.Namespace }} +{{- if .Values.globalAnnotations}} annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} "helm.sh/hook": pre-install "helm.sh/hook-weight": "3" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded diff --git a/charts/eks/templates/pre-install-hook-job.yaml b/charts/eks/templates/pre-install-hook-job.yaml index 84716740ed..44f4f59fa3 100644 --- a/charts/eks/templates/pre-install-hook-job.yaml +++ b/charts/eks/templates/pre-install-hook-job.yaml @@ -4,7 +4,10 @@ kind: Job metadata: name: {{ .Release.Name }}-job namespace: {{ .Release.Namespace }} +{{- if .Values.globalAnnotations}} annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} "helm.sh/hook": pre-install "helm.sh/hook-weight": "3" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded diff --git a/charts/eks/templates/resourcequota.yaml b/charts/eks/templates/resourcequota.yaml index 21994fb150..b19d89fff0 100644 --- a/charts/eks/templates/resourcequota.yaml +++ b/charts/eks/templates/resourcequota.yaml @@ -4,6 +4,10 @@ kind: ResourceQuota metadata: name: {{ .Release.Name }}-quota namespace: {{ .Values.isolation.namespace | default .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: hard: {{- range $key, $val := .Values.isolation.resourceQuota.quota }} diff --git a/charts/eks/templates/serviceaccount.yaml b/charts/eks/templates/serviceaccount.yaml index 14a522afe7..504998037b 100644 --- a/charts/eks/templates/serviceaccount.yaml +++ b/charts/eks/templates/serviceaccount.yaml @@ -9,6 +9,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} {{- if .Values.serviceAccount.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }} diff --git a/charts/eks/templates/syncer-deployment.yaml b/charts/eks/templates/syncer-deployment.yaml index a742c049b4..cecde63c5b 100644 --- a/charts/eks/templates/syncer-deployment.yaml +++ b/charts/eks/templates/syncer-deployment.yaml @@ -11,9 +11,10 @@ metadata: {{- if .Values.syncer.labels }} {{ toYaml .Values.syncer.labels | indent 4 }} {{- end }} - {{- if .Values.syncer.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.syncer.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.syncer.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: replicas: {{ .Values.syncer.replicas }} diff --git a/charts/eks/templates/workloadserviceaccount.yaml b/charts/eks/templates/workloadserviceaccount.yaml index 0afaeb9076..ce0e3d03ef 100644 --- a/charts/eks/templates/workloadserviceaccount.yaml +++ b/charts/eks/templates/workloadserviceaccount.yaml @@ -8,6 +8,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} {{- if .Values.serviceAccount.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }} diff --git a/charts/k0s/templates/coredns.yaml b/charts/k0s/templates/coredns.yaml index 29b9c03fc9..c39add846b 100644 --- a/charts/k0s/templates/coredns.yaml +++ b/charts/k0s/templates/coredns.yaml @@ -4,6 +4,10 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-coredns namespace: {{ .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} data: {{- if .Values.coredns.manifests }} coredns.yaml: |- diff --git a/charts/k0s/templates/daemonset-hostpath-mapper.yaml b/charts/k0s/templates/daemonset-hostpath-mapper.yaml index 78b7a89d46..11e22e5cb6 100644 --- a/charts/k0s/templates/daemonset-hostpath-mapper.yaml +++ b/charts/k0s/templates/daemonset-hostpath-mapper.yaml @@ -17,9 +17,10 @@ metadata: {{- if .Values.labels }} {{ toYaml .Values.labels | indent 4 }} {{- end }} - {{- if .Values.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: {{- if .Values.hostpathMapper.dev }} diff --git a/charts/k0s/templates/ingress.yaml b/charts/k0s/templates/ingress.yaml index 0705358bb2..b47f2b8e07 100644 --- a/charts/k0s/templates/ingress.yaml +++ b/charts/k0s/templates/ingress.yaml @@ -2,9 +2,10 @@ apiVersion: {{ .Values.ingress.apiVersion }} kind: Ingress metadata: - {{- if .Values.ingress.annotations }} + {{- $annotations := merge .Values.ingress.annotations .Values.globalAnnotations }} + {{- if $annotations }} annotations: - {{- toYaml .Values.ingress.annotations | nindent 4 }} + {{- toYaml $annotations | nindent 4 }} {{- end }} name: {{ .Release.Name }} namespace: {{ .Release.Namespace }} diff --git a/charts/k0s/templates/init-configmap.yaml b/charts/k0s/templates/init-configmap.yaml index d68a13a4e0..f80f74c2c1 100644 --- a/charts/k0s/templates/init-configmap.yaml +++ b/charts/k0s/templates/init-configmap.yaml @@ -9,6 +9,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} data: manifests: |- {{ .Values.init.manifests | nindent 4 | trim }} diff --git a/charts/k0s/templates/limitrange.yaml b/charts/k0s/templates/limitrange.yaml index 235f2cd3ea..ed219d0631 100644 --- a/charts/k0s/templates/limitrange.yaml +++ b/charts/k0s/templates/limitrange.yaml @@ -4,6 +4,10 @@ kind: LimitRange metadata: name: {{ .Release.Name }}-limit-range namespace: {{ .Values.isolation.namespace | default .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: limits: - default: diff --git a/charts/k0s/templates/resourcequota.yaml b/charts/k0s/templates/resourcequota.yaml index 21994fb150..b19d89fff0 100644 --- a/charts/k0s/templates/resourcequota.yaml +++ b/charts/k0s/templates/resourcequota.yaml @@ -4,6 +4,10 @@ kind: ResourceQuota metadata: name: {{ .Release.Name }}-quota namespace: {{ .Values.isolation.namespace | default .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: hard: {{- range $key, $val := .Values.isolation.resourceQuota.quota }} diff --git a/charts/k0s/templates/secret.yaml b/charts/k0s/templates/secret.yaml index 7d81cbb052..b01920fffa 100644 --- a/charts/k0s/templates/secret.yaml +++ b/charts/k0s/templates/secret.yaml @@ -8,6 +8,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations}} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} type: Opaque stringData: {{- if .Values.serviceCIDR }} diff --git a/charts/k0s/templates/serviceaccount.yaml b/charts/k0s/templates/serviceaccount.yaml index 14a522afe7..504998037b 100644 --- a/charts/k0s/templates/serviceaccount.yaml +++ b/charts/k0s/templates/serviceaccount.yaml @@ -9,6 +9,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} {{- if .Values.serviceAccount.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }} diff --git a/charts/k0s/templates/statefulset.yaml b/charts/k0s/templates/statefulset.yaml index d1233a1fae..2eb8b4f7ef 100644 --- a/charts/k0s/templates/statefulset.yaml +++ b/charts/k0s/templates/statefulset.yaml @@ -11,9 +11,10 @@ metadata: {{- if .Values.labels }} {{ toYaml .Values.labels | indent 4 }} {{- end }} - {{- if .Values.annotations }} +{{- $annotations := merge .Values.annotations .Values.globalAnnotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: serviceName: {{ .Release.Name }}-headless diff --git a/charts/k0s/templates/workloadserviceaccount.yaml b/charts/k0s/templates/workloadserviceaccount.yaml index 0afaeb9076..ce0e3d03ef 100644 --- a/charts/k0s/templates/workloadserviceaccount.yaml +++ b/charts/k0s/templates/workloadserviceaccount.yaml @@ -8,6 +8,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} {{- if .Values.serviceAccount.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }} diff --git a/charts/k8s/templates/controller-deployment.yaml b/charts/k8s/templates/controller-deployment.yaml index 72ea49c859..04ff10a70e 100644 --- a/charts/k8s/templates/controller-deployment.yaml +++ b/charts/k8s/templates/controller-deployment.yaml @@ -12,9 +12,10 @@ metadata: {{- if .Values.controller.labels }} {{ toYaml .Values.controller.labels | indent 4 }} {{- end }} - {{- if .Values.controller.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.controller.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.controller.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: replicas: {{ .Values.controller.replicas }} diff --git a/charts/k8s/templates/coredns.yaml b/charts/k8s/templates/coredns.yaml index dc5085bd24..c66eaefc43 100644 --- a/charts/k8s/templates/coredns.yaml +++ b/charts/k8s/templates/coredns.yaml @@ -4,6 +4,10 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-coredns namespace: {{ .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} data: {{- if .Values.coredns.manifests }} coredns.yaml: |- diff --git a/charts/k8s/templates/daemonset-hostpath-mapper.yaml b/charts/k8s/templates/daemonset-hostpath-mapper.yaml index 78b7a89d46..11e22e5cb6 100644 --- a/charts/k8s/templates/daemonset-hostpath-mapper.yaml +++ b/charts/k8s/templates/daemonset-hostpath-mapper.yaml @@ -17,9 +17,10 @@ metadata: {{- if .Values.labels }} {{ toYaml .Values.labels | indent 4 }} {{- end }} - {{- if .Values.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: {{- if .Values.hostpathMapper.dev }} diff --git a/charts/k8s/templates/etcd-statefulset.yaml b/charts/k8s/templates/etcd-statefulset.yaml index b4709389a3..d053120bf4 100644 --- a/charts/k8s/templates/etcd-statefulset.yaml +++ b/charts/k8s/templates/etcd-statefulset.yaml @@ -12,9 +12,10 @@ metadata: {{- if .Values.etcd.labels }} {{ toYaml .Values.etcd.labels | indent 4 }} {{- end }} - {{- if .Values.etcd.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.etcd.annotations }} + {{- if $annotations }} annotations: -{{ toYaml .Values.etcd.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: serviceName: {{ .Release.Name }}-etcd-headless diff --git a/charts/k8s/templates/ingress.yaml b/charts/k8s/templates/ingress.yaml index 0705358bb2..de19e4652a 100644 --- a/charts/k8s/templates/ingress.yaml +++ b/charts/k8s/templates/ingress.yaml @@ -2,10 +2,10 @@ apiVersion: {{ .Values.ingress.apiVersion }} kind: Ingress metadata: - {{- if .Values.ingress.annotations }} + {{- $annotations := merge .Values.ingress.annotations .Values.globalAnnotations }} + {{- if $annotations }} annotations: - {{- toYaml .Values.ingress.annotations | nindent 4 }} - {{- end }} + {{- toYaml $annotations | nindent 4 }} name: {{ .Release.Name }} namespace: {{ .Release.Namespace }} spec: diff --git a/charts/k8s/templates/init-configmap.yaml b/charts/k8s/templates/init-configmap.yaml index d68a13a4e0..f80f74c2c1 100644 --- a/charts/k8s/templates/init-configmap.yaml +++ b/charts/k8s/templates/init-configmap.yaml @@ -9,6 +9,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} data: manifests: |- {{ .Values.init.manifests | nindent 4 | trim }} diff --git a/charts/k8s/templates/limitrange.yaml b/charts/k8s/templates/limitrange.yaml index 235f2cd3ea..ed219d0631 100644 --- a/charts/k8s/templates/limitrange.yaml +++ b/charts/k8s/templates/limitrange.yaml @@ -4,6 +4,10 @@ kind: LimitRange metadata: name: {{ .Release.Name }}-limit-range namespace: {{ .Values.isolation.namespace | default .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: limits: - default: diff --git a/charts/k8s/templates/resourcequota.yaml b/charts/k8s/templates/resourcequota.yaml index 21994fb150..b19d89fff0 100644 --- a/charts/k8s/templates/resourcequota.yaml +++ b/charts/k8s/templates/resourcequota.yaml @@ -4,6 +4,10 @@ kind: ResourceQuota metadata: name: {{ .Release.Name }}-quota namespace: {{ .Values.isolation.namespace | default .Release.Namespace }} + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} spec: hard: {{- range $key, $val := .Values.isolation.resourceQuota.quota }} diff --git a/charts/k8s/templates/serviceaccount.yaml b/charts/k8s/templates/serviceaccount.yaml index 14a522afe7..504998037b 100644 --- a/charts/k8s/templates/serviceaccount.yaml +++ b/charts/k8s/templates/serviceaccount.yaml @@ -9,6 +9,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} {{- if .Values.serviceAccount.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }} diff --git a/charts/k8s/templates/syncer-deployment.yaml b/charts/k8s/templates/syncer-deployment.yaml index 5431da81dc..d2fa6c361b 100644 --- a/charts/k8s/templates/syncer-deployment.yaml +++ b/charts/k8s/templates/syncer-deployment.yaml @@ -11,9 +11,10 @@ metadata: {{- if .Values.syncer.labels }} {{ toYaml .Values.syncer.labels | indent 4 }} {{- end }} - {{- if .Values.syncer.annotations }} + {{- $annotations := merge .Values.globalAnnotations .Values.syncer.annotations }} + {{- if $annotations}} annotations: -{{ toYaml .Values.syncer.annotations | indent 4 }} +{{ toYaml $annotations | indent 4 }} {{- end }} spec: replicas: {{ .Values.syncer.replicas }} diff --git a/charts/k8s/templates/workloadserviceaccount.yaml b/charts/k8s/templates/workloadserviceaccount.yaml index 0afaeb9076..ce0e3d03ef 100644 --- a/charts/k8s/templates/workloadserviceaccount.yaml +++ b/charts/k8s/templates/workloadserviceaccount.yaml @@ -8,6 +8,10 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" + {{- if .Values.globalAnnotations }} + annotations: +{{ toYaml .Values.globalAnnotations | indent 4 }} + {{- end }} {{- if .Values.serviceAccount.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }}