mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
23 lines
1.1 KiB
YAML
23 lines
1.1 KiB
YAML
|
|
{{ $fullname := include "node.fullname" . }}
|
||
|
|
{{ if .Values.node.persistGeneratedNodeKey }}
|
||
|
|
{{ else if .Values.node.customNodeKey }}
|
||
|
|
apiVersion: v1
|
||
|
|
kind: Secret
|
||
|
|
metadata:
|
||
|
|
name: {{ $fullname }}-custom-node-key
|
||
|
|
data:
|
||
|
|
{{- if kindIs "string" .Values.node.customNodeKey }}
|
||
|
|
custom-node-key: {{ .Values.node.customNodeKey | mustRegexFind "^[0-9a-zA-Z]{64}$" | b64enc }}
|
||
|
|
{{- else if kindIs "slice" .Values.node.customNodeKey }}
|
||
|
|
{{- range $index, $key := .Values.node.customNodeKey }}
|
||
|
|
custom-node-key-{{ $index }}: {{ $key | mustRegexFind "^[0-9a-zA-Z]{64}$" | b64enc }}
|
||
|
|
{{- end }}
|
||
|
|
{{- else if kindIs "map" .Values.node.customNodeKey }}
|
||
|
|
{{- range $index := until (max .Values.autoscaling.maxReplicas .Values.node.replicas | int) }}
|
||
|
|
custom-node-key-{{ $index }}: {{ printf "%s/%s/%d" $.Values.node.customNodeKey.seed (default $fullname $.Values.node.customNodeKey.extraDerivation) $index | sha256sum | mustRegexFind "^[0-9a-zA-Z]{64}$" | b64enc }}
|
||
|
|
{{- end }}
|
||
|
|
{{- else }}
|
||
|
|
{{- fail (printf "ERROR: '.Values.node.customNodeKey' is invalid. Expected type 'string', 'slice', or 'map', but got: '%s'" (kindOf .Values.node.customNodeKey)) }}
|
||
|
|
{{- end }}
|
||
|
|
{{ end }}
|