aboutsummaryrefslogtreecommitdiff
path: root/script/helm/garage/templates/_helpers.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'script/helm/garage/templates/_helpers.tpl')
-rw-r--r--script/helm/garage/templates/_helpers.tpl26
1 files changed, 26 insertions, 0 deletions
diff --git a/script/helm/garage/templates/_helpers.tpl b/script/helm/garage/templates/_helpers.tpl
index 1a651f47..037a5f1c 100644
--- a/script/helm/garage/templates/_helpers.tpl
+++ b/script/helm/garage/templates/_helpers.tpl
@@ -24,6 +24,13 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{/*
+Create the name of the rpc secret
+*/}}
+{{- define "garage.rpcSecretName" -}}
+{{- printf "%s-rpc-secret" (include "garage.fullname" .) -}}
+{{- end }}
+
+{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "garage.chart" -}}
@@ -60,3 +67,22 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
+
+{{/*
+ Returns given number of random Hex characters.
+ In practice, it generates up to 100 randAlphaNum strings
+ that are filtered from non-hex characters and augmented
+ to the resulting string that is finally trimmed down.
+*/}}
+{{- define "jupyterhub.randHex" -}}
+ {{- $result := "" }}
+ {{- range $i := until 100 }}
+ {{- if lt (len $result) . }}
+ {{- $rand_list := randAlphaNum . | splitList "" -}}
+ {{- $reduced_list := without $rand_list "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" }}
+ {{- $rand_string := join "" $reduced_list }}
+ {{- $result = print $result $rand_string -}}
+ {{- end }}
+ {{- end }}
+ {{- $result | trunc . }}
+{{- end }}