Skip to content

Commit 36d2af7

Browse files
authored
Merge pull request #381 from OpenMS/claude/fix-k8s-deployment-ci-XI82S
Make CI integration tests discover app slug and hosts dynamically
2 parents 9f819a8 + 99b6663 commit 36d2af7

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

.claude/skills/configure-k8s-deployment.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Operator caveat (mention in handoff, not your job to verify): in-place expansion
164164
After committing the edits, tell the user the next steps belong to a human operator (or CI) and are out of scope for you:
165165

166166
1. Open a PR with the overlay edits and have it reviewed.
167-
2. Merge to `main`. CI (`build-and-test.yml`) rebuilds and pushes the image to GHCR with the tag from Q3.
167+
2. Merge to `main`. CI (`build-and-test.yml`) rebuilds and pushes the image to GHCR with the tag from Q3. The kind integration jobs (`test-nginx`, `test-traefik`) auto-discover slug and Traefik hostnames from the overlay output, so no workflow edits are needed for fork-specific values.
168168
3. Cluster operator runs `kubectl apply -k k8s/overlays/prod/` against the OpenMS cluster.
169169
4. Operator verifies with `kubectl -n openms rollout status deployment/<slug>-streamlit` and a browser check on `https://<sub>.webapps.openms.de`.
170170

@@ -185,4 +185,5 @@ After committing the edits, tell the user the next steps belong to a human opera
185185
- [ ] Redis URL written in both Deployment patches (`streamlit` and `rq-worker`)
186186
- [ ] Memory-tier component selected
187187
- [ ] Storage size in `k8s/base/workspace-pvc.yaml` updated only if the user picked a non-default size; PVC name and `claimName` untouched
188+
- [ ] `.github/workflows/build-and-test.yml` uses dynamic overlay discovery (no `template-app` / `template.webapps.openms.*` literals); patched in if the fork's workflow was on the old hardcoded shape
188189
- [ ] Changes committed on a feature branch (no PR opened unless the user asked for one)

.github/workflows/build-and-test.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,24 @@ jobs:
160160
sleep "${i}0"
161161
done
162162
163+
- name: Discover overlay identity
164+
run: |
165+
SLUG=$(yq '.commonLabels.app' k8s/overlays/prod/kustomization.yaml)
166+
echo "SLUG=$SLUG" >> "$GITHUB_ENV"
167+
163168
- name: Wait for Redis to be ready
164169
run: |
165-
kubectl wait -n openms --for=condition=ready pod -l app=template-app,component=redis --timeout=60s
170+
kubectl wait -n openms --for=condition=ready pod -l app=${SLUG},component=redis --timeout=60s
166171
167172
- name: Verify Redis Service is reachable
168173
run: |
169-
kubectl run redis-test -n openms --image=redis:7-alpine --rm -i --restart=Never -- redis-cli -h template-app-redis.openms.svc.cluster.local ping
174+
kubectl run redis-test -n openms --image=redis:7-alpine --rm -i --restart=Never -- redis-cli -h ${SLUG}-redis.openms.svc.cluster.local ping
170175
171176
- name: Verify all deployments are available
172177
run: |
173-
kubectl wait -n openms --for=condition=available deployment -l app=template-app --timeout=180s || true
174-
kubectl get pods -n openms -l app=template-app
175-
kubectl get services -n openms -l app=template-app
178+
kubectl wait -n openms --for=condition=available deployment -l app=${SLUG} --timeout=180s || true
179+
kubectl get pods -n openms -l app=${SLUG}
180+
kubectl get services -n openms -l app=${SLUG}
176181
177182
- name: Curl both hostnames via nginx ingress
178183
run: |
@@ -247,29 +252,39 @@ jobs:
247252
sleep "${i}0"
248253
done
249254
255+
- name: Discover overlay identity
256+
run: |
257+
SLUG=$(yq '.commonLabels.app' k8s/overlays/prod/kustomization.yaml)
258+
TRAEFIK_HOSTS=$(kubectl kustomize k8s/overlays/prod/ \
259+
| yq 'select(.kind == "IngressRoute") | .spec.routes[0].match' \
260+
| grep -oP "Host\(\`\K[^\`]+" | tr '\n' ' ')
261+
echo "SLUG=$SLUG" >> "$GITHUB_ENV"
262+
echo "TRAEFIK_HOSTS=$TRAEFIK_HOSTS" >> "$GITHUB_ENV"
263+
250264
- name: Wait for Redis to be ready
251265
run: |
252-
kubectl wait -n openms --for=condition=ready pod -l app=template-app,component=redis --timeout=60s
266+
kubectl wait -n openms --for=condition=ready pod -l app=${SLUG},component=redis --timeout=60s
253267
254268
- name: Verify all deployments are available
255269
run: |
256-
kubectl wait -n openms --for=condition=available deployment -l app=template-app --timeout=180s || true
257-
kubectl get pods -n openms -l app=template-app
258-
kubectl get services -n openms -l app=template-app
270+
kubectl wait -n openms --for=condition=available deployment -l app=${SLUG} --timeout=180s || true
271+
kubectl get pods -n openms -l app=${SLUG}
272+
kubectl get services -n openms -l app=${SLUG}
259273
260274
- name: Curl both hostnames via Traefik
261275
run: |
262276
kubectl -n traefik port-forward svc/traefik 8080:80 &
263277
PF_PID=$!
264278
trap 'kill "$PF_PID" 2>/dev/null || true' EXIT
279+
FIRST_HOST=$(echo ${TRAEFIK_HOSTS} | awk '{print $1}')
265280
for i in $(seq 1 30); do
266281
sleep 2
267-
if curl -fsSo /dev/null --max-time 2 http://127.0.0.1:8080/_stcore/health -H "Host: template.webapps.openms.de"; then
282+
if curl -fsSo /dev/null --max-time 2 http://127.0.0.1:8080/_stcore/health -H "Host: ${FIRST_HOST}"; then
268283
break
269284
fi
270285
echo "port-forward / app not ready yet, retry $i"
271286
done
272-
for host in template.webapps.openms.de template.webapps.openms.org; do
287+
for host in ${TRAEFIK_HOSTS}; do
273288
curl -fsS --resolve "$host:8080:127.0.0.1" "http://$host:8080/_stcore/health"
274289
echo ""
275290
echo "$host -> 200 OK"

0 commit comments

Comments
 (0)