Skip to content

Commit

Permalink
Adding global annotation for all objects created by the eks,8s and k0…
Browse files Browse the repository at this point in the history
…s charts

Added annotation of all objects created by the eks,8s and k0s charts.

Signed-off-by: Kartik-Garg <[email protected]>
  • Loading branch information
Kartik-Garg committed Apr 12, 2023
1 parent 19dcb35 commit 98a3db2
Show file tree
Hide file tree
Showing 38 changed files with 138 additions and 29 deletions.
5 changes: 3 additions & 2 deletions charts/eks/templates/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/eks/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/eks/templates/coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down
5 changes: 3 additions & 2 deletions charts/eks/templates/daemonset-hostpath-mapper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/eks/templates/etcd-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions charts/eks/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/eks/templates/init-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/eks/templates/limitrange.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions charts/eks/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions charts/eks/templates/pre-install-hook-job-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions charts/eks/templates/pre-install-hook-job-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions charts/eks/templates/pre-install-hook-job-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions charts/eks/templates/pre-install-hook-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions charts/eks/templates/resourcequota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/eks/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/eks/templates/syncer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/eks/templates/workloadserviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/k0s/templates/coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down
5 changes: 3 additions & 2 deletions charts/k0s/templates/daemonset-hostpath-mapper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/k0s/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/k0s/templates/init-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/k0s/templates/limitrange.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions charts/k0s/templates/resourcequota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/k0s/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/k0s/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/k0s/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions charts/k0s/templates/workloadserviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/k8s/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions charts/k8s/templates/coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down
5 changes: 3 additions & 2 deletions charts/k8s/templates/daemonset-hostpath-mapper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/k8s/templates/etcd-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions charts/k8s/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 98a3db2

Please sign in to comment.