Skip to content

Commit

Permalink
Refactor helm for database config (#1449)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored Sep 8, 2021
1 parent 9da707e commit 1948254
Show file tree
Hide file tree
Showing 17 changed files with 163 additions and 2,225 deletions.
2 changes: 1 addition & 1 deletion charts/flyte-core/templates/admin/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: {{ template "flyte.namespace" . }}
labels: {{ include "flyteadmin.labels" . | nindent 4 }}
data:
{{- with .Values.db }}
{{- with .Values.db.admin }}
db.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- with .Values.configmap.domain }}
Expand Down
8 changes: 8 additions & 0 deletions charts/flyte-core/templates/admin/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ spec:
labels: {{ include "flyteadmin.labels" . | nindent 8 }}
spec:
initContainers:
{{- if .Values.postgres.enabled }}
- name: check-db-ready
image: postgres:10.16-alpine
command:
- sh
- -c
- until pg_isready -h {{ tpl .Values.db.admin.database.host $ }} -p {{ .Values.db.admin.database.port }}; do echo waiting for database; sleep 2; done;
{{- end }}
- command:
- flyteadmin
- --config
Expand Down
2 changes: 1 addition & 1 deletion charts/flyte-core/templates/datacatalog/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: {{ template "flyte.namespace" . }}
labels: {{ include "datacatalog.labels" . | nindent 4 }}
data:
{{- with .Values.db }}
{{- with .Values.db.datacatalog }}
db.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- with .Values.configmap.logger }}
Expand Down
78 changes: 43 additions & 35 deletions charts/flyte-core/templates/datacatalog/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,52 @@ spec:
labels: {{ include "datacatalog.labels" . | nindent 8 }}
spec:
initContainers:
- command:
- datacatalog
- --config
- {{ .Values.datacatalog.configPath }}
- migrate
- run
image: "{{ .Values.datacatalog.image.repository }}:{{ .Values.datacatalog.image.tag }}"
imagePullPolicy: "{{ .Values.datacatalog.image.pullPolicy }}"
name: run-migrations
volumeMounts: {{- include "databaseSecret.volumeMount" . | nindent 8 }}
- mountPath: /etc/datacatalog/config
name: config-volume
containers:
- command:
- datacatalog
- --config
- {{ .Values.datacatalog.configPath }}
{{- with .Values.datacatalog.extraArgs }}
{{- toYaml . | nindent 8 }}
{{- if .Values.postgres.enabled }}
- name: check-db-ready
image: postgres:10.16-alpine
command:
- sh
- -c
- until pg_isready -h {{ tpl .Values.db.datacatalog.database.host $ }} -p {{ .Values.db.datacatalog.database.port }}; do echo waiting for database; sleep 2; done;
{{- end }}
- serve
image: "{{ .Values.datacatalog.image.repository }}:{{ .Values.datacatalog.image.tag }}"
imagePullPolicy: "{{ .Values.datacatalog.image.pullPolicy }}"
name: datacatalog
ports:
- containerPort: 8088
- containerPort: 8089
resources: {{ toYaml .Values.datacatalog.resources | nindent 10 }}
volumeMounts: {{- include "databaseSecret.volumeMount" . | nindent 8 }}
- mountPath: /etc/datacatalog/config
name: config-volume
- command:
- datacatalog
- --config
- {{ .Values.datacatalog.configPath }}
- migrate
- run
image: "{{ .Values.datacatalog.image.repository }}:{{ .Values.datacatalog.image.tag }}"
imagePullPolicy: "{{ .Values.datacatalog.image.pullPolicy }}"
name: run-migrations
volumeMounts: {{- include "databaseSecret.volumeMount" . | nindent 8 }}
- mountPath: /etc/datacatalog/config
name: config-volume
containers:
- command:
- datacatalog
- --config
- {{ .Values.datacatalog.configPath }}
{{- with .Values.datacatalog.extraArgs }}
{{- toYaml . | nindent 8 }}
{{- end }}
- serve
image: "{{ .Values.datacatalog.image.repository }}:{{ .Values.datacatalog.image.tag }}"
imagePullPolicy: "{{ .Values.datacatalog.image.pullPolicy }}"
name: datacatalog
ports:
- containerPort: 8088
- containerPort: 8089
resources: {{ toYaml .Values.datacatalog.resources | nindent 10 }}
volumeMounts: {{- include "databaseSecret.volumeMount" . | nindent 8 }}
- mountPath: /etc/datacatalog/config
name: config-volume
serviceAccountName: {{ template "datacatalog.name" . }}
volumes: {{- include "databaseSecret.volume" . | nindent 6 }}
- emptyDir: {}
name: shared-data
- configMap:
name: datacatalog-config
name: config-volume
- emptyDir: {}
name: shared-data
- configMap:
name: datacatalog-config
name: config-volume
{{- with .Values.datacatalog.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
Expand Down
27 changes: 18 additions & 9 deletions charts/flyte-core/values-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,24 @@ storage:
region: "{{ .Values.userSettings.accountRegion }}"

db:
database:
port: 5432
# -- Create a user called flyteadmin
username: flyteadmin
host: "{{ .Values.userSettings.rdsHost }}"
# -- Create a DB called flyteadmin (OR change the name here)
dbname: flyteadmin
passwordPath: /etc/db/pass.txt

datacatalog:
database:
port: 5432
# -- Create a user called flyteadmin
username: flyteadmin
host: "{{ .Values.userSettings.rdsHost }}"
# -- Create a DB called datacatalog (OR change the name here)
dbname: flyteadmin
passwordPath: /etc/db/pass.txt
admin:
database:
port: 5432
# -- Create a user called flyteadmin
username: flyteadmin
host: "{{ .Values.userSettings.rdsHost }}"
# -- Create a DB called flyteadmin (OR change the name here)
dbname: flyteadmin
passwordPath: /etc/db/pass.txt
#
# CONFIGMAPS
#
Expand Down
2 changes: 1 addition & 1 deletion charts/flyte/templates/admin/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: {{ template "flyte.namespace" . }}
labels: {{ include "flyteadmin.labels" . | nindent 4 }}
data:
{{- with .Values.db }}
{{- with .Values.db.admin }}
db.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- with .Values.configmap.domain }}
Expand Down
2 changes: 1 addition & 1 deletion charts/flyte/templates/admin/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
command:
- sh
- -c
- until pg_isready -h {{ tpl .Values.db.database.host $ }} -p {{ .Values.db.database.port }}; do echo waiting for database; sleep 2; done;
- until pg_isready -h {{ tpl .Values.db.admin.database.host $ }} -p {{ .Values.db.admin.database.port }}; do echo waiting for database; sleep 2; done;
{{- end }}
- command:
- flyteadmin
Expand Down
2 changes: 1 addition & 1 deletion charts/flyte/templates/datacatalog/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: {{ template "flyte.namespace" . }}
labels: {{ include "datacatalog.labels" . | nindent 4 }}
data:
{{- with .Values.db }}
{{- with .Values.db.datacatalog }}
db.yaml: | {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- with .Values.configmap.logger }}
Expand Down
10 changes: 9 additions & 1 deletion charts/flyte/templates/datacatalog/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ spec:
labels: {{ include "datacatalog.labels" . | nindent 8 }}
spec:
initContainers:
{{- if .Values.postgres.enabled }}
- name: check-db-ready
image: postgres:10.16-alpine
command:
- sh
- -c
- until pg_isready -h {{ tpl .Values.db.datacatalog.database.host $ }} -p {{ .Values.db.datacatalog.database.port }}; do echo waiting for database; sleep 2; done;
{{- end }}
- command:
- datacatalog
- --config
Expand All @@ -29,7 +37,7 @@ spec:
name: run-migrations
volumeMounts: {{- include "databaseSecret.volumeMount" . | nindent 8 }}
- mountPath: /etc/datacatalog/config
name: config-volume
name: config-volume
containers:
- command:
- datacatalog
Expand Down
2 changes: 1 addition & 1 deletion charts/flyte/templates/postgres/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
- name: POSTGRES_HOST_AUTH_METHOD
value: trust
- name: POSTGRES_DB
value: {{ .Values.db.database.dbname }}
value: {{ .Values.db.admin.database.dbname }}
ports:
- containerPort: 5432
name: postgres
Expand Down
27 changes: 18 additions & 9 deletions charts/flyte/values-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,24 @@ storage:
region: "{{ .Values.userSettings.accountRegion }}"

