chore: make Supabase StorageClass preflight advisory instead of blocking

- Updated `deploy.sh` logic to ensure StorageClass preflight checks log warnings instead of stopping execution.
- Allowed Supabase deploy to reconcile or create missing/misconfigured StorageClass during runtime.
- Added tests to validate advisory behavior and ensure non-blocking deployment flow.
This commit is contained in:
chrisfu 2026-04-19 00:04:04 -07:00
parent 5f701026c6
commit 00445404ee
2 changed files with 24 additions and 9 deletions

View File

@ -25,6 +25,9 @@ def die(msg):
print(f"ERROR: {msg}", file=sys.stderr)
sys.exit(1)
def warn(msg):
print(f"WARN: {msg}", file=sys.stderr)
c = configparser.ConfigParser()
c.read(sys.argv[1])
g = c["Global"] if "Global" in c else {}
@ -44,16 +47,19 @@ try:
provisioner = sc.get("provisioner", "")
params = sc.get("parameters", {})
disk_type = params.get("type", "")
if provisioner != "pd.csi.storage.gke.io":
die(f"storage-class configuration error: StorageClass '{sc_name}' must use provisioner 'pd.csi.storage.gke.io', but uses '{provisioner}'.")
if disk_type != "pd-standard":
die(f"storage-class configuration error: StorageClass '{sc_name}' must use parameters.type 'pd-standard', but uses '{disk_type}'.")
print(f"Verified live Supabase StorageClass '{sc_name}' (type: {disk_type}).", file=sys.stderr)
if provisioner == "pd.csi.storage.gke.io" and disk_type == "pd-standard":
print(f"Verified live Supabase StorageClass '{sc_name}' (type: {disk_type}).", file=sys.stderr)
else:
warn(
f"storage-class preflight advisory: StorageClass '{sc_name}' is present but not the expected GKE pd-standard class "
f"(provisioner='{provisioner}', type='{disk_type}'). Supabase deploy will reconcile it."
)
except subprocess.CalledProcessError:
die(f"storage-class configuration error: Required StorageClass '{sc_name}' does not exist on cluster '{ctx}'.")
warn(
f"storage-class preflight advisory: StorageClass '{sc_name}' does not exist on cluster '{ctx}'. "
"Supabase deploy will create/reconcile it in this run."
)
PY
fi

View File

@ -616,6 +616,15 @@ def test_supabase_deploy_runtime_constraint_cleanup_clears_topology_spread_const
assert '"topologySpreadConstraints":null' in script
def test_deploy_entrypoint_supabase_storageclass_preflight_is_advisory_not_blocking():
"""Top-level deploy preflight must not hard-exit before Supabase can reconcile/create its GKE StorageClass."""
script = (REPO_ROOT / "deploy.sh").read_text(encoding="utf-8")
assert "storage-class preflight advisory" in script
assert "Supabase deploy will create/reconcile it in this run" in script
assert "Required StorageClass" not in script
def test_init_gitlab_adds_noop_rerun_fast_path_guards():
"""GitLab init must include fast-path guards to skip heavy rerun work when operator/CR are unchanged."""
script = (REPO_ROOT / "etc" / "init_gitlab.sh").read_text(encoding="utf-8")