mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
61 lines
1.6 KiB
Bash
61 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
KNOE_HOME=$(cd "$SCRIPT_DIR/../.." && pwd)
|
|
|
|
TMP_DIR=$(mktemp -d)
|
|
trap 'rm -rf "$TMP_DIR"' EXIT
|
|
|
|
YAML_PATH="$TMP_DIR/realtime-deployment.yaml"
|
|
|
|
cat >"$YAML_PATH" <<'YAML'
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: realtime
|
|
namespace: supabase
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: realtime
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: realtime
|
|
spec:
|
|
containers:
|
|
- name: realtime
|
|
image: supabase/realtime:v2.76.5
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- curl -sSfL --head -o /dev/null -H "Authorization: Bearer abc:def" http://localhost:4000/health
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 30
|
|
YAML
|
|
|
|
python3 "$KNOE_HOME/supabase/patch_realtime_probe.py" "$YAML_PATH" >/dev/null
|
|
|
|
# Validate that the curl command is YAML-quoted.
|
|
# (We avoid using `kubectl ... -o json` here because it may contact the cluster for discovery
|
|
# even in client dry-run mode, which makes the test flaky/offline-hostile.)
|
|
|
|
if ! grep -Eq "^[[:space:]]*-[[:space:]]*'curl .*Authorization: Bearer" "$YAML_PATH"; then
|
|
echo "FAILURE: expected the realtime liveness curl command to be YAML single-quoted" >&2
|
|
sed -n '1,120p' "$YAML_PATH" >&2 || true
|
|
exit 1
|
|
fi
|
|
|
|
if grep -Eq "^[[:space:]]*-[[:space:]]*curl .*Authorization: Bearer" "$YAML_PATH"; then
|
|
echo "FAILURE: found an unquoted realtime liveness curl command (YAML may parse it as a mapping)" >&2
|
|
sed -n '1,120p' "$YAML_PATH" >&2 || true
|
|
exit 1
|
|
fi
|
|
|
|
echo "SUCCESS"
|