Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions charts/postgresql-external/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for postgresql
name: postgres
version: 0.0.42
8 changes: 8 additions & 0 deletions charts/postgresql-external/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This is the PostgreSQL chart.

Configure the values.yaml file to create the database, username, password and other configuration.

To deploy the helm chart -
```
helm install postgresql charts/postgresql-external --values charts/postgresql-external/values.yaml
```
10 changes: 10 additions & 0 deletions charts/postgresql-external/templates/postgres-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-config
labels:
app: postgres
data:
POSTGRES_DB: {{ .Values.postgresDb }}
POSTGRES_USER: {{ .Values.postgresUser }}
POSTGRES_PASSWORD: {{ .Values.postgresPassword }}
12 changes: 12 additions & 0 deletions charts/postgresql-external/templates/postgres-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app: postgres
spec:
type: NodePort
ports:
- port: 5432
selector:
app: postgres
31 changes: 31 additions & 0 deletions charts/postgresql-external/templates/postgres-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
spec:
replicas: {{ .Values.replicas }}
serviceName: postgres
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: {{ .Values.postgresImage }}
imagePullPolicy: "IfNotPresent"
ports:
- containerPort: 5432
envFrom:
- configMapRef:
name: postgres-config
volumeMounts:
- mountPath: {{ .Values.containerVolumeMountPath }}
name: postgredb
volumes:
- name: postgredb
persistentVolumeClaim:
claimName: postgres-pv-claim
29 changes: 29 additions & 0 deletions charts/postgresql-external/templates/postgres-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
kind: PersistentVolume
apiVersion: v1
metadata:
name: postgres-pv-volume
labels:
type: local
app: postgres
spec:
storageClassName: manual
capacity:
storage: {{ .Values.storageSize }}
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-pv-claim
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: {{ .Values.storageSize }}
7 changes: 7 additions & 0 deletions charts/postgresql-external/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
replicas: 3
postgresImage: postgres:13
storageSize: 15Gi
postgresDb: externalPostgresql
postgresUser: externalPostgresql
postgresPassword: externalPostgresql
containerVolumeMountPath: /var/lib/postgresql/data