postgrest.template.yml

  1---
  2kind: Service
  3apiVersion: v1
  4metadata:
  5  namespace: ${ZED_KUBE_NAMESPACE}
  6  name: postgrest
  7  annotations:
  8    service.beta.kubernetes.io/do-loadbalancer-name: "postgrest-${ZED_KUBE_NAMESPACE}"
  9    service.beta.kubernetes.io/do-loadbalancer-tls-ports: "443"
 10    service.beta.kubernetes.io/do-loadbalancer-certificate-id: ${ZED_DO_CERTIFICATE_ID}
 11    service.beta.kubernetes.io/do-loadbalancer-disable-lets-encrypt-dns-records: "true"
 12spec:
 13  type: LoadBalancer
 14  selector:
 15    app: nginx
 16  ports:
 17    - name: web
 18      protocol: TCP
 19      port: 443
 20      targetPort: 8080
 21
 22---
 23apiVersion: apps/v1
 24kind: Deployment
 25metadata:
 26  namespace: ${ZED_KUBE_NAMESPACE}
 27  name: nginx
 28spec:
 29  replicas: 1
 30  selector:
 31    matchLabels:
 32      app: nginx
 33  template:
 34    metadata:
 35      labels:
 36        app: nginx
 37    spec:
 38      containers:
 39        - name: nginx
 40          image: nginx:latest
 41          ports:
 42            - containerPort: 8080
 43              protocol: TCP
 44          volumeMounts:
 45            - name: nginx-config
 46              mountPath: /etc/nginx/nginx.conf
 47              subPath: nginx.conf
 48      volumes:
 49        - name: nginx-config
 50          configMap:
 51            name: nginx-config
 52
 53---
 54apiVersion: v1
 55kind: ConfigMap
 56metadata:
 57  namespace: ${ZED_KUBE_NAMESPACE}
 58  name: nginx-config
 59data:
 60  nginx.conf: |
 61    events {}
 62
 63    http {
 64      server {
 65        listen 8080;
 66
 67        location /app/ {
 68          proxy_pass http://postgrest-app:8080/;
 69        }
 70
 71        location /llm/ {
 72          proxy_pass http://postgrest-llm:8080/;
 73        }
 74      }
 75    }
 76
 77---
 78apiVersion: v1
 79kind: Service
 80metadata:
 81  namespace: ${ZED_KUBE_NAMESPACE}
 82  name: postgrest-app
 83spec:
 84  selector:
 85    app: postgrest-app
 86  ports:
 87    - protocol: TCP
 88      port: 8080
 89      targetPort: 8080
 90
 91---
 92apiVersion: v1
 93kind: Service
 94metadata:
 95  namespace: ${ZED_KUBE_NAMESPACE}
 96  name: postgrest-llm
 97spec:
 98  selector:
 99    app: postgrest-llm
100  ports:
101    - protocol: TCP
102      port: 8080
103      targetPort: 8080
104
105---
106apiVersion: apps/v1
107kind: Deployment
108metadata:
109  namespace: ${ZED_KUBE_NAMESPACE}
110  name: postgrest-app
111spec:
112  replicas: 1
113  selector:
114    matchLabels:
115      app: postgrest-app
116  template:
117    metadata:
118      labels:
119        app: postgrest-app
120    spec:
121      containers:
122        - name: postgrest
123          image: "postgrest/postgrest"
124          ports:
125            - containerPort: 8080
126              protocol: TCP
127          env:
128            - name: PGRST_SERVER_PORT
129              value: "8080"
130            - name: PGRST_DB_URI
131              valueFrom:
132                secretKeyRef:
133                  name: database
134                  key: url
135            - name: PGRST_JWT_SECRET
136              valueFrom:
137                secretKeyRef:
138                  name: postgrest
139                  key: jwt_secret
140
141---
142apiVersion: apps/v1
143kind: Deployment
144metadata:
145  namespace: ${ZED_KUBE_NAMESPACE}
146  name: postgrest-llm
147spec:
148  replicas: 1
149  selector:
150    matchLabels:
151      app: postgrest-llm
152  template:
153    metadata:
154      labels:
155        app: postgrest-llm
156    spec:
157      containers:
158        - name: postgrest
159          image: "postgrest/postgrest"
160          ports:
161            - containerPort: 8080
162              protocol: TCP
163          env:
164            - name: PGRST_SERVER_PORT
165              value: "8080"
166            - name: PGRST_DB_URI
167              valueFrom:
168                secretKeyRef:
169                  name: llm-database
170                  key: url
171            - name: PGRST_JWT_SECRET
172              valueFrom:
173                secretKeyRef:
174                  name: postgrest
175                  key: jwt_secret