meal_homework/helmchart/templates/postgresql.yaml

62 lines
1.3 KiB
YAML
Raw Normal View History

2022-02-14 00:08:25 +01:00
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: meal-api-postgres-pvc
spec:
storageClassName: {{ .Values.postgres.storage.provider }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.postgres.storage.size }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: meal-api-postgres
spec:
replicas: 1
selector:
matchLabels:
app: meal-api-postgres
template:
metadata:
labels:
app: meal-api-postgres
spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: meal-api-postgres-pvc
containers:
- name: meal-api-postgres
image: "postgres:14"
envFrom:
- configMapRef:
name: meal-api-postgres-config
volumeMounts:
- mountPath: /var/lib/postgresql
name: data
---
apiVersion: v1
kind: Service
metadata:
name: meal-api-postgres
spec:
selector:
app: meal-api-postgres
ports:
- name: {{ .Values.postgres.name }}
protocol: TCP
port: 5432
targetPort: 5432
---
apiVersion: v1
kind: ConfigMap
metadata:
name: meal-api-postgres-config
data:
POSTGRES_PASSWORD: {{ .Values.postgres.password }}
POSTGRES_USER: {{ .Values.postgres.user }}
POSTGRES_DB: {{ .Values.postgres.database }}