From 8acd98d703414719396b7feec44d652a59ca1461 Mon Sep 17 00:00:00 2001 From: "Michael N. Lipp" Date: Sat, 12 Aug 2023 18:27:22 +0200 Subject: [PATCH] Add example configurations. --- example/local-path/Readme.md | 18 ++++++++---- example/local-path/kustomization.yaml | 26 ++++++++--------- example/local-path/test-vm.yaml | 8 ++++-- example/rook-ceph/Readme.md | 15 ++++++++++ example/rook-ceph/kustomization.yaml | 21 ++++++++++++++ example/rook-ceph/test-vm.yaml | 40 +++++++++++++++++++++++++++ 6 files changed, 107 insertions(+), 21 deletions(-) create mode 100644 example/rook-ceph/Readme.md create mode 100644 example/rook-ceph/kustomization.yaml create mode 100644 example/rook-ceph/test-vm.yaml diff --git a/example/local-path/Readme.md b/example/local-path/Readme.md index d8336f8..603289c 100644 --- a/example/local-path/Readme.md +++ b/example/local-path/Readme.md @@ -1,10 +1,16 @@ -# Example setup for development +# Example setup -The CRD must be deployed independently. Apart from that, the -`kustomize.yaml` defines a namespace for the manager (and the VMs -managed by it). You will most likely want to patch the PVC -for the image repository. +The CRD must be deployed independently. + +```sh +kubectl apply -f https://github.com/mnlipp/VM-Operator/raw/main/deploy/crds/vms-crd.yaml +``` + +Apart from that, the `kustomize.yaml` defines a namespace for the manager +(and the VMs managed by it) and patches the repository PVC to create +a small volume using local-path. The `kustomize.yaml` does not include the test VM. Before creating the test VM, you will again most likely want to change the -disk definition. +disk definition. The sample file uses a reference to some +manually allocated PV. diff --git a/example/local-path/kustomization.yaml b/example/local-path/kustomization.yaml index bb05a82..f3bd76d 100644 --- a/example/local-path/kustomization.yaml +++ b/example/local-path/kustomization.yaml @@ -6,16 +6,16 @@ resources: namespace: vmop-demo -# patches: -# - patch: |- -# kind: PersistentVolumeClaim -# apiVersion: v1 -# metadata: -# name: vmop-image-repository -# spec: -# accessModes: -# - ReadWriteOnce -# resources: -# requests: -# storage: 10Gi -# storageClassName: local-path +patches: +- patch: |- + kind: PersistentVolumeClaim + apiVersion: v1 + metadata: + name: vmop-image-repository + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + storageClassName: local-path diff --git a/example/local-path/test-vm.yaml b/example/local-path/test-vm.yaml index 8a9f8e8..2d32f1c 100644 --- a/example/local-path/test-vm.yaml +++ b/example/local-path/test-vm.yaml @@ -14,12 +14,12 @@ spec: vm: maximumCpus: 4 - currentCpus: 3 + currentCpus: 2 maximumRam: "8 GiB" currentRam: "4 GiB" networks: - - tap: {} + - user: {} disks: - volumeClaimTemplate: @@ -35,6 +35,10 @@ spec: resources: requests: storage: 40Gi + - cdrom: + image: "" + # image: https://download.fedoraproject.org/pub/fedora/linux/releases/38/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-38-1.6.iso + # image: "Fedora-Workstation-Live-x86_64-38-1.6.iso" display: spice: diff --git a/example/rook-ceph/Readme.md b/example/rook-ceph/Readme.md new file mode 100644 index 0000000..13fbf81 --- /dev/null +++ b/example/rook-ceph/Readme.md @@ -0,0 +1,15 @@ +# Example setup + +The CRD must be deployed independently. + +```sh +kubectl apply -f https://github.com/mnlipp/VM-Operator/raw/main/deploy/crds/vms-crd.yaml +``` + +Apart from that, the `kustomize.yaml` defines a namespace for the manager +(and the VMs managed by it) and patches the repository PVC to create +a small volume using a ceph fs. + +The `kustomize.yaml` does not include the test VM. Before creating +the test VM, you will again most likely want to change the +disk definition. The sample file claims a ceph block device. diff --git a/example/rook-ceph/kustomization.yaml b/example/rook-ceph/kustomization.yaml new file mode 100644 index 0000000..f3bd76d --- /dev/null +++ b/example/rook-ceph/kustomization.yaml @@ -0,0 +1,21 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- https://github.com/mnlipp/VM-Operator/deploy + +namespace: vmop-demo + +patches: +- patch: |- + kind: PersistentVolumeClaim + apiVersion: v1 + metadata: + name: vmop-image-repository + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + storageClassName: local-path diff --git a/example/rook-ceph/test-vm.yaml b/example/rook-ceph/test-vm.yaml new file mode 100644 index 0000000..355a20c --- /dev/null +++ b/example/rook-ceph/test-vm.yaml @@ -0,0 +1,40 @@ +apiVersion: "vmoperator.jdrupes.org/v1" +kind: VirtualMachine +metadata: + namespace: vmop-demo + name: test-vm +spec: + + image: + # Defaults: + # repository: ghcr.io + # path: mnlipp/org.jdrupes.vmoperator.runner.qemu-arch + # version: latest + pullPolicy: Always + + vm: + maximumCpus: 4 + currentCpus: 2 + maximumRam: "8 GiB" + currentRam: "4 GiB" + + networks: + - user: {} + + disks: + - volumeClaimTemplate: + metadata: + name: test-vm-system + spec: + storageClassName: rook-ceph-block + resources: + requests: + storage: 40Gi + - cdrom: + # image: "" + image: https://download.fedoraproject.org/pub/fedora/linux/releases/38/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-38-1.6.iso + # image: "Fedora-Workstation-Live-x86_64-38-1.6.iso" + + display: + spice: + port: 5910