Skip to content

Commit

Permalink
Support cloudInit in CRD.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Feb 18, 2024
1 parent 499c182 commit b255f0e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
15 changes: 15 additions & 0 deletions deploy/crds/vms-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,21 @@ spec:
additionalProperties:
type: string
nullable: true
cloudInit:
type: object
description: >-
Provides data for generating a cloud-init ISO
image that is attached to the VM.
properties:
metaData:
description: Copied to cloud-init's meta-data file.
type: object
additionalProperties:
type: string
userData:
description: Copied to cloud-init's user-data file.
type: object
x-kubernetes-preserve-unknown-fields: true
vm:
type: object
description: Defines the VM.
Expand Down
1 change: 1 addition & 0 deletions dev-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/test-vm-ci.yaml
30 changes: 30 additions & 0 deletions dev-example/test-vm-shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
kind: Pod
apiVersion: v1
metadata:
name: test-vm-shell
namespace: vmop-dev
spec:
volumes:
- name: test-vm-system-disk
persistentVolumeClaim:
claimName: system-disk-test-vm-0
- name: vmop-image-repository
persistentVolumeClaim:
claimName: vmop-image-repository
containers:
- name: test-vm-shell
image: archlinux/archlinux
args:
- bash
imagePullPolicy: Always
stdin: true
stdinOnce: true
tty: true
volumeDevices:
- name: test-vm-system-disk
devicePath: /dev/test-vm-system-disk
volumeMounts:
- name: vmop-image-repository
mountPath: /var/local/vmop-image-repository
securityContext:
privileged: true
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,22 @@ data:
<#if cr.spec.runnerTemplate?? && cr.spec.runnerTemplate.update?? >
updateTemplate: ${ cr.spec.runnerTemplate.update.asBoolean?c }
</#if>
# Forward the cloud-init data if provided
<#if cr.spec.cloudInit??>
cloudInit:
<#if cr.spec.cloudInit.metaData??>
metaData: ${ cr.spec.cloudInit.metaData.toString() }
<#else>
metaData: {}
</#if>
<#if cr.spec.cloudInit.userData??>
userData: ${ cr.spec.cloudInit.userData.toString() }
<#else>
userData: {}
</#if>
</#if>
# Define the VM (required)
vm:
# The VM's name (required)
Expand Down

0 comments on commit b255f0e

Please sign in to comment.