1313jobs :
1414 build :
1515 name : Build
16- runs-on : ubuntu-22.04
16+ runs-on : ubuntu-latest
1717 steps :
18- - name : Checkout
19- uses : actions/checkout@v3
18+ - uses : actions/checkout@v6
2019 with :
20+ # needed for git describe --tags
2121 fetch-depth : 0
22- - name : Set up Go 1.20
23- id : go
24- uses : actions/setup-go@v2
25- with :
26- go-version : 1.20.4
27- - name : Set up Docker Buildx
28- id : buildx
29- uses : crazy-max/ghaction-docker-buildx@v1
22+ - uses : actions/setup-go@v6
3023 with :
31- buildx-version : latest
32- qemu-version : latest
33- - name : Login to GitHub Container Registry
34- uses : docker/login-action@v2
24+ go-version-file : ' go.mod'
25+ - uses : docker/login-action@v4
3526 with :
3627 registry : ghcr.io
3728 username : ${{ github.actor }}
3829 password : ${{ secrets.GITHUB_TOKEN }}
39- - name : Available platforms
40- run : echo ${{ steps.buildx.outputs.platforms }}
4130 - name : Build images
4231 run : |
4332 set -x
@@ -52,123 +41,68 @@ jobs:
5241 echo "docker build -t ghcr.io/kilnfi/carina:scheduler-${tag} ."
5342 docker build -t "ghcr.io/kilnfi/carina:scheduler-${tag}" .
5443 # Interactive debug
55- # - name: Setup tmate session
56- # uses: mxschmitt/action-tmate@v3
57- # with:
58- # detached: true
44+ - name : Setup tmate session
45+ uses : mxschmitt/action-tmate@v3
46+ with :
47+ detached : true
48+ - name : Create KinD cluster
49+ if : github.ref_name != 'main'
50+ uses : helm/kind-action@v1.14.0
51+ with :
52+ cluster_name : kind
5953 - name : Test Kubernetes
60- if : github.ref != 'refs/heads/ main'
54+ if : github.ref_name != 'main'
6155 run : |
6256 set -x
63- exec 2>&1
64- git fetch origin
6557 tag="$(git describe --tags)"
58+ kind load docker-image "ghcr.io/kilnfi/carina:controller-${tag}" "ghcr.io/kilnfi/carina:scheduler-${tag}"
6659
67- # Cluster
68- curl -s -L -o k3s https://github.com/k3s-io/k3s/releases/download/v1.32.3%2Bk3s1/k3s
69- chmod +x k3s
70- sudo ./k3s server --disable coredns,servicelb,traefik,metrics-server --write-kubeconfig "$(pwd)/kubeconfig" --write-kubeconfig-mode 777 > k3s_log 2>&1 &
71- export KUBECONFIG="$(pwd)/kubeconfig"
72- # Wait init
73- while true; do ./k3s kubectl get deploy -n kube-system local-path-provisioner && break; sleep 5; done
74- docker save "ghcr.io/kilnfi/carina:scheduler-${tag}" "ghcr.io/kilnfi/carina:controller-${tag}" | sudo ./k3s ctr image import -
75-
76- # Debug output
77- debug() {
78- set +e
79- ./k3s kubectl get po -A
80- ./k3s kubectl get pvc -A
81- ./k3s kubectl get nodestorageresource -A -o yaml
82- ./k3s kubectl logs -n carina --tail=200 -l app.kubernetes.io/instance=carina-csi-driver --all-containers=true
83- ./k3s kubectl get po -n carina -o yaml > carina_pods_log 2>&1
84- ./k3s kubectl logs -n carina --tail=10000 -l app.kubernetes.io/instance=carina-csi-driver --all-containers=true > carina_log 2>&1
85- #tail -200 k3s_log
86- }
87- trap debug EXIT
88-
89- # Carina install
90- ./k3s kubectl create ns carina
91- sed -i -e 's/__TAG__/'"${tag}"'/' .github/kiln-values.yaml
92- helm upgrade --install -n carina carina-csi-driver charts/ -f .github/kiln-values.yaml
93-
94- # Wait deploy
95- ./k3s kubectl rollout status -n carina --watch --timeout=200s ds/csi-carina-node
96- ./k3s kubectl wait po -n carina -l app=csi-carina-node --for=condition=ready --timeout=200s
60+ # Install carina without a device first — we need the carina-node
61+ # daemonset running to create a fake block device inside it.
62+ sed -i -e "s/__TAG__/${tag}/" .github/kiln-values.yaml
63+ helm upgrade --install --create-namespace -n carina carina-csi-driver charts/ -f .github/kiln-values.yaml --wait --timeout=20m
9764
98- # Update device
99- device=$(./k3s kubectl exec -t -n carina ds/csi-carina-node -c csi-carina-node -- sh -c 'truncate --size=12G /tmp/disk.device; losetup --show -f /tmp/disk.device')
100- sed -i -e 's/__DEVICE__/'"${device#/dev/}"'/' .github/kiln-values.yaml
101- helm upgrade --install -n carina carina-csi-driver charts/ -f .github/kiln-values.yaml
65+ # Create a 12G loopback device inside carina-node to simulate a disk,
66+ # then re-install with the device configured and initialize LVM on it.
67+ device="$(kubectl exec -t -n carina ds/csi-carina-node -c csi-carina-node -- \
68+ sh -c 'truncate --size=12G /tmp/disk.device; losetup --show -f /tmp/disk.device')"
69+ sed -i -e "s/__DEVICE__/${device#/dev/}/" .github/kiln-values.yaml
70+ kubectl exec -t -n carina ds/csi-carina-node -c csi-carina-node -- \
71+ sh -c "pvcreate ${device}"
72+ helm upgrade --install -n carina carina-csi-driver charts/ -f .github/kiln-values.yaml --wait --timeout=200s
10273
103- # Refresh
104- sleep 60
105- ./k3s kubectl rollout restart -n carina deployment carina-csi-driver-carina-scheduler
106- ./k3s kubectl rollout restart -n carina deployment csi-carina-controller
107- ./k3s kubectl exec -t -n carina ds/csi-carina-node -c csi-carina-node -- sh -c 'pvcreate '"${device}"'; kill 1'
108-
109- # Test
110- helm test -n carina carina-csi-driver
111- ./k3s kubectl wait -n carina --for=jsonpath='{.status.phase}'=Bound pvc/carina-vg-ssd-testpvc --timeout=500s
112- ./k3s kubectl wait -n carina --for=condition=ready po -l storageclass=carina-vg-ssd --timeout=500s
113-
114-
115- # Test filter logging
116- ./k3s kubectl taint nodes -l node-role.kubernetes.io/control-plane=true test=off:NoSchedule
117- ./k3s kubectl delete po -n carina -l storageclass=carina-vg-ssd
118- sleep 30
119- grep "Filter plugin unsuccessfull on node" < <(./k3s kubectl logs -n carina --tail=10000 -l app.kubernetes.io/instance=carina-csi-driver --all-containers=true)
120- - name : ' Upload Artifact'
121- uses : actions/upload-artifact@v4
122- if : always()
123- with :
124- name : k3s_log
125- path : k3s_log
126- retention-days : 5
127- - name : ' Upload Artifact'
128- uses : actions/upload-artifact@v4
129- if : always()
130- with :
131- name : carina_log
132- path : carina_log
133- retention-days : 5
134- - name : ' Upload Artifact'
135- uses : actions/upload-artifact@v4
136- if : always()
137- with :
138- name : carina_pods_log
139- path : carina_pods_log
140- retention-days : 5
74+ # Run the helm test — creates a PVC and a pod that uses carina storage.
75+ helm test -n carina carina-csi-driver --timeout=500s
76+ - name : Waot
77+ run : sleep 20m
14178 - name : Push image
142- if : github.ref == 'refs/heads/ main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
79+ if : github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
14380 run : |
14481 set -x
145- git fetch origin
14682 tag="$(git describe --tags)"
14783
14884 docker push "ghcr.io/kilnfi/carina:controller-${tag}"
14985 docker push "ghcr.io/kilnfi/carina:scheduler-${tag}"
15086
15187 helm :
15288 name : Helm chart
153- runs-on : ubuntu-22.04
89+ runs-on : ubuntu-latest
15490 steps :
15591 - name : Checkout
156- uses : actions/checkout@v3
92+ uses : actions/checkout@v6
15793 with :
94+ # needed for git describe --tags
15895 fetch-depth : 0
159- - name : Install Helm
160- uses : azure/setup-helm@v3
16196 - name : Login to GitHub Container Registry
162- uses : docker/login-action@v2
97+ uses : docker/login-action@v4
16398 with :
16499 registry : ghcr.io
165100 username : ${{ github.actor }}
166101 password : ${{ secrets.GITHUB_TOKEN }}
167102 - name : Push chart
168- if : github.ref == 'refs/heads/ main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
103+ if : github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
169104 run : |
170105 set -x
171- git fetch origin
172106 tag="$(git describe --tags)"
173107
174108 sed -i -r "s/^(appV|v)ersion *:.*$/\1ersion: $tag/" charts/Chart.yaml
0 commit comments