Skip to content

Commit

Permalink
[CN-993] Common label and annotation parameters for all deployed obje…
Browse files Browse the repository at this point in the history
…cts (#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
  • Loading branch information
semihbkgr authored Oct 18, 2023
1 parent 9e9a413 commit 037da7e
Show file tree
Hide file tree
Showing 34 changed files with 297 additions and 50 deletions.
2 changes: 1 addition & 1 deletion stable/hazelcast-enterprise/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
9 changes: 9 additions & 0 deletions stable/hazelcast-enterprise/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}: |-
Expand Down
9 changes: 9 additions & 0 deletions stable/hazelcast-enterprise/templates/mancenter-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
11 changes: 8 additions & 3 deletions stable/hazelcast-enterprise/templates/mancenter-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 7 additions & 1 deletion stable/hazelcast-enterprise/templates/mancenter-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
29 changes: 24 additions & 5 deletions stable/hazelcast-enterprise/templates/mancenter-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
9 changes: 8 additions & 1 deletion stable/hazelcast-enterprise/templates/metrics-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion stable/hazelcast-enterprise/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand Down
9 changes: 9 additions & 0 deletions stable/hazelcast-enterprise/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- ""
Expand Down
9 changes: 9 additions & 0 deletions stable/hazelcast-enterprise/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
10 changes: 6 additions & 4 deletions stable/hazelcast-enterprise/templates/service-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 7 additions & 1 deletion stable/hazelcast-enterprise/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)) }}
Expand Down
9 changes: 9 additions & 0 deletions stable/hazelcast-enterprise/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
8 changes: 7 additions & 1 deletion stable/hazelcast-enterprise/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
25 changes: 18 additions & 7 deletions stable/hazelcast-enterprise/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
6 changes: 6 additions & 0 deletions stable/hazelcast-enterprise/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stable/hazelcast/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
9 changes: 9 additions & 0 deletions stable/hazelcast/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}: |-
Expand Down
9 changes: 9 additions & 0 deletions stable/hazelcast/templates/mancenter-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
Loading

0 comments on commit 037da7e

Please sign in to comment.