Skip to content

fix(notready): condition failed #99

fix(notready): condition failed

fix(notready): condition failed #99

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go 1.20
id: go
uses: actions/setup-go@v2
with:
go-version: 1.20.4
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
qemu-version: latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Build images
run: |
set -x
git fetch origin
tag="$(git describe --tags)"
echo "building images..."
go mod vendor
echo "docker build -t ghcr.io/kilnfi/carina:controller-${tag} . "
docker build -t "ghcr.io/kilnfi/carina:controller-${tag}" .
cd scheduler
go mod vendor
echo "docker build -t ghcr.io/kilnfi/carina:scheduler-${tag} ."
docker build -t "ghcr.io/kilnfi/carina:scheduler-${tag}" .
# Interactive debug
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
- name: Test Kubernetes
if: github.ref != 'refs/heads/main'
run: |
set -x
exec 2>&1
git fetch origin
tag="$(git describe --tags)"
# Cluster
curl -s -L -o k3s https://github.com/k3s-io/k3s/releases/download/v1.25.7%2Bk3s1/k3s
chmod +x k3s
sudo ./k3s server --disable coredns,servicelb,traefik,metrics-server --write-kubeconfig "$(pwd)/kubeconfig" --write-kubeconfig-mode 777 > k3s_log 2>&1 &
export KUBECONFIG="$(pwd)/kubeconfig"
# Wait init
while true; do ./k3s kubectl get deploy -n kube-system local-path-provisioner && break; sleep 5; done
docker save "ghcr.io/kilnfi/carina:scheduler-${tag}" "ghcr.io/kilnfi/carina:controller-${tag}" | sudo ./k3s ctr image import -
# Debug output
debug() {
set +e
./k3s kubectl get po -A
./k3s kubectl get pvc -A
./k3s kubectl get nodestorageresource -A -o yaml
./k3s kubectl logs -n carina --tail=200 -l app.kubernetes.io/instance=carina-csi-driver --all-containers=true
#tail -200 k3s_log
}
trap debug EXIT
# Carina install
./k3s kubectl create ns carina
sed -i -e 's/__TAG__/'"${tag}"'/' .github/kiln-values.yaml
helm upgrade --install -n carina carina-csi-driver charts/ -f .github/kiln-values.yaml
# Wait deploy
./k3s kubectl rollout status -n carina --watch --timeout=200s ds/csi-carina-node
./k3s kubectl wait po -n carina -l app=csi-carina-node --for=condition=ready --timeout=200s
# Update device
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')
sed -i -e 's/__DEVICE__/'"${device#/dev/}"'/' .github/kiln-values.yaml
helm upgrade --install -n carina carina-csi-driver charts/ -f .github/kiln-values.yaml
# Refresh
sleep 60
./k3s kubectl rollout restart -n carina deployment carina-csi-driver-carina-scheduler
./k3s kubectl rollout restart -n carina deployment csi-carina-controller
./k3s kubectl exec -t -n carina ds/csi-carina-node -c csi-carina-node -- sh -c 'pvcreate '"${device}"'; kill 1'
# Test
helm test -n carina carina-csi-driver
./k3s kubectl wait -n carina --for=jsonpath='{.status.phase}'=Bound pvc/carina-vg-ssd-testpvc --timeout=500s
./k3s kubectl wait -n carina --for=condition=ready po -l storageclass=carina-vg-ssd --timeout=500s
- name: Push image
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
run: |
set -x
git fetch origin
tag="$(git describe --tags)"
docker push "ghcr.io/kilnfi/carina:controller-${tag}"
docker push "ghcr.io/kilnfi/carina:scheduler-${tag}"
helm:
name: Helm chart
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push chart
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
run: |
set -x
git fetch origin
tag="$(git describe --tags)"
sed -i -r "s/^(appV|v)ersion *:.*$/\1ersion: $tag/" charts/Chart.yaml
helm package charts --version "${tag}"
HELM_EXPERIMENTAL_OCI=1 helm push "carina-csi-driver-${tag}.tgz" "oci://ghcr.io/kilnfi/helm-charts"