Skip to content

Commit 3f864e2

Browse files
authored
Merge pull request #35 from vdice/feat/annotate-on-upgrade
feat(marketplace): also annotate nodes on upgrade to support shim upgrade
2 parents ee70a4c + 9d54816 commit 3f864e2

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

.github/workflows/marketplace-smoke-test.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
- name: create kind cluster
2525
uses: helm/kind-action@v1
2626

27+
## Install SpinKube and verify Spin App runs
28+
2729
- name: helm install spinkube
2830
run: |
2931
helm install spinkube \
@@ -56,6 +58,25 @@ jobs:
5658
- name: Verify curl
5759
run: curl localhost:8083/hello
5860

61+
## Upgrade release and verify shim is re-installed
62+
63+
- name: delete any lingering kwasm jobs
64+
run: kubectl -n spinkube delete job -l kwasm.sh/job=true
65+
66+
- name: helm upgrade spinkube and watch for annotate and install job completions
67+
run: |
68+
helm upgrade spinkube \
69+
--wait \
70+
--namespace spinkube \
71+
--debug \
72+
marketplace/charts/spinkube-azure-marketplace &
73+
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'
74+
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'
75+
76+
## Delete release
77+
78+
# First, verify deletion is blocked when Spin App resources exist
79+
5980
- name: helm delete spinkube
6081
run: |
6182
if helm delete spinkube --timeout 1m --namespace spinkube; then
@@ -80,6 +101,8 @@ jobs:
80101
- name: Delete Spin App
81102
run: kubectl delete spinapp simple-spinapp
82103

104+
# Now verify deletion proceeds and no resources remain
105+
83106
- name: helm delete spinkube
84107
run: helm delete spinkube --timeout 1m --namespace spinkube
85108

marketplace/charts/spinkube-azure-marketplace/templates/kwasm-annotate-nodes-job.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Job
33
metadata:
44
name: "{{ .Release.Name }}-kwasm-annotate-nodes"
55
annotations:
6-
"helm.sh/hook": post-install
6+
"helm.sh/hook": post-install,post-upgrade
77
"helm.sh/hook-weight": "-4"
88
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
99
spec:
@@ -15,8 +15,13 @@ spec:
1515
containers:
1616
- name: kubectl
1717
image: {{ printf "%s/%s:%s" .Values.global.azure.images.kubectl.registry .Values.global.azure.images.kubectl.image .Values.global.azure.images.kubectl.tag }}
18-
command: ["kubectl"]
19-
args: ["annotate", "node", "--all", "kwasm.sh/kwasm-node=true"]
18+
command: ["/bin/sh", "-c"]
19+
args:
20+
- |-
21+
echo "Annotating nodes with kwasm.sh/kwasm-node=false to reset installation of the shim for upgrade scenarios"
22+
kubectl annotate node --all kwasm.sh/kwasm-node=false --overwrite
23+
echo "Annotating nodes with kwasm.sh/kwasm-node=true to (re-)trigger installation of the shim"
24+
kubectl annotate node --all kwasm.sh/kwasm-node=true --overwrite
2025
restartPolicy: OnFailure
2126
---
2227
apiVersion: v1

0 commit comments

Comments
 (0)