diff --git a/ci_tests/basic_postgres/values-postgis.yaml b/ci_tests/basic_postgres/values-postgis.yaml index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f3e2348278aae994b9f6bdc7cd2acbea2f2f8930 100644 --- a/ci_tests/basic_postgres/values-postgis.yaml +++ b/ci_tests/basic_postgres/values-postgis.yaml @@ -0,0 +1,2 @@ +persistence: + enabled: false \ No newline at end of file diff --git a/helpers/deploy_postgis.sh b/helpers/deploy_postgis.sh index d97a047840c7e88a39702430b5d076da08ee1dca..e47a5bf8408b4f27b2848ab668d2e49aa2b24641 100755 --- a/helpers/deploy_postgis.sh +++ b/helpers/deploy_postgis.sh @@ -17,6 +17,11 @@ else release_prefix="$2" fi +get_pod_name() { + release_name="$1" + kubectl -n $ns get pods --selector=app.kubernetes.io/instance=${release_name} -o name +} + ns=$(./helpers/get_namespace.sh) # get password from any previous installation @@ -41,4 +46,18 @@ echo "Start waiting for postgres: $(date +%Y%m%dT%H%M%S)" kubectl wait -n $ns --selector=app.kubernetes.io/instance=${release_name} --timeout 120s --for=condition=Ready pod status=$? echo "Done waiting for postgis: $(date +%Y%m%dT%H%M%S) : $status" + +if [[ ${status} -ne 0 ]]; then + exit $status +fi + +# This is the first time we've installed this +if [[ "$sec_info" == "" ]]; then + # Enable PostGIS extension + POSTGRES_PASSWORD=$(kubectl get secret -n $ns ${auth_sec} -o jsonpath-"{.data.postgresql-password}" | base64 --decode) + pod_name=$(get_pod_name ${release_name}) + kubectl exec -n $ns ${pod_name} -- bash -c "PGPASSWORD=$POSTGRES_PASSWORD; psql -U postgres -d postgres -c 'CREATE EXTENSION postgis;'" + status=$? +fi + exit $status