-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
861 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: vmpools.vmoperator.jdrupes.org | ||
spec: | ||
group: vmoperator.jdrupes.org | ||
# list of versions supported by this CustomResourceDefinition | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
permissions: | ||
type: array | ||
description: >- | ||
Defines permissions for accessing and manipulating the Pool. | ||
items: | ||
type: object | ||
description: >- | ||
Permissions can be granted to a user or to a role. | ||
oneOf: | ||
- required: | ||
- user | ||
- required: | ||
- role | ||
properties: | ||
user: | ||
type: string | ||
role: | ||
type: string | ||
may: | ||
type: array | ||
items: | ||
type: string | ||
enum: | ||
- start | ||
- stop | ||
- reset | ||
- accessConsole | ||
- "*" | ||
default: [] | ||
required: | ||
- permissions | ||
# either Namespaced or Cluster | ||
scope: Namespaced | ||
names: | ||
# plural name to be used in the URL: /apis/<group>/<version>/<plural> | ||
plural: vmpools | ||
# singular name to be used as an alias on the CLI and for display | ||
singular: vmpool | ||
# kind is normally the CamelCased singular type. Your resource manifests use this. | ||
kind: VmPool | ||
listKind: VmPoolList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
/test-vm-ci.yaml | ||
/kubeconfig.yaml | ||
/crds/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
function usage() { | ||
cat >&2 <<EOF | ||
Usage: $0 [OPTION]... [TEMPLATE] | ||
Generate VM CRDs using TEMPLATE. | ||
-c, --count Count of VMs to generate | ||
-d, --destination DIR Generate into given directory (default: ".") | ||
-h, --help Print this help | ||
-p, --prefix PREFIX Prefix for generated file (default: basename of template) | ||
EOF | ||
exit 1 | ||
} | ||
|
||
count=0 | ||
destination=. | ||
template="" | ||
prefix="" | ||
|
||
while [ "$#" -gt 0 ]; do | ||
case "$1" in | ||
-c|--count) shift; count=$1;; | ||
-d|--destination) shift; destination="$1";; | ||
-h|--help) shift; usage;; | ||
-p|--prefix) shift; prefix="$1";; | ||
-*) echo >&2 "Unknown option: $1"; exit 1;; | ||
*) template="$1";; | ||
esac | ||
shift | ||
done | ||
|
||
if [ -z "$template" ]; then | ||
usage | ||
fi | ||
|
||
if [ "$count" = "0" ]; then | ||
exit 0 | ||
fi | ||
for number in $(seq 1 $count); do | ||
if [ -z "$prefix" ]; then | ||
prefix=$(basename $template .tpl.yaml) | ||
fi | ||
name="$prefix$number" | ||
index=$(($number - 1)) | ||
esh -o $destination/$name.yaml $template number=$number index=$index | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: "vmoperator.jdrupes.org/v1" | ||
kind: VmPool | ||
metadata: | ||
namespace: vmop-dev | ||
name: test-vms | ||
spec: | ||
permissions: | ||
- user: admin | ||
may: | ||
- accessConsole |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: snapshot.storage.k8s.io/v1 | ||
kind: VolumeSnapshot | ||
metadata: | ||
namespace: vmop-dev | ||
name: test-vm-system-disk-snapshot | ||
spec: | ||
volumeSnapshotClassName: csi-rbdplugin-snapclass | ||
source: | ||
persistentVolumeClaimName: test-vm-system-disk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
apiVersion: "vmoperator.jdrupes.org/v1" | ||
kind: VirtualMachine | ||
metadata: | ||
namespace: vmop-dev | ||
name: test-vm<%= ${number} %> | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "20" | ||
|
||
spec: | ||
image: | ||
# repository: docker-registry.lan.mnl.de | ||
# path: vmoperator/org.jdrupes.vmoperator.runner.qemu-arch | ||
# pullPolicy: Always | ||
# repository: ghcr.io | ||
# path: mnlipp/org.jdrupes.vmoperator.runner.qemu-alpine | ||
# version: "3.0.0" | ||
source: registry.mnl.de/org/jdrupes/vm-operator/org.jdrupes.vmoperator.runner.qemu-arch:testing | ||
pullPolicy: Always | ||
|
||
permissions: | ||
- role: admin | ||
may: | ||
- "*" | ||
- user: test | ||
may: | ||
- accessConsole | ||
|
||
guestShutdownStops: true | ||
|
||
cloudInit: | ||
metaData: {} | ||
|
||
pools: | ||
- test-vms | ||
|
||
vm: | ||
# state: Running | ||
bootMenu: true | ||
maximumCpus: 4 | ||
currentCpus: 2 | ||
maximumRam: 4Gi | ||
currentRam: 3Gi | ||
|
||
networks: | ||
# No bridge on TC1 | ||
# - tap: {} | ||
- user: {} | ||
|
||
disks: | ||
- volumeClaimTemplate: | ||
metadata: | ||
name: system | ||
spec: | ||
storageClassName: ceph-rbd3slow | ||
dataSource: | ||
name: test-vm-system-disk-snapshot | ||
kind: VolumeSnapshot | ||
apiGroup: snapshot.storage.k8s.io | ||
accessModes: | ||
- ReadWriteOnce | ||
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 | ||
|
||
display: | ||
spice: | ||
port: <%= $((5910 + number)) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.