diff --git a/dev/Dockerfile.postgres_profile_docker_k8s b/dev/Dockerfile.postgres_profile_docker_k8s index 3a718b7e7..e7af7cfc2 100644 --- a/dev/Dockerfile.postgres_profile_docker_k8s +++ b/dev/Dockerfile.postgres_profile_docker_k8s @@ -3,7 +3,7 @@ FROM python:3.9 RUN pip install dbt-postgres==1.3.1 psycopg2==2.9.3 pytz ENV POSTGRES_DATABASE=postgres -ENV POSTGRES_HOST=127.0.0.1 +ENV POSTGRES_HOST=postgres-postgresql.default.svc.cluster.local ENV POSTGRES_PASSWORD= ENV POSTGRES_PORT=5432 ENV POSTGRES_SCHEMA=public diff --git a/scripts/test/kubernetes-setup.sh b/scripts/test/kubernetes-setup.sh index 905669808..24763ddf9 100644 --- a/scripts/test/kubernetes-setup.sh +++ b/scripts/test/kubernetes-setup.sh @@ -42,17 +42,18 @@ kubectl config set-context default # Deploy a Postgres pod to Kind helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update -helm upgrade --install postgres bitnami/postgresql -f scripts/test/values.yaml +helm install postgres bitnami/postgresql -f scripts/test/values.yaml + +sleep 60 # Retrieve the Postgres password and set it as an environment variable POSTGRES_PASSWORD=$(kubectl get secret --namespace default postgres-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d) export POSTGRES_PASSWORD -sleep 60 # Expose the Postgres to the host running Docker/Kind #kubectl port-forward --namespace default postgres-postgresql-0 5432:5432 & kubectl port-forward --namespace default svc/postgres-postgresql 5432:5432 & -kubectl create secret generic postgres-secrets --from-literal=host=127.0.0.1 --from-literal=password=$POSTGRES_PASSWORD +kubectl create secret generic postgres-secrets --from-literal=host=postgres-postgresql.default.svc.cluster.local --from-literal=password=$POSTGRES_PASSWORD # Create a docker image containing the dbt project files and dbt profile cd dev && docker build -t dbt-jaffle-shop:1.0.0 -f Dockerfile.postgres_profile_docker_k8s . diff --git a/scripts/test/values.yaml b/scripts/test/values.yaml index eb976fc14..ed81866db 100644 --- a/scripts/test/values.yaml +++ b/scripts/test/values.yaml @@ -1,11 +1,6 @@ -postgresql: +primary: livenessProbe: - exec: - command: - - /bin/sh - - -c - - exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432 - initialDelaySeconds: 60 + initialDelaySeconds: 120 timeoutSeconds: 5 periodSeconds: 10 successThreshold: 1