Skip to content

Commit f85e494

Browse files
Created helm chart to run postgres
1 parent 96f8bf0 commit f85e494

File tree

7 files changed

+125
-1
lines changed

7 files changed

+125
-1
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@ packages/react-devtools-extensions/shared/build
3535
packages/react-devtools-extensions/.tempUserDataDir
3636
packages/react-devtools-inline/dist
3737
packages/react-devtools-shell/dist
38-
packages/react-devtools-timeline/dist
38+
packages/react-devtools-timeline/dist
39+
40+
# Helm charts
41+
*.tgz
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: postgres
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "0.1.0"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# kubernetes/postgres.yaml
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ .Values.app.name }}
6+
namespace: {{ .Values.namespace }}
7+
spec:
8+
replicas: {{ .Values.deployment.replicas }}
9+
selector:
10+
matchLabels:
11+
app: {{ .Values.app.name }}
12+
template:
13+
metadata:
14+
labels:
15+
app: {{ .Values.app.name }}
16+
spec:
17+
containers:
18+
- name: {{ .Values.container.name }}
19+
image: postgres:13.2-alpine
20+
imagePullPolicy: 'IfNotPresent'
21+
ports:
22+
- containerPort: {{ .Values.container.port }}
23+
envFrom:
24+
- secretRef:
25+
name: postgres-secrets
26+
volumeMounts:
27+
- mountPath: /var/lib/postgresql/data
28+
name: postgresdb
29+
volumes:
30+
- name: postgresdb
31+
persistentVolumeClaim:
32+
claimName: postgres-storage-claim
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: postgres-secrets
5+
namespace: {{ .Values.namespace }}
6+
type: Opaque
7+
data:
8+
POSTGRES_USER: {{ .Values.postgres.username }}
9+
POSTGRES_PASSWORD: {{ .Values.postgres.password }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# kubernetes/postgres-service.yaml
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ .Values.app.name }}
6+
namespace: {{ .Values.namespace }}
7+
spec:
8+
selector:
9+
app: {{ .Values.app.name }}
10+
ports:
11+
- port: {{ .Values.app.port }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# kubernetes/postgres-storage.yaml
2+
apiVersion: v1
3+
kind: PersistentVolume
4+
metadata:
5+
name: postgres-storage
6+
namespace: backstage
7+
labels:
8+
type: local
9+
spec:
10+
storageClassName: manual
11+
capacity:
12+
storage: 2G
13+
accessModes:
14+
- ReadWriteOnce
15+
persistentVolumeReclaimPolicy: Retain
16+
hostPath:
17+
path: '/mnt/data'
18+
---
19+
apiVersion: v1
20+
kind: PersistentVolumeClaim
21+
metadata:
22+
name: postgres-storage-claim
23+
namespace: backstage
24+
spec:
25+
storageClassName: manual
26+
accessModes:
27+
- ReadWriteOnce
28+
resources:
29+
requests:
30+
storage: 2G
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace: 'backstage'
2+
deployment:
3+
replicas: '1'
4+
5+
app:
6+
name: 'postgres'
7+
port: '5432'
8+
9+
container:
10+
name: 'postgres'
11+
port: '5432'
12+
13+
postgres:
14+
username: 'YmFja3N0YWdl'
15+
password: 'aHVudGVyMg=='

0 commit comments

Comments
 (0)