[virtual-machine] Fix cloudInit and sshKeys

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil
2025-07-09 08:05:41 +02:00
parent 699d38d8b9
commit c831f53444
6 changed files with 26 additions and 43 deletions

View File

@@ -9,7 +9,7 @@ stringData:
key{{ $k }}: {{ quote $v }}
{{- end }}
{{- end }}
{{- if .Values.cloudInit }}
{{- if or .Values.cloudInit .Values.sshKeys }}
---
apiVersion: v1
kind: Secret
@@ -17,5 +17,13 @@ metadata:
name: {{ include "virtual-machine.fullname" . }}-cloud-init
stringData:
userdata: |
{{- .Values.cloudInit | nindent 4 }}
{{- if .Values.cloudInit }}
{{- .Values.cloudInit | nindent 4 }}
{{- else if and (.Values.sshKeys) (not .Values.cloudInit) }}
#cloud-config
ssh_authorized_keys:
{{- range .Values.sshKeys }}
- {{ quote . }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -92,7 +92,7 @@ spec:
- disk:
bus: scsi
name: systemdisk
{{- if .Values.sshKeys }}
{{- if or .Values.cloudInit .Values.sshKeys }}
- disk:
bus: virtio
name: cloudinitdisk
@@ -122,28 +122,11 @@ spec:
- name: systemdisk
dataVolume:
name: {{ include "virtual-machine.fullname" . }}
{{- if and .Values.sshKeys .Values.cloudInit }}
{{- if or .Values.cloudInit .Values.sshKeys }}
- name: cloudinitdisk
cloudInitNoCloud:
secretRef:
name: {{ include "virtual-machine.fullname" . }}-cloud-init
{{- else if .Values.sshKeys }}
- name: cloudinitdisk
cloudInitNoCloud:
userData: |
{{ printf "%s" "#cloud-config" }}
ssh_authorized_keys:
{{- range .Values.sshKeys }}
- {{ . }}
{{- end }}
chpasswd:
expire: false
{{- else }}
- name: cloudinitdisk
cloudInitNoCloud:
userData: |
{{ printf "%s" "#cloud-config" }}
{{- end }}
networks:

View File

@@ -9,7 +9,7 @@ stringData:
key{{ $k }}: {{ quote $v }}
{{- end }}
{{- end }}
{{- if .Values.cloudInit }}
{{- if or .Values.cloudInit .Values.sshKeys }}
---
apiVersion: v1
kind: Secret
@@ -17,5 +17,13 @@ metadata:
name: {{ include "virtual-machine.fullname" . }}-cloud-init
stringData:
userdata: |
{{- .Values.cloudInit | nindent 4 }}
{{- if .Values.cloudInit }}
{{- .Values.cloudInit | nindent 4 }}
{{- else if and (.Values.sshKeys) (not .Values.cloudInit) }}
#cloud-config
ssh_authorized_keys:
{{- range .Values.sshKeys }}
- {{ quote . }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -68,7 +68,7 @@ spec:
{{- fail (printf "Specified disk not exists in cluster: %s" .name) }}
{{- end }}
{{- end }}
{{- if or .Values.sshKeys .Values.cloudInit }}
{{- if or .Values.cloudInit .Values.sshKeys }}
- name: cloudinitdisk
disk:
bus: virtio
@@ -95,27 +95,11 @@ spec:
dataVolume:
name: vm-disk-{{ .name }}
{{- end }}
{{- if and .Values.sshKeys .Values.cloudInit }}
{{- if or .Values.cloudInit .Values.sshKeys }}
- name: cloudinitdisk
cloudInitNoCloud:
secretRef:
name: {{ include "virtual-machine.fullname" . }}-cloud-init
{{- else if .Values.sshKeys }}
- name: cloudinitdisk
cloudInitNoCloud:
userData: |
{{ printf "%s" "#cloud-config" }}
ssh_authorized_keys:
{{- range .Values.sshKeys }}
- {{ . }}
{{- end }}
chpasswd:
expire: false
{{- else }}
- name: cloudinitdisk
cloudInitNoCloud:
userData: |
{{ printf "%s" "#cloud-config" }}
{{- end }}
networks:
- name: default

View File

@@ -1,7 +1,7 @@
FROM bitnami/node:20.15.1 AS build
WORKDIR /app
ARG COMMIT_REF=6856b66f9244ef1b2703a2f30899366e0ba040de
ARG COMMIT_REF=e1382f51c6db1bca0a8ecd454407c8e282fe0243
RUN wget -O- https://github.com/cozystack/kubeapps/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=2 kubeapps-${COMMIT_REF}/dashboard
RUN yarn install --frozen-lockfile

View File

@@ -4,7 +4,7 @@
# syntax = docker/dockerfile:1
FROM alpine AS source
ARG COMMIT_REF=6856b66f9244ef1b2703a2f30899366e0ba040de
ARG COMMIT_REF=e1382f51c6db1bca0a8ecd454407c8e282fe0243
RUN apk add --no-cache patch
WORKDIR /source
RUN wget -O- https://github.com/cozystack/kubeapps/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=1