Skip to content

switch to minikube

switch to minikube #37

Workflow file for this run

name: test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
kind:
image: kindest/node:v1.30.0
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: false
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
- name: Install Minikube
run curl -LO "https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64"
install minikube-linux-amd64 /tmp/
/tmp/minikube-linux-amd64 config set WantUpdateNotification false
/tmp/minikube-linux-amd64 start --driver=docker
# - name: Set up kind
# run: |
# curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
# chmod +x ./kind
# sudo mv ./kind /usr/local/bin/kind
#
# - name: Create Kubernetes cluster
# run: kind create cluster --wait 5m
- name: Create StorageClass, test PVCs and PODs
run: |
kubectl apply -f test/pvc-1.yaml
kubectl apply -f test/pvc-2.yaml
kubectl apply -f test/pod-1.yaml
kubectl apply -f test/pod-2.yaml
- name: Install SSHFS
run: sudo apt-get update && sudo apt-get install -y sshfs --no-install-recommends --no-install-suggests
- name: Build pv-mounter
run: make bin
- name: Create mountpoint
run: mkdir foo
- name: Check state of test objects again
run: |
end=$((SECONDS+10)); while [[ $(kubectl get pvc pvc-1 -o 'jsonpath={..status.phase}') != "Bound" && SECONDS -lt $end ]]; do echo "waiting for pvc-1 status" && sleep 1; done
end=$((SECONDS+10)); while [[ $(kubectl get pvc pvc-2 -o 'jsonpath={..status.phase}') != "Bound" && SECONDS -lt $end ]]; do echo "waiting for pvc-2 status" && sleep 1; done
end=$((SECONDS+10)); while [[ $(kubectl get pod pod-1 -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}') != "True" && SECONDS -lt $end ]]; do echo "waiting for pod-1 status" && sleep 1; done
end=$((SECONDS+10)); while [[ $(kubectl get pod pod-2 -o 'jsonpath={.status.conditions[?(@.type=="Ready")].status}') != "True" && SECONDS -lt $end ]]; do echo "waiting for pod-2 status" && sleep 1; done
kubectl describe pvc pvc-1
kubectl describe pvc pvc-2
kubectl describe pod pod-1
kubectl describe pod pod-2
- name: Run tests
run: |
echo 'Shared PVC with RWO access mode'
./bin/pv-mounter mount default pvc-1 foo
touch foo/bar
ls -l foo/bar
./bin/pv-mounter clean default pvc-1 foo
echo 'Unmounted PVC with RWO access mode'
./bin/pv-mounter mount default pvc-2 foo
touch foo/bar
ls -l foo/bar
./bin/pv-mounter clean default pvc-2 foo
- name: Delete PODs and PVCs
run: |
kubectl delete -f test/pod-1.yaml
kubectl delete -f test/pod-2.yaml
kubectl delete -f test/pvc-1.yaml
kubectl delete -f test/pvc-2.yaml
- name: Delete cluster
run: kind delete cluster