ungleich-k8s/apps/matrix/templates/postgres.yaml

77 lines
2.1 KiB
YAML
Raw Normal View History

2021-12-25 09:53:35 +00:00
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-postgres
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: postgres
spec:
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: postgres
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: postgres
spec:
containers:
- name: postgres
image: postgres:14
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: {{ .Release.Name }}-postgres-config
volumeMounts:
- name: postgres-data
mountPath: "/var/lib/postgresql/data"
subPath: postgres
resources:
requests:
2022-03-11 07:49:12 +00:00
memory: {{.Values.resources.postgres.memory }}
cpu: {{.Values.resources.postgres.cpu}}
2021-12-25 09:53:35 +00:00
limits:
2022-03-11 07:49:12 +00:00
memory: {{.Values.resources.postgres.memory}}
cpu: {{.Values.resources.postgres.cpu}}
2021-12-25 09:53:35 +00:00
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: {{ .Release.Name }}-postgres-data
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-postgres
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: postgres
spec:
type: ClusterIP
ports:
- port: 5432
name: postgres
selector:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: postgres
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-postgres-config
annotations:
secret-generator.v1.mittwald.de/autogenerate: POSTGRES_PASSWORD
hosting: {{ .Release.Name }}
labels:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: postgres
stringData:
POSTGRES_USER: "{{ .Values.postgresUser }}"
POSTGRES_DB: "{{ .Values.postgresDBName }}"
POSTGRES_INITDB_ARGS: "--no-locale --encoding=UTF8"