Files
Andrei Kvapil da3ee5d0ea [virtual-machine] add comment about sshKeys logic
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-07-09 10:37:39 +02:00

34 lines
969 B
YAML

{{- if .Values.sshKeys }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "virtual-machine.fullname" $ }}-ssh-keys
stringData:
{{- range $k, $v := .Values.sshKeys }}
key{{ $k }}: {{ quote $v }}
{{- end }}
{{- end }}
{{- if or .Values.cloudInit .Values.sshKeys }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "virtual-machine.fullname" . }}-cloud-init
stringData:
userdata: |
{{- if .Values.cloudInit }}
{{- .Values.cloudInit | nindent 4 }}
{{- else if and (.Values.sshKeys) (not .Values.cloudInit) }}
{{- /*
We usually provide ssh keys in cloud-init metadata, because userdata it not typed and can be used for any purpose.
However, if user provides ssh keys but not cloud-init, we still need to provide a minimal cloud-init config to avoid errors.
*/}}
#cloud-config
ssh_authorized_keys:
{{- range .Values.sshKeys }}
- {{ quote . }}
{{- end }}
{{- end }}
{{- end }}