Files
helm-charts/charts/volsync-target/templates/_helpers.tpl
Alex Lebens b1dae9cd3d
All checks were successful
renovate / renovate (push) Successful in 24s
lint-and-test / lint-helm (push) Successful in 21s
release-charts-volsync-target / release (push) Successful in 33s
lint-and-test / chart-testing (push) Successful in 39s
add volsync target chart
2025-12-15 17:35:29 -06:00

76 lines
2.0 KiB
Smarty

{{/*
Expand the names
*/}}
{{- define "volsync.name" -}}
{{- if .Values.nameOverride }}
{{- .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-backup" .Values.pvcTarget -}}
{{- end }}
{{- end }}
{{- define "volsync.localRepoName" -}}
{{- if .Values.local.restic.repository }}
{{- .Values.local.restic.repository | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-secret-local" (include "volsync.name" .) -}}
{{- end }}
{{- end }}
{{- define "volsync.remoteRepoName" -}}
{{- if .Values.remote.restic.repository }}
{{- .Values.remote.restic.repository | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-secret-remote" (include "volsync.name" .) -}}
{{- end }}
{{- end }}
{{- define "volsync.externalRepoName" -}}
{{- if .Values.external.restic.repository }}
{{- .Values.external.restic.repository | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-secret-external" (include "volsync.name" .) -}}
{{- end }}
{{- end }}
{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "volsync.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "volsync.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "volsync.labels" -}}
helm.sh/chart: {{ include "volsync.chart" $ }}
{{ include "volsync.selectorLabels" $ }}
{{- 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 "volsync.selectorLabels" -}}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Release.Name }}
{{- end }}