From 6cf5ecadc287c16832ddbb66e9aaf7573a441ca8 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Tue, 15 Aug 2023 09:51:59 +0200 Subject: [PATCH] Support template configuration. --- deploy/crds/vms-crd.yaml | 9 +++++++++ dev-example/test-vm.yaml | 3 +++ .../org/jdrupes/vmoperator/manager/runnerConfig.ftl.yaml | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/deploy/crds/vms-crd.yaml b/deploy/crds/vms-crd.yaml index 50074cb..e5ae82f 100644 --- a/deploy/crds/vms-crd.yaml +++ b/deploy/crds/vms-crd.yaml @@ -914,6 +914,15 @@ spec: type: array type: object type: object + runnerTemplate: + description: >- + Runner template configuration. + type: object + properties: + source: + type: string + update: + type: boolean vm: type: object description: Defines the VM. diff --git a/dev-example/test-vm.yaml b/dev-example/test-vm.yaml index ccc354a..673dbcb 100644 --- a/dev-example/test-vm.yaml +++ b/dev-example/test-vm.yaml @@ -9,6 +9,9 @@ spec: path: vmoperator/org.jdrupes.vmoperator.runner.qemu-arch pullPolicy: Always + runnerTemplate: + update: true + vm: state: Running bootMenu: yes diff --git a/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerConfig.ftl.yaml b/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerConfig.ftl.yaml index 7a9c1df..eb05f4d 100644 --- a/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerConfig.ftl.yaml +++ b/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerConfig.ftl.yaml @@ -27,10 +27,15 @@ data: # The template to use. Resolved relative to /usr/share/vmrunner/templates. # template: "Standard-VM-latest.ftl.yaml" + <#if cr.spec.runnerTemplate?? && cr.spec.runnerTemplate.source?? > + template: ${ cr.spec.runnerTemplate.source.asString } + # The template is copied to the data diretory when the VM starts for # the first time. Subsequent starts use the copy unless this option is set. - updateTemplate: true + <#if cr.spec.runnerTemplate?? && cr.spec.runnerTemplate.update?? > + updateTemplate: ${ cr.spec.runnerTemplate.update.asBoolean?c } + # Define the VM (required) vm: