From e1ea5f473dea481b84948aa50ce688d25e6b8915 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Sat, 12 Aug 2023 23:26:33 +0200 Subject: [PATCH] Support alternate image specification. --- deploy/crds/vms-crd.yaml | 16 ++++++++++++++-- .../vmoperator/manager/runnerSts.ftl.yaml | 8 +++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/deploy/crds/vms-crd.yaml b/deploy/crds/vms-crd.yaml index 834c2cd..e467eb2 100644 --- a/deploy/crds/vms-crd.yaml +++ b/deploy/crds/vms-crd.yaml @@ -20,7 +20,16 @@ spec: description: >- The image to use for the pod. Must run a runner. type: object + oneOf: + - properties: + source: {} + path: {} properties: + source: + description: >- + The image to use for the pod. Must run a "runner". + type: string + default: "ghcr.io/mnlipp/org.jdrupes.vmoperator.runner.qemu-arch:latest" repository: type: string default: "ghcr.io" @@ -31,9 +40,12 @@ spec: type: string default: "latest" pullPolicy: + description: >- + Image pull policy. One of Always, Never, IfNotPresent. + Defaults to Always if :latest tag is specified, or IfNotPresent + otherwise. + enum: [ "Always", "Never", "IfNotPresent" ] type: string - enum: [ "IfNotPresent", "Always" ] - default: "IfNotPresent" vm: type: object description: Defines the VM. diff --git a/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerSts.ftl.yaml b/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerSts.ftl.yaml index 963edce..36fa4bc 100644 --- a/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerSts.ftl.yaml +++ b/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerSts.ftl.yaml @@ -29,9 +29,15 @@ spec: containers: - name: ${ cr.metadata.name.asString } <#assign image = cr.spec.image> - image: ${ image.repository.asString }/${ image.path.asString }:${ image.version.asString } + <#if image.repository?? && image.path??> + image: ${ image.repository.asString }/${ image.path.asString }<#if image.version??>:${ image.version.asString } + <#else> + image: ${ source.asString } + resources: {} + <#if image.pullPolicy??> imagePullPolicy: ${ image.pullPolicy.asString } + volumeMounts: # Not needed because pod is priviledged: # - mountPath: /dev/kvm