Skip to content

Commit

Permalink
Adapt arc kubevirt virtual machine template to consume datavolume
Browse files Browse the repository at this point in the history
  • Loading branch information
electrocucaracha committed Nov 22, 2024
1 parent 44dabf6 commit fedd965
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
5 changes: 2 additions & 3 deletions _chart_installers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function _install_chart {
eval "$cmd" "$name" "$chart"
fi

[[ $wait == "true" ]] && wait_for_pods "$namespace"
[[ $wait != "true" ]] || wait_for_pods "$namespace"
}

function _add_helm_repo {
Expand Down Expand Up @@ -279,9 +279,8 @@ function _install_arc_controller {
function install_chart_arc {
! kubectl get crds autoscalinglisteners.actions.github.com >/dev/null && _install_arc_controller

namespace="${KRD_ARC_GITHUB_URL##*/}-runners"
namespace="default"
KRD_CHART_VALUES="githubConfigUrl=$KRD_ARC_GITHUB_URL,githubConfigSecret=gh-runners-token"
! kubectl get namespaces "${namespace}" && kubectl create namespace "${namespace}"
! kubectl get secrets -n "${namespace}" gh-runners-token && kubectl -n "${namespace}" create secret generic gh-runners-token --from-literal=github_token="$KRD_ARC_TOKEN"
! helm get metadata arc-runner-set -n "${namespace}" >/dev/null && _install_chart arc-runner-set oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set "$namespace" "false"
if kubectl get crds virtualmachines.kubevirt.io >/dev/null; then
Expand Down
32 changes: 14 additions & 18 deletions resources/kubevirt-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,27 @@ kind: VirtualMachine
metadata:
name: vm-template
spec:
dataVolumeTemplates:
- metadata:
name: ubuntu-dv
spec:
storage: {}
source:
pvc:
name: ubuntu-img-jammy
runStrategy: Manual
template:
metadata:
name: runner
spec:
architecture: amd64
terminationGracePeriodSeconds: 30
domain:
devices:
filesystems:
- name: runner-info
virtiofs: {}
disks:
- name: containerdisk
- name: os
disk:
bus: virtio
- name: cloudinitdisk
Expand All @@ -35,35 +42,24 @@ spec:
- name: default
masquerade: {}
cpu:
cores: 3
cores: 2
resources:
requests:
memory: 14Gi
memory: 8G
networks:
- name: default
pod: {}
volumes:
- name: containerdisk
containerDisk:
image: quay.io/containerdisks/fedora:latest
- dataVolume:
name: ubuntu-dv
name: os
- name: cloudinitdisk
cloudInitNoCloud:
userData: |-
#cloud-config
users:
- name: runner
homedir: /home/runner
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
mounts:
- [ runner-info, /runner-info/, virtiofs, "rw,relatime,user=runner" ]
packages:
- jq
bootcmd:
- "sudo mkdir /opt/runner"
- "curl -sL https://github.com/actions/runner/releases/download/v2.320.0/actions-runner-linux-x64-2.320.0.tar.gz | sudo tar -xz -C /opt/runner"
- "sudo /opt/runner/bin/installdependencies.sh"
runcmd:
- "sudo chown -R runner: /opt/runner"
- "sudo runuser -l runner -c '/opt/runner/run.sh --jitconfig $(jq -r '.jitconfig' /runner-info/runner-info.json)'"
power_state:
delay: now
Expand Down

0 comments on commit fedd965

Please sign in to comment.