From 037da7e41fb21a910d8b4891ea1f061c821a9ba3 Mon Sep 17 00:00:00 2001 From: Semih Buyukgungor Date: Wed, 18 Oct 2023 13:25:05 +0300 Subject: [PATCH] [CN-993] Common label and annotation parameters for all deployed objects (#388) * common labels and annotations * apply the same changes on enterprise chart * bump chart versions * set merge destination map to nil * common labels and annotations under template definitions * bump chart versions --- stable/hazelcast-enterprise/Chart.yaml | 2 +- .../templates/config.yaml | 9 ++++++ .../templates/mancenter-config.yaml | 9 ++++++ .../templates/mancenter-ingress.yaml | 11 +++++-- .../templates/mancenter-service.yaml | 8 ++++- .../templates/mancenter-statefulset.yaml | 29 +++++++++++++++---- .../templates/metrics-service.yaml | 9 +++++- .../templates/poddisruptionbudget.yaml | 9 ++++++ .../templates/prometheusrule.yaml | 8 ++++- .../hazelcast-enterprise/templates/role.yaml | 9 ++++++ .../templates/rolebinding.yaml | 9 ++++++ .../templates/service-external.yaml | 10 ++++--- .../templates/service.yaml | 8 ++++- .../templates/serviceaccount.yaml | 9 ++++++ .../templates/servicemonitor.yaml | 8 ++++- .../templates/statefulset.yaml | 25 +++++++++++----- stable/hazelcast-enterprise/values.yaml | 6 ++++ stable/hazelcast/Chart.yaml | 2 +- stable/hazelcast/templates/config.yaml | 9 ++++++ .../hazelcast/templates/mancenter-config.yaml | 9 ++++++ .../templates/mancenter-ingress.yaml | 11 +++++-- .../templates/mancenter-service.yaml | 8 ++++- .../templates/mancenter-statefulset.yaml | 29 +++++++++++++++---- .../hazelcast/templates/metrics-service.yaml | 9 +++++- .../templates/poddisruptionbudget.yaml | 9 ++++++ .../hazelcast/templates/prometheusrule.yaml | 8 ++++- stable/hazelcast/templates/role.yaml | 9 ++++++ stable/hazelcast/templates/rolebinding.yaml | 9 ++++++ .../hazelcast/templates/service-external.yaml | 10 ++++--- stable/hazelcast/templates/service.yaml | 8 ++++- .../hazelcast/templates/serviceaccount.yaml | 9 ++++++ .../hazelcast/templates/servicemonitor.yaml | 8 ++++- stable/hazelcast/templates/statefulset.yaml | 16 +++++----- stable/hazelcast/values.yaml | 6 ++++ 34 files changed, 297 insertions(+), 50 deletions(-) diff --git a/stable/hazelcast-enterprise/Chart.yaml b/stable/hazelcast-enterprise/Chart.yaml index df2b1a97..a359b230 100644 --- a/stable/hazelcast-enterprise/Chart.yaml +++ b/stable/hazelcast-enterprise/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: hazelcast-enterprise -version: 5.10.6 +version: 5.10.7 appVersion: "5.3.2" kubeVersion: ">=1.19.0-0" description: Hazelcast is a streaming and memory-first application platform for fast, stateful, data-intensive workloads on-premises, at the edge or as a fully managed cloud service. diff --git a/stable/hazelcast-enterprise/templates/config.yaml b/stable/hazelcast-enterprise/templates/config.yaml index 9ae20385..d6cc9bb5 100644 --- a/stable/hazelcast-enterprise/templates/config.yaml +++ b/stable/hazelcast-enterprise/templates/config.yaml @@ -8,6 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} data: {{- range $key, $val := .Values.hazelcast.configurationFiles }} {{ $key }}: |- diff --git a/stable/hazelcast-enterprise/templates/mancenter-config.yaml b/stable/hazelcast-enterprise/templates/mancenter-config.yaml index 06c9ff7f..fbb3c4ad 100644 --- a/stable/hazelcast-enterprise/templates/mancenter-config.yaml +++ b/stable/hazelcast-enterprise/templates/mancenter-config.yaml @@ -8,6 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} data: hazelcast-client.yaml: |- {{ toYaml .Values.mancenter.yaml | indent 4 }} diff --git a/stable/hazelcast-enterprise/templates/mancenter-ingress.yaml b/stable/hazelcast-enterprise/templates/mancenter-ingress.yaml index 204a8096..0068e42f 100644 --- a/stable/hazelcast-enterprise/templates/mancenter-ingress.yaml +++ b/stable/hazelcast-enterprise/templates/mancenter-ingress.yaml @@ -8,10 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" -{{- with .Values.mancenter.ingress.annotations }} + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if or .Values.mancenter.ingress.annotations .Values.commonAnnotations }} annotations: - {{- toYaml . | nindent 4 }} -{{- end }} + {{- range $key, $val := (merge nil .Values.mancenter.ingress.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: ingressClassName: {{ .Values.mancenter.ingress.className }} {{- if .Values.mancenter.ingress.tls }} diff --git a/stable/hazelcast-enterprise/templates/mancenter-service.yaml b/stable/hazelcast-enterprise/templates/mancenter-service.yaml index 2d458363..de504381 100644 --- a/stable/hazelcast-enterprise/templates/mancenter-service.yaml +++ b/stable/hazelcast-enterprise/templates/mancenter-service.yaml @@ -12,9 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.mancenter.service.labels }} + {{- range $key, $value := (merge nil .Values.mancenter.service.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ .Values.mancenter.service.type }} {{- if .Values.mancenter.service.clusterIP }} diff --git a/stable/hazelcast-enterprise/templates/mancenter-statefulset.yaml b/stable/hazelcast-enterprise/templates/mancenter-statefulset.yaml index 9ccba590..ff8b1f8f 100644 --- a/stable/hazelcast-enterprise/templates/mancenter-statefulset.yaml +++ b/stable/hazelcast-enterprise/templates/mancenter-statefulset.yaml @@ -8,9 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.mancenter.labels }} + {{- range $key, $value := (merge nil .Values.mancenter.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: serviceName: {{ template "mancenter.fullname" . }} replicas: 1 @@ -27,12 +33,16 @@ spec: app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" role: mancenter - {{- if .Values.mancenter.podLabels }} -{{ toYaml .Values.mancenter.podLabels | indent 8 }} + {{- if or .Values.mancenter.podLabels .Values.commonLabels }} + {{- range $key, $val := (merge nil .Values.mancenter.podLabels .Values.commonLabels) }} + {{ $key }}: {{ $val | quote }} + {{- end }} {{- end }} - {{- if .Values.mancenter.annotations }} + {{- if or .Values.mancenter.annotations .Values.commonAnnotations }} annotations: -{{ toYaml .Values.mancenter.annotations | indent 8 }} + {{- range $key, $val := (merge nil .Values.mancenter.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} {{- end }} spec: {{- if .Values.mancenter.image.pullSecrets }} @@ -229,6 +239,15 @@ spec: app.kubernetes.io/name: {{ template "mancenter.name" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: accessModes: {{- range .Values.mancenter.persistence.accessModes }} diff --git a/stable/hazelcast-enterprise/templates/metrics-service.yaml b/stable/hazelcast-enterprise/templates/metrics-service.yaml index 2a760f8a..0dabad40 100644 --- a/stable/hazelcast-enterprise/templates/metrics-service.yaml +++ b/stable/hazelcast-enterprise/templates/metrics-service.yaml @@ -10,8 +10,15 @@ metadata: app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" app.kubernetes.io/component: metrics + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if or .Values.metrics.service.annotations .Values.commonAnnotations }} annotations: -{{ toYaml .Values.metrics.service.annotations | indent 4 }} + {{- range $key, $val := (merge nil .Values.metrics.service.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ .Values.metrics.service.type }} {{- if (and (eq .Values.metrics.service.type "LoadBalancer") (.Values.metrics.service.loadBalancerIP)) }} diff --git a/stable/hazelcast-enterprise/templates/poddisruptionbudget.yaml b/stable/hazelcast-enterprise/templates/poddisruptionbudget.yaml index dee8e45a..523a0001 100644 --- a/stable/hazelcast-enterprise/templates/poddisruptionbudget.yaml +++ b/stable/hazelcast-enterprise/templates/poddisruptionbudget.yaml @@ -8,6 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: {{ toYaml .Values.podDisruptionBudget | indent 2 }} selector: diff --git a/stable/hazelcast-enterprise/templates/prometheusrule.yaml b/stable/hazelcast-enterprise/templates/prometheusrule.yaml index ec4bb455..8319e161 100644 --- a/stable/hazelcast-enterprise/templates/prometheusrule.yaml +++ b/stable/hazelcast-enterprise/templates/prometheusrule.yaml @@ -9,9 +9,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $val := .Values.metrics.prometheusRule.labels }} + {{- range $key, $val := (merge nil .Values.metrics.prometheusRule.labels .Values.commonLabels) }} {{ $key }}: {{ $val | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: groups: - name: {{ template "hazelcast.name" . }} diff --git a/stable/hazelcast-enterprise/templates/role.yaml b/stable/hazelcast-enterprise/templates/role.yaml index 962ae812..673b1b70 100644 --- a/stable/hazelcast-enterprise/templates/role.yaml +++ b/stable/hazelcast-enterprise/templates/role.yaml @@ -12,6 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} rules: - apiGroups: - "" diff --git a/stable/hazelcast-enterprise/templates/rolebinding.yaml b/stable/hazelcast-enterprise/templates/rolebinding.yaml index dd347fe2..3d404f98 100644 --- a/stable/hazelcast-enterprise/templates/rolebinding.yaml +++ b/stable/hazelcast-enterprise/templates/rolebinding.yaml @@ -12,6 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io {{- if .Values.rbac.useClusterRole }} diff --git a/stable/hazelcast-enterprise/templates/service-external.yaml b/stable/hazelcast-enterprise/templates/service-external.yaml index ba7e9c2e..56a4bc16 100644 --- a/stable/hazelcast-enterprise/templates/service-external.yaml +++ b/stable/hazelcast-enterprise/templates/service-external.yaml @@ -12,13 +12,15 @@ metadata: app.kubernetes.io/instance: "{{ $.Release.Name }}" app.kubernetes.io/managed-by: "{{ $.Release.Service }}" pod: {{ $targetPod }} - {{- range $key, $value := $.Values.externalAccess.service.labels }} + {{- range $key, $value := (merge nil .Values.externalAccess.service.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} -{{- with $.Values.externalAccess.service.annotations }} + {{- if or .Values.externalAccess.service.annotations .Values.commonAnnotations }} annotations: - {{- toYaml . | nindent 4 }} -{{- end }} + {{- range $key, $val := (merge nil .Values.externalAccess.service.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ $.Values.externalAccess.service.type }} {{- if $.Values.externalAccess.service.loadBalancerIPs }} diff --git a/stable/hazelcast-enterprise/templates/service.yaml b/stable/hazelcast-enterprise/templates/service.yaml index 99d80559..71ea8f7f 100644 --- a/stable/hazelcast-enterprise/templates/service.yaml +++ b/stable/hazelcast-enterprise/templates/service.yaml @@ -12,9 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.service.labels }} + {{- range $key, $value := (merge nil .Values.service.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ .Values.service.type }} {{- if (and (eq .Values.service.type "ClusterIP") (.Values.service.clusterIP)) }} diff --git a/stable/hazelcast-enterprise/templates/serviceaccount.yaml b/stable/hazelcast-enterprise/templates/serviceaccount.yaml index 2d2cfdd4..65c74329 100644 --- a/stable/hazelcast-enterprise/templates/serviceaccount.yaml +++ b/stable/hazelcast-enterprise/templates/serviceaccount.yaml @@ -8,4 +8,13 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} {{- end -}} diff --git a/stable/hazelcast-enterprise/templates/servicemonitor.yaml b/stable/hazelcast-enterprise/templates/servicemonitor.yaml index 5e6c8d40..ac1677c3 100644 --- a/stable/hazelcast-enterprise/templates/servicemonitor.yaml +++ b/stable/hazelcast-enterprise/templates/servicemonitor.yaml @@ -9,9 +9,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $val := .Values.metrics.serviceMonitor.labels }} + {{- range $key, $val := (merge nil .Values.metrics.serviceMonitor.labels .Values.commonLabels) }} {{ $key }}: {{ $val | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: endpoints: - port: {{ .Values.metrics.service.portName }} diff --git a/stable/hazelcast-enterprise/templates/statefulset.yaml b/stable/hazelcast-enterprise/templates/statefulset.yaml index fb019a67..499be450 100644 --- a/stable/hazelcast-enterprise/templates/statefulset.yaml +++ b/stable/hazelcast-enterprise/templates/statefulset.yaml @@ -8,12 +8,12 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.labels }} + {{- range $key, $value := (merge nil .Values.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} - {{- if .Values.annotations }} + {{- if or .Values.annotations .Values.commonAnnotations }} annotations: - {{- range $key, $val := .Values.annotations }} + {{- range $key, $val := (merge nil .Values.annotations .Values.commonAnnotations) }} {{ $key }}: {{ $val | quote }} {{- end }} {{- end }} @@ -33,12 +33,14 @@ spec: app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" role: hazelcast - {{- if .Values.podLabels }} -{{ toYaml .Values.podLabels | indent 8 }} - {{- end }} + {{- if or .Values.podLabels .Values.commonLabels }} + {{- range $key, $val := (merge nil .Values.podLabels .Values.commonLabels) }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} annotations: checksum/hazelcast-config: {{ toYaml .Values.hazelcast.yaml | sha256sum }} - {{- range $key, $val := .Values.annotations }} + {{- range $key, $val := (merge nil .Values.annotations .Values.commonAnnotations) }} {{ $key }}: {{ $val | quote }} {{- end }} spec: @@ -241,6 +243,15 @@ spec: app.kubernetes.io/name: {{ template "hazelcast.name" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: accessModes: {{- range .Values.persistence.accessModes }} diff --git a/stable/hazelcast-enterprise/values.yaml b/stable/hazelcast-enterprise/values.yaml index 3f9d9a82..be7cc9dd 100644 --- a/stable/hazelcast-enterprise/values.yaml +++ b/stable/hazelcast-enterprise/values.yaml @@ -25,6 +25,12 @@ cluster: # memberCount is the number Hazelcast members memberCount: 3 +# Labels to add to all deployed objects +commonLabels: {} + +# Annotations to add to all deployed objects +commonAnnotations: {} + # Hazelcast properties hazelcast: # enabled is a flag to enable Hazelcast application diff --git a/stable/hazelcast/Chart.yaml b/stable/hazelcast/Chart.yaml index 89609f18..720d5fa0 100644 --- a/stable/hazelcast/Chart.yaml +++ b/stable/hazelcast/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: hazelcast -version: 5.8.7 +version: 5.8.8 appVersion: "5.3.2" kubeVersion: ">=1.19.0-0" description: Hazelcast is a streaming and memory-first application platform for fast, stateful, data-intensive workloads on-premises, at the edge or as a fully managed cloud service. diff --git a/stable/hazelcast/templates/config.yaml b/stable/hazelcast/templates/config.yaml index 9ae20385..d6cc9bb5 100644 --- a/stable/hazelcast/templates/config.yaml +++ b/stable/hazelcast/templates/config.yaml @@ -8,6 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} data: {{- range $key, $val := .Values.hazelcast.configurationFiles }} {{ $key }}: |- diff --git a/stable/hazelcast/templates/mancenter-config.yaml b/stable/hazelcast/templates/mancenter-config.yaml index 06c9ff7f..fbb3c4ad 100644 --- a/stable/hazelcast/templates/mancenter-config.yaml +++ b/stable/hazelcast/templates/mancenter-config.yaml @@ -8,6 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} data: hazelcast-client.yaml: |- {{ toYaml .Values.mancenter.yaml | indent 4 }} diff --git a/stable/hazelcast/templates/mancenter-ingress.yaml b/stable/hazelcast/templates/mancenter-ingress.yaml index 204a8096..0068e42f 100644 --- a/stable/hazelcast/templates/mancenter-ingress.yaml +++ b/stable/hazelcast/templates/mancenter-ingress.yaml @@ -8,10 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" -{{- with .Values.mancenter.ingress.annotations }} + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if or .Values.mancenter.ingress.annotations .Values.commonAnnotations }} annotations: - {{- toYaml . | nindent 4 }} -{{- end }} + {{- range $key, $val := (merge nil .Values.mancenter.ingress.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: ingressClassName: {{ .Values.mancenter.ingress.className }} {{- if .Values.mancenter.ingress.tls }} diff --git a/stable/hazelcast/templates/mancenter-service.yaml b/stable/hazelcast/templates/mancenter-service.yaml index 2d458363..de504381 100644 --- a/stable/hazelcast/templates/mancenter-service.yaml +++ b/stable/hazelcast/templates/mancenter-service.yaml @@ -12,9 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.mancenter.service.labels }} + {{- range $key, $value := (merge nil .Values.mancenter.service.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ .Values.mancenter.service.type }} {{- if .Values.mancenter.service.clusterIP }} diff --git a/stable/hazelcast/templates/mancenter-statefulset.yaml b/stable/hazelcast/templates/mancenter-statefulset.yaml index 4d20e256..775eca35 100644 --- a/stable/hazelcast/templates/mancenter-statefulset.yaml +++ b/stable/hazelcast/templates/mancenter-statefulset.yaml @@ -8,9 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.mancenter.labels }} + {{- range $key, $value := (merge nil .Values.mancenter.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: serviceName: {{ template "mancenter.fullname" . }} replicas: 1 @@ -27,12 +33,16 @@ spec: app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" role: mancenter - {{- if .Values.mancenter.podLabels }} -{{ toYaml .Values.mancenter.podLabels | indent 8 }} + {{- if or .Values.mancenter.podLabels .Values.commonLabels }} + {{- range $key, $val := (merge nil .Values.mancenter.podLabels .Values.commonLabels) }} + {{ $key }}: {{ $val | quote }} + {{- end }} {{- end }} - {{- if .Values.mancenter.annotations }} + {{- if or .Values.mancenter.annotations .Values.commonAnnotations }} annotations: -{{ toYaml .Values.mancenter.annotations | indent 8 }} + {{- range $key, $val := (merge nil .Values.mancenter.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} {{- end }} spec: {{- if .Values.mancenter.image.pullSecrets }} @@ -220,6 +230,15 @@ spec: helm.sh/chart: "{{ .Chart.Name }}" app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: accessModes: {{- range .Values.mancenter.persistence.accessModes }} diff --git a/stable/hazelcast/templates/metrics-service.yaml b/stable/hazelcast/templates/metrics-service.yaml index 2a760f8a..0dabad40 100644 --- a/stable/hazelcast/templates/metrics-service.yaml +++ b/stable/hazelcast/templates/metrics-service.yaml @@ -10,8 +10,15 @@ metadata: app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" app.kubernetes.io/component: metrics + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if or .Values.metrics.service.annotations .Values.commonAnnotations }} annotations: -{{ toYaml .Values.metrics.service.annotations | indent 4 }} + {{- range $key, $val := (merge nil .Values.metrics.service.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ .Values.metrics.service.type }} {{- if (and (eq .Values.metrics.service.type "LoadBalancer") (.Values.metrics.service.loadBalancerIP)) }} diff --git a/stable/hazelcast/templates/poddisruptionbudget.yaml b/stable/hazelcast/templates/poddisruptionbudget.yaml index dee8e45a..523a0001 100644 --- a/stable/hazelcast/templates/poddisruptionbudget.yaml +++ b/stable/hazelcast/templates/poddisruptionbudget.yaml @@ -8,6 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: {{ toYaml .Values.podDisruptionBudget | indent 2 }} selector: diff --git a/stable/hazelcast/templates/prometheusrule.yaml b/stable/hazelcast/templates/prometheusrule.yaml index ec4bb455..8319e161 100644 --- a/stable/hazelcast/templates/prometheusrule.yaml +++ b/stable/hazelcast/templates/prometheusrule.yaml @@ -9,9 +9,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $val := .Values.metrics.prometheusRule.labels }} + {{- range $key, $val := (merge nil .Values.metrics.prometheusRule.labels .Values.commonLabels) }} {{ $key }}: {{ $val | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: groups: - name: {{ template "hazelcast.name" . }} diff --git a/stable/hazelcast/templates/role.yaml b/stable/hazelcast/templates/role.yaml index dc9d09b2..40ed5f08 100644 --- a/stable/hazelcast/templates/role.yaml +++ b/stable/hazelcast/templates/role.yaml @@ -12,6 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} rules: - apiGroups: - "" diff --git a/stable/hazelcast/templates/rolebinding.yaml b/stable/hazelcast/templates/rolebinding.yaml index dd347fe2..3d404f98 100644 --- a/stable/hazelcast/templates/rolebinding.yaml +++ b/stable/hazelcast/templates/rolebinding.yaml @@ -12,6 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io {{- if .Values.rbac.useClusterRole }} diff --git a/stable/hazelcast/templates/service-external.yaml b/stable/hazelcast/templates/service-external.yaml index ba7e9c2e..56a4bc16 100644 --- a/stable/hazelcast/templates/service-external.yaml +++ b/stable/hazelcast/templates/service-external.yaml @@ -12,13 +12,15 @@ metadata: app.kubernetes.io/instance: "{{ $.Release.Name }}" app.kubernetes.io/managed-by: "{{ $.Release.Service }}" pod: {{ $targetPod }} - {{- range $key, $value := $.Values.externalAccess.service.labels }} + {{- range $key, $value := (merge nil .Values.externalAccess.service.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} -{{- with $.Values.externalAccess.service.annotations }} + {{- if or .Values.externalAccess.service.annotations .Values.commonAnnotations }} annotations: - {{- toYaml . | nindent 4 }} -{{- end }} + {{- range $key, $val := (merge nil .Values.externalAccess.service.annotations .Values.commonAnnotations) }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ $.Values.externalAccess.service.type }} {{- if $.Values.externalAccess.service.loadBalancerIPs }} diff --git a/stable/hazelcast/templates/service.yaml b/stable/hazelcast/templates/service.yaml index 99d80559..71ea8f7f 100644 --- a/stable/hazelcast/templates/service.yaml +++ b/stable/hazelcast/templates/service.yaml @@ -12,9 +12,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.service.labels }} + {{- range $key, $value := (merge nil .Values.service.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: type: {{ .Values.service.type }} {{- if (and (eq .Values.service.type "ClusterIP") (.Values.service.clusterIP)) }} diff --git a/stable/hazelcast/templates/serviceaccount.yaml b/stable/hazelcast/templates/serviceaccount.yaml index 2d2cfdd4..65c74329 100644 --- a/stable/hazelcast/templates/serviceaccount.yaml +++ b/stable/hazelcast/templates/serviceaccount.yaml @@ -8,4 +8,13 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" + {{- range $key, $value := .Values.commonLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} {{- end -}} diff --git a/stable/hazelcast/templates/servicemonitor.yaml b/stable/hazelcast/templates/servicemonitor.yaml index 5e6c8d40..ac1677c3 100644 --- a/stable/hazelcast/templates/servicemonitor.yaml +++ b/stable/hazelcast/templates/servicemonitor.yaml @@ -9,9 +9,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $val := .Values.metrics.serviceMonitor.labels }} + {{- range $key, $val := (merge nil .Values.metrics.serviceMonitor.labels .Values.commonLabels) }} {{ $key }}: {{ $val | quote }} {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- range $key, $val := .Values.commonAnnotations }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} spec: endpoints: - port: {{ .Values.metrics.service.portName }} diff --git a/stable/hazelcast/templates/statefulset.yaml b/stable/hazelcast/templates/statefulset.yaml index 0cfe26d2..f800490a 100644 --- a/stable/hazelcast/templates/statefulset.yaml +++ b/stable/hazelcast/templates/statefulset.yaml @@ -8,15 +8,15 @@ metadata: helm.sh/chart: {{ template "hazelcast.chart" . }} app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" - {{- range $key, $value := .Values.labels }} + {{- range $key, $value := (merge nil .Values.labels .Values.commonLabels) }} {{ $key }}: {{ $value | quote }} {{- end }} - {{- if .Values.annotations }} + {{- if or .Values.annotations .Values.commonAnnotations }} annotations: - {{- range $key, $val := .Values.annotations }} + {{- range $key, $val := (merge nil .Values.annotations .Values.commonAnnotations) }} {{ $key }}: {{ $val | quote }} {{- end }} - {{- end }} + {{- end }} spec: serviceName: {{ template "hazelcast.fullname" . }} replicas: {{ .Values.cluster.memberCount }} @@ -33,12 +33,14 @@ spec: app.kubernetes.io/instance: "{{ .Release.Name }}" app.kubernetes.io/managed-by: "{{ .Release.Service }}" role: hazelcast - {{- if .Values.podLabels }} -{{ toYaml .Values.podLabels | indent 8 }} + {{- if or .Values.podLabels .Values.commonLabels }} + {{- range $key, $val := (merge nil .Values.podLabels .Values.commonLabels) }} + {{ $key }}: {{ $val | quote }} + {{- end }} {{- end }} annotations: checksum/hazelcast-config: {{ toYaml .Values.hazelcast.yaml | sha256sum }} - {{- range $key, $val := .Values.annotations }} + {{- range $key, $val := (merge nil .Values.annotations .Values.commonAnnotations) }} {{ $key }}: {{ $val | quote }} {{- end }} spec: diff --git a/stable/hazelcast/values.yaml b/stable/hazelcast/values.yaml index c136d356..9d44a81b 100644 --- a/stable/hazelcast/values.yaml +++ b/stable/hazelcast/values.yaml @@ -25,6 +25,12 @@ cluster: # memberCount is the number Hazelcast members memberCount: 3 +# Labels to add to all deployed objects +commonLabels: {} + +# Annotations to add to all deployed objects +commonAnnotations: {} + # Hazelcast properties hazelcast: # enabled is a flag to enable Hazelcast application