github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/velero/templates/_helpers.tpl (about) 1 {{/* vim: set filetype=mustache: */}} 2 {{/* 3 Expand the name of the chart. 4 */}} 5 {{- define "velero.name" -}} 6 {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 {{- end -}} 8 9 {{/* 10 Create a default fully qualified app name. 11 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 If release name contains chart name it will be used as a full name. 13 */}} 14 {{- define "velero.fullname" -}} 15 {{- if .Values.fullnameOverride -}} 16 {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 {{- else -}} 18 {{- $name := default .Chart.Name .Values.nameOverride -}} 19 {{- if contains $name .Release.Name -}} 20 {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 {{- else -}} 22 {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 {{- end -}} 24 {{- end -}} 25 {{- end -}} 26 27 {{/* 28 Create chart name and version as used by the chart label. 29 */}} 30 {{- define "velero.chart" -}} 31 {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 {{- end -}} 33 34 {{/* 35 Create the name of the service account to use for creating or deleting the velero server 36 */}} 37 {{- define "velero.serverServiceAccount" -}} 38 {{- if .Values.serviceAccount.server.create -}} 39 {{ default (printf "%s-%s" (include "velero.fullname" .) "server") .Values.serviceAccount.server.name }} 40 {{- else -}} 41 {{ default "default" .Values.serviceAccount.server.name }} 42 {{- end -}} 43 {{- end -}} 44 45 {{/* 46 Create the name for the credentials secret. 47 */}} 48 {{- define "velero.secretName" -}} 49 {{- if .Values.credentials.existingSecret -}} 50 {{- .Values.credentials.existingSecret -}} 51 {{- else -}} 52 {{ default (include "velero.fullname" .) .Values.credentials.name }} 53 {{- end -}} 54 {{- end -}} 55 56 {{/* 57 Create the Velero priority class name. 58 */}} 59 {{- define "velero.priorityClassName" -}} 60 {{- if .Values.priorityClassName -}} 61 {{- .Values.priorityClassName -}} 62 {{- else -}} 63 {{- include "velero.fullname" . -}} 64 {{- end -}} 65 {{- end -}} 66 67 {{/* 68 Create the Restic priority class name. 69 */}} 70 {{- define "velero.restic.priorityClassName" -}} 71 {{- if .Values.restic.priorityClassName -}} 72 {{- .Values.restic.priorityClassName -}} 73 {{- else -}} 74 {{- include "velero.fullname" . -}} 75 {{- end -}} 76 {{- end -}} 77 78 {{/* 79 Create the backup storage location name 80 */}} 81 {{- define "velero.backupStorageLocation.name" -}} 82 {{- with .Values.configuration.backupStorageLocation -}} 83 {{ default "default" .name }} 84 {{- end -}} 85 {{- end -}} 86 87 {{/* 88 Create the backup storage location provider 89 */}} 90 {{- define "velero.backupStorageLocation.provider" -}} 91 {{- with .Values.configuration -}} 92 {{ default .provider .backupStorageLocation.provider }} 93 {{- end -}} 94 {{- end -}} 95 96 {{/* 97 Create the volume snapshot location name 98 */}} 99 {{- define "velero.volumeSnapshotLocation.name" -}} 100 {{- with .Values.configuration.volumeSnapshotLocation -}} 101 {{ default "default" .name }} 102 {{- end -}} 103 {{- end -}} 104 105 {{/* 106 Create the volume snapshot location provider 107 */}} 108 {{- define "velero.volumeSnapshotLocation.provider" -}} 109 {{- with .Values.configuration -}} 110 {{ default .provider .volumeSnapshotLocation.provider }} 111 {{- end -}} 112 {{- end -}} 113 114 {{/* 115 Kubernetes version 116 Built-in object .Capabilities.KubeVersion.Minor can provide non-number output 117 For examples: 118 - on GKE it returns "18+" instead of "18" 119 - on EKS it returns "20+" instead of "20" 120 */}} 121 {{- define "chart.KubernetesVersion" -}} 122 {{- $minorVersion := .Capabilities.KubeVersion.Minor | regexFind "[0-9]+" -}} 123 {{- printf "%s.%s" .Capabilities.KubeVersion.Major $minorVersion -}} 124 {{- end -}}