Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Add sample optimized for ramen test environment
Browse files Browse the repository at this point in the history
This VM can be used to test DR flows in ramen minikube based test
environment running on a laptop.

Changes:
- Use latest cirros (0.6.2) from my repo that will be customized for
  testing ramen[2]
- Use executable userData since cirros does not support #cloud-config
- Inject ssh public key from secret
- Storage class used by ramen test environment
- Use bridge interface (see issue[1])
- Separate pvc and source resources
- Minimize memory allocation and disk size to make it easier to run with
  limited resources
- Use common labels to apply appname= label to all resources

[1] kubevirt/kubevirt#9059
[2] RamenDR/ramen#1105
  • Loading branch information
nirs committed Oct 25, 2023
1 parent 0ecd3c6 commit 460d5d7
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vm-standalone-pvc-k8s/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
resources:
- source.yaml
- pvc.yaml
- vm.yaml
commonLabels:
appname: vm-standalone-dv-odr-regional
17 changes: 17 additions & 0 deletions vm-standalone-pvc-k8s/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sample-vm-pvc
spec:
dataSourceRef:
apiGroup: cdi.kubevirt.io
kind: VolumeImportSource
name: cirros-source
accessModes:
- ReadWriteMany
resources:
requests:
storage: 128Mi
storageClassName: rook-ceph-block
volumeMode: Block
11 changes: 11 additions & 0 deletions vm-standalone-pvc-k8s/source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: cdi.kubevirt.io/v1beta1
kind: VolumeImportSource
metadata:
name: cirros-source
spec:
source:
registry:
# Image customized for ramen testing.
# TODO: Consume from ramendr repo when available.
url: "docker://quay.io/nirsof/cirros:0.6.2"
64 changes: 64 additions & 0 deletions vm-standalone-pvc-k8s/vm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: sample-vm
spec:
running: true
template:
metadata:
annotations:
vm.kubevirt.io/flavor: small
vm.kubevirt.io/os: fedora
vm.kubevirt.io/workload: server
labels:
kubevirt.io/size: small
spec:
domain:
cpu:
cores: 1
sockets: 1
threads: 1
devices:
disks:
- disk:
bus: virtio
name: rootdisk
- name: cloudinit
disk: {}
interfaces:
- macAddress: 02:69:36:00:00:00
bridge: {}
model: virtio
name: default
networkInterfaceMultiqueue: true
rng: {}
features:
acpi: {}
machine:
type: pc-q35-rhel8.6.0
resources:
requests:
# Match cirros-source memory requirements.
# See https://github.com/cirros-dev/cirros/issues/53
memory: 256Mi
evictionStrategy: LiveMigrate
networks:
- name: default
pod: {}
terminationGracePeriodSeconds: 180
accessCredentials:
- sshPublicKey:
source:
secret:
secretName: my-public-key
propagationMethod:
configDrive: {}
volumes:
- name: rootdisk
persistentVolumeClaim:
claimName: sample-vm-pvc
- name: cloudinit
cloudInitConfigDrive:
userData: |
#!/bin/sh
echo "Running user-data script"

0 comments on commit 460d5d7

Please sign in to comment.