Add/update example configurations.

This commit is contained in:
Michael Lipp 2023-08-11 12:22:26 +02:00
parent 40a005329f
commit 3c5b7334a8
8 changed files with 156 additions and 18 deletions

15
dev-example/Readme.md Normal file
View file

@ -0,0 +1,15 @@
# Example setup for development
The CRD must be deployed independently. Apart from that, the
`kustomize.yaml`
* creates a small image repository and
* deploys the operator in namespace `vmop-dev` with a replica of 0.
This allows you to run the manager in your IDE.
The `kustomize.yaml` also changes the image repository for the
operator to a private repository for development. You have to
either remove this or adapt it to your own repository if you
also want to test your development version in a container.

View file

@ -0,0 +1,35 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../deploy
namespace: vmop-dev
patches:
- patch: |-
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: vmop-image-repository
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: local-path
- target:
group: apps
version: v1
kind: Deployment
name: vm-operator
patch: |-
- op: replace
path: /spec/template/spec/containers/0/image
value: docker-registry.lan.mnl.de/vmoperator/org.jdrupes.vmoperator.manager:latest
- op: replace
path: /spec/replicas
value: 0

View file

@ -0,0 +1,28 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: test-vm-system
labels:
app.kubernetes.io/name: vmrunner
app.kubernetes.io/instance: test-vm
vmrunner.jdrupes.org/disk: system
spec:
capacity:
storage: 40Gi
volumeMode: Block
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
claimRef:
name: system-disk-test-vm-0
namespace: qemu-vms
local:
path: /dev/vgmain/test-vm
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- olymp

45
dev-example/test-vm.yaml Normal file
View file

@ -0,0 +1,45 @@
apiVersion: "vmoperator.jdrupes.org/v1"
kind: VirtualMachine
metadata:
namespace: vmop-dev
name: test-vm
spec:
image:
repository: docker-registry.lan.mnl.de
path: vmoperator/org.jdrupes.vmoperator.runner.qemu-arch
pullPolicy: Always
vm:
state: Running
bootMenu: yes
maximumRam: "8 GiB"
currentRam: "4 GiB"
maximumCpus: 4
currentCpus: 4
networks:
- tap:
mac: "00:16:3e:33:59:10"
disks:
- volumeClaimTemplate:
metadata:
name: system
spec:
storageClassName: ""
selector:
matchLabels:
app.kubernetes.io/name: vmrunner
app.kubernetes.io/instance: test-vm
vmrunner.jdrupes.org/disk: system
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"
# - hostDevice: /dev/vgmain/test-vm
display:
spice:
port: 5910

10
example/Readme.md Normal file
View file

@ -0,0 +1,10 @@
# Example setup for development
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 `kustomize.yaml` does not include the test VM. Before creating
the test VM, you will again most likely want to change the
disk definition.

View file

@ -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

View file

@ -1,7 +1,7 @@
apiVersion: "vmoperator.jdrupes.org/v1"
kind: VirtualMachine
metadata:
namespace: qemu-vms
namespace: vmop-demo
name: test-vm
spec:
@ -14,7 +14,7 @@ spec:
vm:
maximumCpus: 4
currentCpus: 4
currentCpus: 3
maximumRam: "8 GiB"
currentRam: "4 GiB"
@ -36,7 +36,6 @@ spec:
requests:
storage: 40Gi
# - hostDevice: /dev/vgmain/test-vm
display:
spice:
port: 5910

View file

@ -1,15 +0,0 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: vmop-image-repository
namespace: qemu-vms
labels:
app.kubernetes.io/name: vmoperator
spec:
storageClassName: rook-cephfs
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi