Merge pull request #40 from vdice/chore/marketplace-bump-default-k8s-… #33
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
name: Marketplace Smoketest | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
# This version should match the (forked) version of the spin-operator sub-chart | |
SPIN_OPERATOR_VERSION: v0.4.0 | |
jobs: | |
helm-install-smoke-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install helm | |
uses: Azure/setup-helm@v4 | |
with: | |
version: v3.15.4 | |
- name: create kind cluster | |
uses: helm/kind-action@v1 | |
## Install SpinKube and verify Spin App runs | |
- name: helm install spinkube | |
run: | | |
helm install spinkube \ | |
--wait \ | |
--namespace spinkube \ | |
--create-namespace \ | |
--debug \ | |
marketplace/charts/spinkube-azure-marketplace | |
- name: run spin app | |
run: | | |
kubectl apply -f https://raw.githubusercontent.com/spinkube/spin-operator/${{ env.SPIN_OPERATOR_VERSION }}/config/samples/simple.yaml | |
kubectl rollout status deployment simple-spinapp --timeout 90s | |
kubectl get pods -A | |
kubectl port-forward svc/simple-spinapp 8083:80 & | |
timeout 15s bash -c 'until curl -f -vvv http://localhost:8083/hello; do sleep 2; done' | |
- name: debug install | |
if: failure() | |
run: | | |
kubectl get pods -A | |
kubectl get certificate -n spinkube | |
kubectl logs -n spinkube -l app.kubernetes.io/name=spin-operator || true | |
kubectl describe -n spinkube pod -l app.kubernetes.io/name=spin-operator || true | |
kubectl logs -n spinkube -l app.kubernetes.io/name=kwasm-operator || true | |
kubectl describe -n spinkube pod -l app.kubernetes.io/name=kwasm-operator || true | |
kubectl logs -l core.spinkube.dev/app-name=simple-spinapp || true | |
kubectl describe pod -l core.spinkube.dev/app-name=simple-spinapp || true | |
- name: Verify curl | |
run: curl localhost:8083/hello | |
## Upgrade release and verify shim is re-installed | |
- name: delete any lingering kwasm jobs | |
run: kubectl -n spinkube delete job -l kwasm.sh/job=true | |
- name: helm upgrade spinkube and watch for annotate and install job completions | |
run: | | |
helm upgrade spinkube \ | |
--wait \ | |
--namespace spinkube \ | |
--debug \ | |
marketplace/charts/spinkube-azure-marketplace & | |
timeout 30s bash -c 'until [[ "$(kubectl -n spinkube get job -l job-name=spinkube-kwasm-annotate-nodes -o json | jq '.items[].spec.completions')" == "1" ]]; do sleep 2; done' | |
timeout 30s bash -c 'until [[ "$(kubectl -n spinkube get job -l kwasm.sh/job=true -o json | jq '.items[].spec.completions')" == "1" ]]; do sleep 2; done' | |
## Delete release | |
# First, verify deletion is blocked when Spin App resources exist | |
- name: helm delete spinkube | |
run: | | |
if helm delete spinkube --timeout 1m --namespace spinkube; then | |
echo "A Spin App remains on the cluster; the helm release should not have uninstalled successfully." | |
exit 1 | |
fi | |
kubectl logs -n spinkube -l job-name=spinkube-pre-delete | \ | |
grep -q "There are 1 SpinApps still existing on the cluster; aborting helm release deletion." | |
- name: Ensure Spin app still reachable | |
run: curl localhost:8083/hello | |
- name: Ensure SpinKube resources still exist | |
run: | | |
kubectl get po -n spinkube -o name | grep -q spin-operator | |
kubectl get po -n spinkube -o name | grep -q kwasm-operator | |
kubectl get po -n spinkube -o name | grep -q cert-manager | |
kubectl get crd -o name | grep -q spinapp | |
kubectl get crd -o name | grep -q cert-manager | |
- name: Delete Spin App | |
run: kubectl delete spinapp simple-spinapp | |
# Now verify deletion proceeds and no resources remain | |
- name: helm delete spinkube | |
run: helm delete spinkube --timeout 1m --namespace spinkube | |
- name: Verify all resources are deleted | |
run: | | |
timeout 15s bash -c 'until ! kubectl get crd -o name | grep -q cert-manager; do sleep 2; done' | |
timeout 15s bash -c 'until ! kubectl get crd -o name | grep -q spinapp; do sleep 2; done' | |
timeout 15s bash -c 'until ! kubectl get ns -o name | grep -q spinkube; do sleep 2; done' | |
- name: debug uninstall | |
if: failure() | |
run: | | |
kubectl get pods -A | |
kubectl get crd -A | |
kubectl get ns -A | |
kubectl describe pods -A | |
kubectl describe crd -A | |
kubectl describe ns -A |