fix(k01): apply-schema use TCP+PGPASSWORD for CNPG peer-auth bypass
build-and-push-harbor / docker-build-push (push) Waiting to run

This commit is contained in:
zetaloop
2026-05-06 13:21:23 +08:00
parent 50f0846e11
commit 68bdb9797b
+8 -4
View File
@@ -17,14 +17,18 @@ domain_dir() {
psql_exec() {
local cluster="$1" sql="$2"
kubectl -n juwan exec -i "${cluster}-1" -c postgres -- psql \
-v ON_ERROR_STOP=1 -U app -d app <<<"$sql"
local pw
pw="$(kubectl -n juwan get secret "${cluster}-app" -o jsonpath='{.data.password}' | base64 -d)"
kubectl -n juwan exec -i "${cluster}-1" -c postgres -- env PGPASSWORD="$pw" \
psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U app -d app <<<"$sql"
}
psql_file() {
local cluster="$1" file="$2"
kubectl -n juwan exec -i "${cluster}-1" -c postgres -- psql \
-v ON_ERROR_STOP=1 -U app -d app < "$file"
local pw
pw="$(kubectl -n juwan get secret "${cluster}-app" -o jsonpath='{.data.password}' | base64 -d)"
kubectl -n juwan exec -i "${cluster}-1" -c postgres -- env PGPASSWORD="$pw" \
psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U app -d app < "$file"
}
clusters=()