Files
helm-charts/charts/redis-replication/templates/_helpers.tpl
Alex Lebens 96154b9be9
All checks were successful
renovate / renovate (push) Successful in 34s
lint-and-test / lint-helm (push) Successful in 12s
lint-and-test / chart-testing (push) Successful in 20s
release-charts-generic-device-plugin / release (push) Successful in 18s
release-charts-redis-replication / release (push) Successful in 15s
add redis replication chart
2025-12-14 23:32:36 -06:00

66 lines
1.7 KiB
Smarty

{{/*
Expand the names
*/}}
{{- define "redis.replicationName" -}}
{{- if .Values.replicationNameOverride }}
{{- .Values.replicationNameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "redis-replication-%s" .Release.Name -}}
{{- end }}
{{- end }}
{{- define "redis.sentinelName" -}}
{{- if .Values.sentinelNameOverride }}
{{- .Values.sentinelNameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "redis-sentinel-%s" .Release.Name -}}
{{- end }}
{{- end }}
{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "redis.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "redis.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "redis.labels" -}}
helm.sh/chart: {{ include "redis.chart" $ }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.Version | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.additionalLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "redis.replicationSelectorLabels" -}}
app.kubernetes.io/name: {{ include "redis.replicationName" $ }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Release.Name }}
{{- end }}
{{- define "redis.sentinelSelectorLabels" -}}
app.kubernetes.io/name: {{ include "redis.sentinelName" $ }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Release.Name }}
{{- end }}