Skip to content

Commit 1ab0d33

Browse files
feat: add postgresql subchart (#133)
1 parent feda3e9 commit 1ab0d33

7 files changed

Lines changed: 176 additions & 0 deletions

File tree

charts/postgresql/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/postgresql/Chart.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v2
2+
name: postgresql
3+
description: PostgreSQL database Helm chart
4+
version: 0.1.0
5+
appVersion: "17"
6+
type: application
7+
keywords:
8+
- postgresql
9+
- database
10+
- sql
11+
home: https://codefresh.io/
12+
maintainers:
13+
- name: codefresh
14+
url: https://codefresh-io.github.io/
15+
dependencies:
16+
- name: cf-common
17+
repository: oci://quay.io/codefresh/charts
18+
version: "0.31.0"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ $templateName := printf "cf-common-%s.configmaps" (index .Subcharts "cf-common").Chart.Version }}
2+
{{- include $templateName . -}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ $templateName := printf "cf-common-%s.controller" (index .Subcharts "cf-common").Chart.Version }}
2+
{{- include $templateName . -}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ $templateName := printf "cf-common-%s.secrets" (index .Subcharts "cf-common").Chart.Version }}
2+
{{- include $templateName . -}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ $templateName := printf "cf-common-%s.service" (index .Subcharts "cf-common").Chart.Version }}
2+
{{- include $templateName . -}}

charts/postgresql/values.yaml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
fullnameOverride: postgresql
2+
3+
auth:
4+
username: postgres
5+
password: password
6+
database: ""
7+
8+
config:
9+
listen_addresses: "'*'"
10+
port: 5432
11+
shared_preload_libraries: "'pg_partman_bgw, pg_cron'"
12+
pg_cron.database: "'postgres'"
13+
pg_partman_bgw.dbname: "'postgres'"
14+
pg_partman_bgw.interval: 3600
15+
16+
global: {}
17+
18+
controller:
19+
enabled: true
20+
type: statefulset
21+
replicas: 1
22+
podManagementPolicy: OrderedReady
23+
24+
container:
25+
image:
26+
registry: quay.io
27+
repository: codefresh/postgresql
28+
tag: 17.6-featvanilla-postgresql
29+
pullPolicy: IfNotPresent
30+
31+
args:
32+
- "-c"
33+
- "config_file=/etc/postgresql/postgresql.conf"
34+
35+
env:
36+
PGDATA: /var/lib/postgresql/data/pgdata
37+
38+
probes:
39+
liveness:
40+
enabled: true
41+
type: exec
42+
exec:
43+
command:
44+
- pg_isready
45+
- -U
46+
- postgres
47+
spec:
48+
initialDelaySeconds: 30
49+
periodSeconds: 20
50+
timeoutSeconds: 10
51+
successThreshold: 1
52+
failureThreshold: 6
53+
readiness:
54+
enabled: true
55+
type: exec
56+
exec:
57+
command:
58+
- pg_isready
59+
- -U
60+
- postgres
61+
spec:
62+
initialDelaySeconds: 5
63+
periodSeconds: 10
64+
timeoutSeconds: 5
65+
successThreshold: 1
66+
failureThreshold: 6
67+
68+
resources:
69+
requests:
70+
cpu: 100m
71+
memory: 256Mi
72+
limits:
73+
cpu: 500m
74+
memory: 512Mi
75+
76+
volumeMounts:
77+
config:
78+
path:
79+
- mountPath: /etc/postgresql/postgresql.conf
80+
subPath: postgresql.conf
81+
82+
volumeClaimTemplates:
83+
data:
84+
mountPath: /var/lib/postgresql/data
85+
accessMode: ReadWriteOnce
86+
size: 10Gi
87+
storageClass:
88+
89+
secrets:
90+
secret:
91+
enabled: true
92+
stringData: |
93+
POSTGRES_USER: "{{ .Values.auth.username }}"
94+
POSTGRES_PASSWORD: "{{ required ".Values.auth.password is required" .Values.auth.password }}"
95+
{{- if .Values.auth.database }}
96+
POSTGRES_DB: "{{ .Values.auth.database }}"
97+
{{- end }}
98+
99+
configMaps:
100+
config:
101+
enabled: true
102+
data:
103+
postgresql.conf: |
104+
{{- range $key, $value := .Values.config }}
105+
{{ $key }} = {{ $value }}
106+
{{- end }}
107+
108+
109+
volumes:
110+
config:
111+
enabled: true
112+
type: configMap
113+
114+
service:
115+
main:
116+
enabled: true
117+
primary: true
118+
type: ClusterIP
119+
ports:
120+
postgresql:
121+
port: 5432
122+
protocol: TCP
123+
124+
podSecurityContext: {}
125+
nodeSelector: {}
126+
tolerations: []
127+
affinity: {}

0 commit comments

Comments
 (0)