From 43661df7a25f8da4ad085ffa71e06b114f4dacc3 Mon Sep 17 00:00:00 2001 From: Sabine Maennel <5292683+sabinem@users.noreply.github.com> Date: Wed, 7 Oct 2026 18:04:14 +0200 Subject: [PATCH] fix(just): give cluster::reseed's port-forward a real service name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `postgres_svc := "svc/{{postgres_sts}}"` was never interpolated: just does not expand {{…}} inside a variable's value, so the port-forward was handed the literal `svc/{{postgres_sts}}`. kubectl refuses it after the app database has already been dropped, so reseed left dev empty instead of seeded. Name the Service like the other resources and let the port-forward add the `svc/` prefix, as exec adds `sts/`. Also move the comment on restoring a backend found at 0 next to the lines it explains. --- tools/just/cluster.just | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/just/cluster.just b/tools/just/cluster.just index 0ca3d289..fe082d98 100644 --- a/tools/just/cluster.just +++ b/tools/just/cluster.just @@ -9,6 +9,8 @@ backend_deploy := "hackagon-backend" backend_config := "hackagon-backend-config" backend_db_secret := "hackagon-backend-db" postgres_sts := "hackagon-postgresql" +# The Service in front of postgres_sts; the bitnami chart gives both the same name. +postgres_svc := "hackagon-postgresql" app_db := "hackagon" app_db_owner := "hackagon" @@ -18,7 +20,6 @@ dev_domain := "hackagon-dev.dscompute.ch" backup_dir := env("HOME") + "/hackagon-backups" local_pg_port := "15432" -postgres_svc := "svc/{{postgres_sts}}" # Runs inside the postgres pod: finds the superuser password the bitnami image # was started with (env var or mounted file) so it never leaves the pod. @@ -88,13 +89,13 @@ wipe context: just -f "{{source_file()}}" backup "{{context}}" kc=(kubectl --context "{{context}}" -n "{{namespace}}") + # A backend found at 0 (e.g. left there by an interrupted run) comes back + # at 1: both recipes promise a running dev, and wipe needs it to recreate + # the schema. replicas="$("${kc[@]}" get "deploy/{{backend_deploy}}" -o jsonpath='{.spec.replicas}')" [ "${replicas:-0}" -gt 0 ] || replicas=1 restore_backend() { - # A backend found at 0 (e.g. left there by an interrupted run) - # comes back at 1: both recipes promise a running dev, - # and wipe needs it to recreate the schema." echo "==> Scaling backend back to $replicas (it recreates the schema on startup)" "${kc[@]}" scale "deploy/{{backend_deploy}}" --replicas="$replicas" } @@ -145,6 +146,7 @@ reseed context: db_password="$("${kc[@]}" get secret "{{backend_db_secret}}" -o jsonpath='{.data.password}' | base64 -d)" [ -n "$db_password" ] || { echo "✗ {{backend_db_secret}} has no password." >&2; exit 1; } + # As in wipe: a backend found at 0 comes back at 1. replicas="$("${kc[@]}" get "deploy/{{backend_deploy}}" -o jsonpath='{.spec.replicas}')" [ "${replicas:-0}" -gt 0 ] || replicas=1 @@ -161,7 +163,7 @@ reseed context: just -f "{{source_file()}}" _wipe-db "{{context}}" echo "==> Port-forwarding postgres to localhost:{{local_pg_port}}" - "${kc[@]}" port-forward "{{postgres_svc}}" "{{local_pg_port}}:5432" >/dev/null & + "${kc[@]}" port-forward "svc/{{postgres_svc}}" "{{local_pg_port}}:5432" >/dev/null & pf_pid=$! # Wait up to 10s for the tunnel to open.