Skip to content

Commit e03d5d3

Browse files
committed
feat(charts): Add helm charts for postgres
1 parent 716381b commit e03d5d3

7 files changed

Lines changed: 195 additions & 0 deletions

File tree

charts/database/Chart.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: database
2+
home: https://github.com/deis/postgres
3+
version: <Will be populated by the ci before publishing the chart>
4+
description: A PostgreSQL database used by Deis Workflow.
5+
keywords:
6+
- database
7+
- postgres
8+
maintainers:
9+
- name: Deis Team
10+
email: engineering@deis.com
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{{- if eq .Values.global.database_location "on-cluster" }}
2+
apiVersion: extensions/v1beta1
3+
kind: Deployment
4+
metadata:
5+
name: deis-database
6+
labels:
7+
heritage: deis
8+
annotations:
9+
component.deis.io/version: {{ .Values.docker_tag }}
10+
spec:
11+
replicas: 1
12+
strategy:
13+
type: Recreate
14+
selector:
15+
matchLabels:
16+
app: deis-database
17+
template:
18+
metadata:
19+
labels:
20+
app: deis-database
21+
spec:
22+
serviceAccount: deis-database
23+
containers:
24+
- name: deis-database
25+
image: quay.io/{{.Values.org}}/postgres:{{.Values.docker_tag}}
26+
imagePullPolicy: {{.Values.pull_policy}}
27+
ports:
28+
- containerPort: 5432
29+
{{- if or (.Values.limits_cpu) (.Values.limits_memory)}}
30+
resources:
31+
limits:
32+
{{- if (.Values.limits_cpu) }}
33+
cpu: {{.Values.limits_cpu}}
34+
{{- end}}
35+
{{- if (.Values.limits_memory) }}
36+
memory: {{.Values.limits_memory}}
37+
{{- end}}
38+
{{- end}}
39+
env:
40+
- name: DATABASE_STORAGE
41+
value: "{{.Values.global.storage}}"
42+
readinessProbe:
43+
exec:
44+
command:
45+
- is_running
46+
initialDelaySeconds: 30
47+
timeoutSeconds: 1
48+
volumeMounts:
49+
- name: database-creds
50+
mountPath: /var/run/secrets/deis/database/creds
51+
- name: objectstore-creds
52+
mountPath: /var/run/secrets/deis/objectstore/creds
53+
volumes:
54+
- name: database-creds
55+
secret:
56+
secretName: database-creds
57+
- name: objectstore-creds
58+
secret:
59+
secretName: database-storage-keyfile
60+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: database-creds
5+
labels:
6+
app: deis-database
7+
heritage: deis
8+
annotations:
9+
"helm.sh/hook": pre-install
10+
data: {{ if eq .Values.global.database_location "on-cluster"}}
11+
user: {{ randAlphaNum 32 | b64enc }}
12+
password: {{ randAlphaNum 32 | b64enc }}{{ else if eq .Values.global.database_location "off-cluster"}}
13+
user: {{ .Values.postgres.username | b64enc }}
14+
password: {{ .Values.postgres.password | b64enc }}
15+
name: {{ .Values.postgres.name | b64enc }}
16+
host: {{ .Values.postgres.host | b64enc }}
17+
port: {{ .Values.postgres.port | b64enc }}{{ end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- if eq .Values.global.database_location "on-cluster" }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: deis-database
6+
labels:
7+
heritage: deis
8+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if eq .Values.global.database_location "on-cluster" }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: deis-database
6+
labels:
7+
heritage: deis
8+
spec:
9+
ports:
10+
- name: postgres
11+
port: 5432
12+
selector:
13+
app: deis-database
14+
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: database-storage-keyfile
5+
labels:
6+
heritage: deis
7+
annotations:
8+
deis.io/objectstorage: "{{ .Values.global.storage }}"
9+
type: Opaque
10+
data: {{ if eq .Values.global.storage "gcs"}}
11+
key.json: {{.Values.gcs.key_json | b64enc}}
12+
database-bucket: {{.Values.gcs.database_bucket | b64enc }}{{ else if eq .Values.global.storage "azure"}}
13+
accountname: {{.Values.azure.accountname | b64enc }}
14+
accountkey: {{ .Values.azure.accountkey | b64enc }}
15+
database-container: {{ .Values.azure.database_container | b64enc }}{{ else if eq .Values.global.storage "s3"}}
16+
accesskey: {{ .Values.s3.accesskey | b64enc }}
17+
secretkey: {{ .Values.s3.secretkey | b64enc }}
18+
region: {{ .Values.s3.region | b64enc }}
19+
database-bucket: {{ .Values.s3.database_bucket | b64enc }}{{ else if eq .Values.global.storage "swift"}}
20+
username: {{ .swift.username | b64enc }}
21+
password: {{ .swift.password | b64enc }}
22+
authurl: {{ .swift.authurl | b64enc }}
23+
tenant: {{ .swift.tenant | b64enc }}
24+
authversion: {{ .swift.authversion | b64enc }}
25+
database-container: {{ .swift.database_container | b64enc }}{{else if eq .Values.global.storage "minio"}}
26+
accesskey: OFRaUlkySlJXTVBUNlVNWFI2STU=
27+
secretkey: Z2JzdHJPdm90TU1jZzJzTWZHVWhBNWE2RXQvRUk1QUx0SUhzb2JZaw=={{ end }}

charts/database/values.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
org: "deisci"
2+
pull_policy: "Always"
3+
docker_tag: canary
4+
# limits_cpu: "100m"
5+
# limits_memory: "50Mi"
6+
global:
7+
# Set the storage backend
8+
#
9+
# Valid values are:
10+
# - s3: Store persistent data in AWS S3 (configure in S3 section)
11+
# - azure: Store persistent data in Azure's object storage
12+
# - gcs: Store persistent data in Google Cloud Storage
13+
# - minio: Store persistent data on in-cluster Minio server
14+
storage: minio
15+
# Set the location of Workflow's PostgreSQL database
16+
#
17+
# Valid values are:
18+
# - on-cluster: Run PostgreSQL within the Kubernetes cluster (credentials are generated
19+
# automatically; backups are sent to object storage
20+
# configured above)
21+
# - off-cluster: Run PostgreSQL outside the Kubernetes cluster (configure in database section)
22+
database_location: "on-cluster"
23+
24+
s3:
25+
# Your AWS access key. Leave it empty if you want to use IAM credentials.
26+
accesskey: ""
27+
# Your AWS secret key. Leave it empty if you want to use IAM credentials.
28+
secretkey: ""
29+
# Any S3 region
30+
region: "us-west-1"
31+
# Your buckets.
32+
database_bucket: "your-database-bucket-name"
33+
34+
azure:
35+
accountname: "YOUR ACCOUNT NAME"
36+
accountkey: "YOUR ACCOUNT KEY"
37+
database_container: "your-database-container-name"
38+
39+
gcs:
40+
# key_json is expanded into a JSON file on the remote server. It must be
41+
# well-formatted JSON data.
42+
key_json: ''
43+
database_bucket: "your-database-bucket-name"
44+
45+
swift:
46+
username: "Your OpenStack Swift Username"
47+
password: "Your OpenStack Swift Password"
48+
authurl: "Swift auth URL for obtaining an auth token"
49+
# Your OpenStack tenant name if you are using auth version 2 or 3.
50+
tenant: ""
51+
authversion: "Your OpenStack swift auth version"
52+
database_container: "your-database-container-name"
53+
54+
postgres:
55+
name: "database name"
56+
username: "database username"
57+
password: "database password"
58+
host: "database host"
59+
port: "database port"

0 commit comments

Comments
 (0)