db:
database:
port: 5432
# -- Create a user called flyteadmin
username: flyteadmin
host: "{{ .Values.userSettings.rdsHost }}"
# -- Create a DB called flyteadmin (OR change the name here)
dbname: flyteadmin
passwordPath: /etc/db/pass.txt

datacatalog:
database:
port: 5432
# -- Create a user called flyteadmin
username: flyteadmin
host: "{{ .Values.userSettings.rdsHost }}"
# -- Create a DB called datacatalog (OR change the name here)
dbname: flyteadmin
passwordPath: /etc/db/pass.txt
admin:
database:
port: 5432
# -- Create a user called flyteadmin
username: flyteadmin
host: "{{ .Values.userSettings.rdsHost }}"
# -- Create a DB called flyteadmin (OR change the name here)
dbname: flyteadmin
passwordPath: /etc/db/pass.txt
#
# CONFIGMAPS
#
Expand Down
21 changes: 21 additions & 0 deletions charts/flyte/values-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,24 @@ configmap:
spark: spark
container_array: k8s-array
pytorch: pytorch

#
# POSTGRES
#

postgres:
enabled: false

#
# MINIO
#

minio:
enabled: false

#
# CONTOUR
#

contour:
enabled: false
18 changes: 12 additions & 6 deletions charts/flyte/values-sandbox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,18 @@ storage:

# Database configuration
db:
database:
port: 5432
username: postgres
host: postgres
dbname: "flyte"

datacatalog:
database:
port: 5432
username: postgres
host: postgres
dbname: "datacatalog"
admin:
database:
port: 5432
username: postgres
host: postgres
dbname: "flyteadmin"
# --------------------------------------------------------------------
# Specializing your deployment using configuration
# -------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion deployment/eks/flyte_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ spec:
- mountPath: /etc/db
name: db-pass
- mountPath: /etc/datacatalog/config
name: config-volume
name: config-volume
containers:
- command:
- datacatalog
Expand Down
Loading

0 comments on commit 1948254

Please sign in to comment.