Skip to content

Commit

Permalink
local working version
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Aug 14, 2024
1 parent 46d1aeb commit 08b62ba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dev/Dockerfile.postgres_profile_docker_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM python:3.9
RUN pip install dbt-postgres==1.8.2 psycopg2==2.9.3 pytz

ENV POSTGRES_DATABASE=postgres
ENV POSTGRES_HOST=127.0.0.1
ENV POSTGRES_HOST=postgres.default.svc.cluster.local
ENV POSTGRES_PASSWORD=<postgres_password>
ENV POSTGRES_PORT=5432
ENV POSTGRES_SCHEMA=public
Expand Down
4 changes: 2 additions & 2 deletions dev/dags/dbt/jaffle_shop/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ postgres_profile:
dev:
type: postgres
dbname: postgres #'{{ env_var(''POSTGRES_DATABASE'') }}'
host: "0.0.0.0" #'{{ env_var(''POSTGRES_HOST'') }}'
host: postgres.default.svc.cluster.local #'{{ env_var(''POSTGRES_HOST'') }}'
pass: postgres #'{{ env_var(''POSTGRES_PASSWORD'') }}'
port: 5432 #'{{ env_var(''POSTGRES_PORT'') | as_number }}'
schema: postgres # '{{ env_var(''POSTGRES_SCHEMA'') }}'
user: "postgres" #'{{ env_var(''POSTGRES_USER'') }}'
user: postgres #'{{ env_var(''POSTGRES_USER'') }}'
4 changes: 2 additions & 2 deletions scripts/test/kubernetes-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ set -e
#kubectl describe pod postgres-postgresql-0


kubectl create secret generic postgres-secrets --from-literal=host=0.0.0.0 --from-literal=password=postgres
kubectl create secret generic postgres-secrets --from-literal=host=postgres-postgresql.default.svc.cluster.local --from-literal=password=postgres

kubectl apply -f scripts/test/postgres-deployment.yaml

Expand All @@ -90,4 +90,4 @@ echo "$POD_NAME"

kubectl port-forward --namespace default "$POD_NAME" 5432:5432 &

kubectl get pod
kubectl get pod
10 changes: 6 additions & 4 deletions scripts/test/postgres-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
valueFrom:
secretKeyRef:
name: postgres-secrets
key: host # Adjust according to your secret's key
key: host
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
Expand All @@ -39,19 +39,21 @@ metadata:
name: postgres-secrets
type: Opaque
data:
host: MC4wLjAuMA==
host: cG9zdGdyZXMuZGVmYXVsdC5zdmMuY2x1c3Rlci5sb2NhbA==
password: cG9zdGdyZXM=

---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: default # Ensure this matches the namespace of the Deployment
namespace: default
spec:
type: LoadBalancer
type: NodePort
ports:
- port: 5432
targetPort: 5432
protocol: TCP
nodePort: 32583
selector:
app: postgres

0 comments on commit 08b62ba

Please sign in to comment.