Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/redis-ha/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ keywords:
- redis
- keyvalue
- database
version: 4.39.0
version: 4.40.0
appVersion: 8.8.0
description: This Helm chart provides a highly available Redis implementation with a master/slave configuration and uses Sentinel sidecars for failover management
icon: https://img.icons8.com/external-tal-revivo-shadow-tal-revivo/24/external-redis-an-in-memory-data-structure-project-implementing-a-distributed-logo-shadow-tal-revivo.png
Expand Down
25 changes: 24 additions & 1 deletion charts/redis-ha/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,29 @@ app: {{ template "redis-ha.name" . }}
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
chart: {{ template "chartref" . }}
app.kubernetes.io/name: {{ template "redis-ha.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
helm.sh/chart: {{ template "chartref" . }}
{{- end -}}

{{/*
Merge legacy and standard label defaults with custom label maps in order.
Custom values override defaults, except legacy labels used by selectors and
explicit required labels. Render each key once and keep all values strings.
Arguments: context, defaults (optional), customLabels (optional list),
required (optional map of labels that must retain their chart values).
*/}}
{{- define "redis-ha.labels" -}}
{{- $labels := mergeOverwrite (include "labels.standard" .context | fromYaml) (default (dict) .defaults) -}}
{{- $required := mergeOverwrite (pick $labels "app" "release" "component" "exporter") (default (dict) .required) -}}
{{- range .customLabels -}}
{{- $labels = mergeOverwrite $labels (deepCopy (default (dict) .)) -}}
{{- end -}}
{{- $labels = mergeOverwrite $labels $required -}}
{{- range $key, $value := $labels }}
{{ $key }}: {{ $value | toString | quote }}
{{- end -}}
{{- end -}}

{{- /*
Expand Down Expand Up @@ -151,4 +174,4 @@ Usage:
- port: {{ .Values.sentinel.tlsPort }}
protocol: TCP
{{- end -}}
{{- end -}}
{{- end -}}
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-auth-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ metadata:
annotations: {{ . | toYaml | nindent 4 }}
{{- end }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels)) | indent 4 }}
type: Opaque
data:
{{ .Values.authKey }}: {{ .Values.redisPassword | b64enc | quote }}
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-ha-announce-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ metadata:
name: {{ $fullName }}-announce-{{ $i }}
namespace: {{ $namespace | quote }}
labels:
{{ include "labels.standard" $root | indent 4 }}
{{- range $key, $value := $root.Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" $root "customLabels" (list $root.Values.extraLabels)) | indent 4 }}
annotations:
{{- if (semverCompare "<=1.10-0" $.Capabilities.KubeVersion.Version) }}
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
Expand Down
11 changes: 1 addition & 10 deletions charts/redis-ha/templates/redis-ha-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-configmap
namespace: {{ .Release.Namespace | quote }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "redis-ha.fullname" . }}
{{- range $key, $value := .Values.configmap.labels }}
{{ $key }}: {{ $value | toString }}
{{- end }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "app" (include "redis-ha.fullname" .) "app.kubernetes.io/name" (include "redis-ha.fullname" .)) "customLabels" (list .Values.configmap.labels .Values.extraLabels)) | indent 4 }}
data:
redis.conf: |
{{- include "config-redis.conf" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-exporter-script-configmap
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels)) | indent 4 }}
data:
script: {{ toYaml .Values.exporter.script | indent 2 }}
{{- end }}
8 changes: 1 addition & 7 deletions charts/redis-ha/templates/redis-ha-health-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-health-configmap
namespace: {{ .Release.Namespace | quote }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "redis-ha.fullname" . }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "app" (include "redis-ha.fullname" .) "app.kubernetes.io/name" (include "redis-ha.fullname" .)) "customLabels" (list .Values.extraLabels)) | indent 4 }}
data:
redis_liveness.sh: |
{{- include "redis_liveness.sh" . }}
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-ha-network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ metadata:
{{- end }}
{{- end }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.networkPolicy.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.networkPolicy.labels)) | indent 4 }}
spec:
podSelector:
matchLabels:
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-ha-pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-pdb
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels)) | indent 4 }}
spec:
selector:
matchLabels:
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-ha-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels)) | indent 4 }}
rules:
- apiGroups:
- ""
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-ha-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels)) | indent 4 }}
subjects:
- kind: ServiceAccount
name: {{ template "redis-ha.serviceAccountName" . }}
Expand Down
8 changes: 1 addition & 7 deletions charts/redis-ha/templates/redis-ha-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ metadata:
name: {{ include "redis-ha.fullname" . }}-secret
namespace: {{ .Release.Namespace | quote }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "redis-ha.fullname" . }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "app" (include "redis-ha.fullname" .) "app.kubernetes.io/name" (include "redis-ha.fullname" .)) "customLabels" (list .Values.extraLabels)) | indent 4 }}
type: Opaque
data:
{{- if regexFind $regexRestoreSSH (toString .Values.restore.ssh.source) }}
Expand Down
11 changes: 1 addition & 10 deletions charts/redis-ha/templates/redis-ha-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- if .Values.exporter.enabled }}
exporter: enabled
{{- end }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- range $key, $value := .Values.serviceLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (ternary (dict "exporter" "enabled") (dict) .Values.exporter.enabled) "customLabels" (list .Values.extraLabels .Values.serviceLabels)) | indent 4 }}
annotations:
{{- if .Values.serviceAnnotations }}
{{ toYaml .Values.serviceAnnotations | indent 4 }}
Expand Down
8 changes: 1 addition & 7 deletions charts/redis-ha/templates/redis-ha-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ metadata:
name: {{ template "redis-ha.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "redis-ha.fullname" . }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "app" (include "redis-ha.fullname" .) "app.kubernetes.io/name" (include "redis-ha.fullname" .)) "customLabels" (list .Values.extraLabels)) | indent 4 }}
{{- if .Values.serviceAccount.annotations }}
annotations:
{{ toYaml .Values.serviceAccount.annotations | indent 4 }}
Expand Down
8 changes: 1 addition & 7 deletions charts/redis-ha/templates/redis-ha-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}
namespace: {{ .Values.exporter.serviceMonitor.namespace | default .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- range $key, $value := .Values.exporter.serviceMonitor.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels .Values.exporter.serviceMonitor.labels)) | indent 4 }}
spec:
endpoints:
- targetPort: {{ .Values.exporter.port }}
Expand Down
16 changes: 2 additions & 14 deletions charts/redis-ha/templates/redis-ha-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-server
namespace: {{ .Release.Namespace | quote }}
labels:
{{ template "redis-ha.fullname" . }}: replica
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "labels.standard" . | indent 4 }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels) "required" (dict (include "redis-ha.fullname" .) "replica")) | indent 4 }}
annotations:
{{ toYaml .Values.redis.annotations | indent 4 }}
spec:
Expand Down Expand Up @@ -41,15 +37,7 @@ spec:
prometheus.io/path: {{ .Values.exporter.scrapePath }}
{{- end }}
labels:
release: {{ .Release.Name }}
app: {{ template "redis-ha.name" . }}
{{ template "redis-ha.fullname" . }}: replica
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value | toString }}
{{- end }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.labels .Values.extraLabels) "required" (dict (include "redis-ha.fullname" .) "replica")) | indent 8 }}
spec:
{{- if .Values.redis.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.redis.terminationGracePeriodSeconds }}
Expand Down
16 changes: 2 additions & 14 deletions charts/redis-ha/templates/redis-haproxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
component: haproxy
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "component" "haproxy" "app.kubernetes.io/component" "haproxy") "customLabels" (list .Values.extraLabels)) | indent 4 }}
{{- if .Values.haproxy.deploymentAnnotations }}
annotations:
{{- range $key, $value := .Values.haproxy.deploymentAnnotations }}
Expand All @@ -32,15 +28,7 @@ spec:
metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy
labels:
app: {{ template "redis-ha.name" . }}-haproxy
release: {{ .Release.Name }}
component: haproxy
{{- range $key, $value := .Values.haproxy.labels }}
{{ $key }}: {{ $value | toString }}
{{- end }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "app" (printf "%s-haproxy" (include "redis-ha.name" .)) "app.kubernetes.io/name" (printf "%s-haproxy" (include "redis-ha.name" .)) "component" "haproxy" "app.kubernetes.io/component" "haproxy") "customLabels" (list .Values.haproxy.labels .Values.extraLabels)) | indent 8 }}
annotations:
{{- if and (.Values.haproxy.metrics.enabled) (not .Values.haproxy.metrics.serviceMonitor.enabled) }}
prometheus.io/port: "{{ .Values.haproxy.metrics.port }}"
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-haproxy-network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ metadata:
{{- end }}
{{- end }}
labels:
{{- include "labels.standard" . | nindent 4 }}
{{- range $key, $value := .Values.haproxy.networkPolicy.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.haproxy.networkPolicy.labels)) | indent 4 }}
spec:
podSelector:
matchLabels:
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-haproxy-pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy-pdb
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels)) | indent 4 }}
spec:
selector:
matchLabels:
Expand Down
6 changes: 1 addition & 5 deletions charts/redis-ha/templates/redis-haproxy-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
component: haproxy
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "component" "haproxy" "app.kubernetes.io/component" "haproxy") "customLabels" (list .Values.extraLabels)) | indent 4 }}
rules:
- apiGroups:
- ""
Expand Down
6 changes: 1 addition & 5 deletions charts/redis-ha/templates/redis-haproxy-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
component: haproxy
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "component" "haproxy" "app.kubernetes.io/component" "haproxy") "customLabels" (list .Values.extraLabels)) | indent 4 }}
subjects:
- kind: ServiceAccount
name: {{ template "redis-ha.serviceAccountName" . }}-haproxy
Expand Down
9 changes: 1 addition & 8 deletions charts/redis-ha/templates/redis-haproxy-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
component: haproxy
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- range $key, $value := .Values.haproxy.service.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "component" "haproxy" "app.kubernetes.io/component" "haproxy") "customLabels" (list .Values.extraLabels .Values.haproxy.service.labels)) | indent 4 }}
annotations:
{{- if .Values.haproxy.service.annotations }}
{{ toYaml .Values.haproxy.service.annotations | indent 4 }}
Expand Down
8 changes: 1 addition & 7 deletions charts/redis-ha/templates/redis-haproxy-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ metadata:
name: {{ template "redis-ha.serviceAccountName" . }}-haproxy
namespace: {{ .Release.Namespace | quote }}
labels:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "redis-ha.fullname" . }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "defaults" (dict "app" (include "redis-ha.fullname" .) "app.kubernetes.io/name" (include "redis-ha.fullname" .)) "customLabels" (list .Values.extraLabels)) | indent 4 }}
{{- end }}
8 changes: 1 addition & 7 deletions charts/redis-ha/templates/redis-haproxy-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy
namespace: {{ .Values.haproxy.metrics.serviceMonitor.namespace | default .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- range $key, $value := .Values.haproxy.metrics.serviceMonitor.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels .Values.haproxy.metrics.serviceMonitor.labels)) | indent 4 }}
spec:
endpoints:
- targetPort: {{ .Values.haproxy.metrics.port }}
Expand Down
5 changes: 1 addition & 4 deletions charts/redis-ha/templates/redis-tls-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ metadata:
name: {{ template "redis-ha.fullname" . }}-tls-secret
namespace: {{ .Release.Namespace | quote }}
labels:
{{ include "labels.standard" . | indent 4 }}
{{- range $key, $value := .Values.extraLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{ include "redis-ha.labels" (dict "context" . "customLabels" (list .Values.extraLabels)) | indent 4 }}
type: Opaque
data:
{{- if .Values.tls.caCertFile }}
Expand Down
Loading