summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNishant Kumar <nk613n@att.com>2019-02-10 21:05:00 +0000
committerNishant Kumar <nk613n@att.com>2019-03-07 15:16:39 +0000
commitd9f145e2a6eb4506860aa9ad22ee69e1629e1461 (patch)
treea0dc240bad454a67976e61e13e14d5bf28e7dab6
parent919868e16c86bf18ef6403cbef5fe625cbfb7eed (diff)
[Database] Shipyard DB changes
- Use helm-toolkit for DB initialization [0] - Create DB auxiliary Job for shipyard specific additonal DB operations - Refactor Job dependencies [0] https://review.openstack.org/#/c/635348/ Depends-On: https://review.openstack.org/#/c/635348/ Change-Id: I093671f9bce747b491f22dd8f38f597bd9dae9af
Notes
Notes (review): Code-Review+1: Drew Walters <drewwalters96@gmail.com> Code-Review+2: Scott Hussey <sthussey@att.com> Code-Review+2: Bryan Strassner <strassner.bryan@gmail.com> Workflow+1: Bryan Strassner <strassner.bryan@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 07 Mar 2019 21:21:39 +0000 Reviewed-on: https://review.openstack.org/636147 Project: openstack/airship-shipyard Branch: refs/heads/master
-rw-r--r--charts/shipyard/templates/bin/_airflow-db-init.sh.tpl50
-rw-r--r--charts/shipyard/templates/bin/_shipyard-db-auxiliary.sh.tpl46
-rw-r--r--charts/shipyard/templates/bin/_shipyard-db-init.sh.tpl55
-rw-r--r--charts/shipyard/templates/configmap-airflow-bin.yaml2
-rw-r--r--charts/shipyard/templates/configmap-shipyard-bin.yaml4
-rw-r--r--charts/shipyard/templates/job-airflow-db-init.yaml17
-rw-r--r--charts/shipyard/templates/job-shipyard-db-auxiliary.yaml99
-rw-r--r--charts/shipyard/templates/job-shipyard-db-init.yaml19
-rw-r--r--charts/shipyard/templates/job-shipyard-db-sync.yaml20
-rw-r--r--charts/shipyard/templates/secret-airflow-db.yaml3
-rw-r--r--charts/shipyard/templates/secret-shipyard-db.yaml5
-rw-r--r--charts/shipyard/values.yaml19
12 files changed, 193 insertions, 146 deletions
diff --git a/charts/shipyard/templates/bin/_airflow-db-init.sh.tpl b/charts/shipyard/templates/bin/_airflow-db-init.sh.tpl
deleted file mode 100644
index 127462c..0000000
--- a/charts/shipyard/templates/bin/_airflow-db-init.sh.tpl
+++ /dev/null
@@ -1,50 +0,0 @@
1#!/bin/bash
2
3{{/*
4Copyright 2017 The Openstack-Helm Authors.
5Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6
7Licensed under the Apache License, Version 2.0 (the "License");
8you may not use this file except in compliance with the License.
9You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13Unless required by applicable law or agreed to in writing, software
14distributed under the License is distributed on an "AS IS" BASIS,
15WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16See the License for the specific language governing permissions and
17limitations under the License.
18*/}}
19
20set -ex
21export HOME=/tmp
22
23# Extract the DB string from shipyard.conf and get the
24# value of the DB host and port
25db_string=`grep -i sql_alchemy_conn ${AIRFLOW_CONFIG_FILE}`
26db_fqdn=`echo ${db_string#*@} | cut -f1 -d"."`
27db_port=`echo ${db_string#*@} | grep -o "[0-9]\+"`
28
29pgsql_superuser_cmd () {
30 DB_COMMAND="$1"
31 if [[ ! -z $2 ]]; then
32 EXPORT PGDATABASE=$2
33 fi
34
35 psql \
36 -h $db_fqdn \
37 -p $db_port \
38 -U ${DB_ADMIN_USER} \
39 --command="${DB_COMMAND}"
40}
41
42# Create db
43pgsql_superuser_cmd "SELECT 1 FROM pg_database WHERE datname = '$DB_NAME'" | grep -q 1 || pgsql_superuser_cmd "CREATE DATABASE $DB_NAME"
44
45# Create db user
46pgsql_superuser_cmd "SELECT * FROM pg_roles WHERE rolname = '$DB_SERVICE_USER';" | tail -n +3 | head -n -2 | grep -q 1 || \
47 pgsql_superuser_cmd "CREATE ROLE ${DB_SERVICE_USER} LOGIN PASSWORD '$DB_SERVICE_PASSWORD'"
48
49# Grant permissions to user
50pgsql_superuser_cmd "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME to $DB_SERVICE_USER;"
diff --git a/charts/shipyard/templates/bin/_shipyard-db-auxiliary.sh.tpl b/charts/shipyard/templates/bin/_shipyard-db-auxiliary.sh.tpl
new file mode 100644
index 0000000..2f47dd7
--- /dev/null
+++ b/charts/shipyard/templates/bin/_shipyard-db-auxiliary.sh.tpl
@@ -0,0 +1,46 @@
1#!/bin/bash
2
3{{/*
4Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
5
6Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing, software
13distributed under the License is distributed on an "AS IS" BASIS,
14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15See the License for the specific language governing permissions and
16limitations under the License.
17*/}}
18
19set -e
20
21if [[ ! -v DB_HOST ]]; then
22 echo "environment variable DB_HOST not set"
23 exit 1
24elif [[ ! -v DB_ADMIN_USER ]]; then
25 echo "environment variable DB_ADMIN_USER not set"
26 exit 1
27elif [[ ! -v PGPASSWORD ]]; then
28 echo "environment variable PGPASSWORD not set"
29 exit 1
30elif [[ ! -v USER_DB_USER ]]; then
31 echo "environment variable USER_DB_USER not set"
32 exit 1
33elif [[ ! -v DB_PORT ]]; then
34 echo "environment variable USER_DB_USER not set"
35 exit 1
36elif [[ ! -v USER_DB_NAME ]]; then
37 echo "environment variable USER_DB_NAME not set"
38 exit 1
39else
40 echo "Got DB connection info"
41fi
42
43# Grant permissions to shipyard user to the airflow dataabase tables
44# This will allow shipyard user to query airflow database
45/usr/bin/psql -h ${DB_HOST} -p ${DB_PORT} -U ${DB_ADMIN_USER} -d ${AIRFLOW_DB_NAME} \
46--command="GRANT select, insert, update, delete on all tables in schema public to $USER_DB_USER;"
diff --git a/charts/shipyard/templates/bin/_shipyard-db-init.sh.tpl b/charts/shipyard/templates/bin/_shipyard-db-init.sh.tpl
deleted file mode 100644
index a4b8718..0000000
--- a/charts/shipyard/templates/bin/_shipyard-db-init.sh.tpl
+++ /dev/null
@@ -1,55 +0,0 @@
1#!/bin/bash
2
3{{/*
4Copyright 2017 The Openstack-Helm Authors.
5Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6
7Licensed under the Apache License, Version 2.0 (the "License");
8you may not use this file except in compliance with the License.
9You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13Unless required by applicable law or agreed to in writing, software
14distributed under the License is distributed on an "AS IS" BASIS,
15WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16See the License for the specific language governing permissions and
17limitations under the License.
18*/}}
19
20set -ex
21export HOME=/tmp
22
23# Extract the DB string from shipyard.conf and get the
24# value of the DB host and port
25db_string=`grep -i postgresql_db ${SHIPYARD_CONFIG_FILE}`
26db_fqdn=`echo ${db_string#*@} | cut -f1 -d"."`
27db_port=`echo ${db_string#*@} | grep -o "[0-9]\+"`
28
29pgsql_superuser_cmd () {
30 DB_COMMAND="$1"
31 if [[ ! -z $2 ]]; then
32 EXPORT PGDATABASE=$2
33 fi
34
35 psql \
36 -h $db_fqdn \
37 -p $db_port \
38 -U ${DB_ADMIN_USER} \
39 --command="${DB_COMMAND}"
40}
41
42# Create db
43pgsql_superuser_cmd "SELECT 1 FROM pg_database WHERE datname = '$DB_NAME'" | grep -q 1 || pgsql_superuser_cmd "CREATE DATABASE $DB_NAME"
44
45# Create db user
46pgsql_superuser_cmd "SELECT * FROM pg_roles WHERE rolname = '$DB_SERVICE_USER';" | tail -n +3 | head -n -2 | grep -q 1 || \
47 pgsql_superuser_cmd "CREATE ROLE ${DB_SERVICE_USER} LOGIN PASSWORD '$DB_SERVICE_PASSWORD'"
48
49# Grant permissions to user
50pgsql_superuser_cmd "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME to $DB_SERVICE_USER;"
51
52# Grant permissions to shipyard user to the airflow dataabase tables
53# This will allow shipyard user to query airflow database
54psql -h $db_fqdn -p $db_port -U ${DB_ADMIN_USER} -d ${AIRFLOW_DB_NAME} \
55--command="GRANT select, insert, update, delete on all tables in schema public to $DB_SERVICE_USER;"
diff --git a/charts/shipyard/templates/configmap-airflow-bin.yaml b/charts/shipyard/templates/configmap-airflow-bin.yaml
index 1850022..0a7ab78 100644
--- a/charts/shipyard/templates/configmap-airflow-bin.yaml
+++ b/charts/shipyard/templates/configmap-airflow-bin.yaml
@@ -24,7 +24,7 @@ data:
24 rabbit-init.sh: |+ 24 rabbit-init.sh: |+
25{{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }} 25{{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }}
26 airflow-db-init.sh: |+ 26 airflow-db-init.sh: |+
27{{ tuple "bin/_airflow-db-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} 27{{- include "helm-toolkit.scripts.pg_db_init" . | indent 4 }}
28 airflow-db-sync.sh: |+ 28 airflow-db-sync.sh: |+
29{{ tuple "bin/_airflow-db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} 29{{ tuple "bin/_airflow-db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
30{{- end }} 30{{- end }}
diff --git a/charts/shipyard/templates/configmap-shipyard-bin.yaml b/charts/shipyard/templates/configmap-shipyard-bin.yaml
index d9ffc75..871dc03 100644
--- a/charts/shipyard/templates/configmap-shipyard-bin.yaml
+++ b/charts/shipyard/templates/configmap-shipyard-bin.yaml
@@ -28,7 +28,9 @@ data:
28 ks-domain-user.sh: | 28 ks-domain-user.sh: |
29{{- include "helm-toolkit.scripts.keystone_domain_user" . | indent 4 }} 29{{- include "helm-toolkit.scripts.keystone_domain_user" . | indent 4 }}
30 shipyard-db-init.sh: |+ 30 shipyard-db-init.sh: |+
31{{ tuple "bin/_shipyard-db-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} 31{{- include "helm-toolkit.scripts.pg_db_init" . | indent 4 }}
32 shipyard-db-sync.sh: |+ 32 shipyard-db-sync.sh: |+
33{{ tuple "bin/_shipyard-db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} 33{{ tuple "bin/_shipyard-db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
34 shipyard-db-auxiliary.sh: |+
35{{ tuple "bin/_shipyard-db-auxiliary.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
34{{- end }} 36{{- end }}
diff --git a/charts/shipyard/templates/job-airflow-db-init.yaml b/charts/shipyard/templates/job-airflow-db-init.yaml
index 18a3e3a..12cf0ca 100644
--- a/charts/shipyard/templates/job-airflow-db-init.yaml
+++ b/charts/shipyard/templates/job-airflow-db-init.yaml
@@ -44,24 +44,22 @@ spec:
44 imagePullPolicy: {{ .Values.images.pull_policy | quote }} 44 imagePullPolicy: {{ .Values.images.pull_policy | quote }}
45{{ tuple $envAll $envAll.Values.pod.resources.jobs.airflow_db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} 45{{ tuple $envAll $envAll.Values.pod.resources.jobs.airflow_db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
46 env: 46 env:
47 - name: AIRFLOW_DB_URL 47 - name: DB_HOST
48 valueFrom: 48 valueFrom:
49 secretKeyRef: 49 secretKeyRef:
50 name: {{ .Values.secrets.postgresql_airflow_db.user }} 50 name: {{ .Values.secrets.postgresql_airflow_db.user }}
51 key: AIRFLOW_DATABASE_URI 51 key: AIRFLOW_DATABASE_HOST
52 - name: AIRFLOW_CONFIG_FILE 52 - name: USER_DB_NAME
53 value: /etc/airflow/airflow.cfg
54 - name: DB_NAME
55 valueFrom: 53 valueFrom:
56 secretKeyRef: 54 secretKeyRef:
57 name: {{ .Values.secrets.postgresql_airflow_db.user }} 55 name: {{ .Values.secrets.postgresql_airflow_db.user }}
58 key: AIRFLOW_DATABASE_NAME 56 key: AIRFLOW_DATABASE_NAME
59 - name: DB_SERVICE_USER 57 - name: USER_DB_USER
60 valueFrom: 58 valueFrom:
61 secretKeyRef: 59 secretKeyRef:
62 name: {{ .Values.secrets.postgresql_airflow_db.user }} 60 name: {{ .Values.secrets.postgresql_airflow_db.user }}
63 key: AIRFLOW_DATABASE_USERNAME 61 key: AIRFLOW_DATABASE_USERNAME
64 - name: DB_SERVICE_PASSWORD 62 - name: USER_DB_PASS
65 valueFrom: 63 valueFrom:
66 secretKeyRef: 64 secretKeyRef:
67 name: {{ .Values.secrets.postgresql_airflow_db.user }} 65 name: {{ .Values.secrets.postgresql_airflow_db.user }}
@@ -76,6 +74,11 @@ spec:
76 secretKeyRef: 74 secretKeyRef:
77 name: {{ .Values.secrets.postgresql_airflow_db.admin }} 75 name: {{ .Values.secrets.postgresql_airflow_db.admin }}
78 key: AIRFLOW_DATABASE_PASSWORD 76 key: AIRFLOW_DATABASE_PASSWORD
77 - name: DB_PORT
78 valueFrom:
79 secretKeyRef:
80 name: {{ .Values.secrets.postgresql_airflow_db.user }}
81 key: DATABASE_PORT
79 command: 82 command:
80 - /tmp/airflow-db-init.sh 83 - /tmp/airflow-db-init.sh
81 volumeMounts: 84 volumeMounts:
diff --git a/charts/shipyard/templates/job-shipyard-db-auxiliary.yaml b/charts/shipyard/templates/job-shipyard-db-auxiliary.yaml
new file mode 100644
index 0000000..8a5f939
--- /dev/null
+++ b/charts/shipyard/templates/job-shipyard-db-auxiliary.yaml
@@ -0,0 +1,99 @@
1{{/*
2Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.job_shipyard_db_auxiliary }}
18{{- $envAll := . }}
19{{- $mounts_shipyard_db_auxiliary := .Values.pod.mounts.shipyard_db_auxiliary.shipyard_db_auxiliary }}
20{{- $mounts_shipyard_db_auxiliary_init := .Values.pod.mounts.shipyard_db_auxiliary.init_container }}
21{{- $serviceAccountName := "shipyard-db-auxiliary" }}
22{{ tuple $envAll "shipyard_db_auxiliary" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: batch/v1
25kind: Job
26metadata:
27 name: shipyard-db-auxiliary
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30spec:
31 template:
32 metadata:
33 labels:
34{{ tuple $envAll "shipyard" "db-auxiliary" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
35 spec:
36 serviceAccountName: {{ $serviceAccountName }}
37 restartPolicy: OnFailure
38 nodeSelector:
39 {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
40 initContainers:
41{{ tuple $envAll "shipyard_db_auxiliary" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
42 containers:
43 - name: shipyard-db-auxiliary
44 image: {{ .Values.images.tags.shipyard_db_auxiliary | quote }}
45 imagePullPolicy: {{ .Values.images.pull_policy | quote }}
46{{ tuple $envAll $envAll.Values.pod.resources.jobs.shipyard_db_auxiliary | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
47 env:
48 - name: DB_HOST
49 valueFrom:
50 secretKeyRef:
51 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
52 key: SHIPYARD_DATABASE_HOST
53 - name: USER_DB_NAME
54 valueFrom:
55 secretKeyRef:
56 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
57 key: SHIPYARD_DATABASE_NAME
58 - name: USER_DB_USER
59 valueFrom:
60 secretKeyRef:
61 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
62 key: SHIPYARD_DATABASE_USERNAME
63 - name: DB_ADMIN_USER
64 valueFrom:
65 secretKeyRef:
66 name: {{ .Values.secrets.postgresql_shipyard_db.admin }}
67 key: SHIPYARD_DATABASE_USERNAME
68 - name: PGPASSWORD
69 valueFrom:
70 secretKeyRef:
71 name: {{ .Values.secrets.postgresql_shipyard_db.admin }}
72 key: SHIPYARD_DATABASE_PASSWORD
73 - name: AIRFLOW_DB_NAME
74 valueFrom:
75 secretKeyRef:
76 name: {{ .Values.secrets.postgresql_airflow_db.user }}
77 key: AIRFLOW_DATABASE_NAME
78 - name: DB_PORT
79 valueFrom:
80 secretKeyRef:
81 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
82 key: DATABASE_PORT
83 - name: SHIPYARD_AUXILIARY_CONFIG
84 value: "True"
85 command:
86 - /tmp/shipyard-db-auxiliary.sh
87 volumeMounts:
88 - name: shipyard-bin
89 mountPath: /tmp/shipyard-db-auxiliary.sh
90 subPath: shipyard-db-auxiliary.sh
91 readOnly: true
92{{ if $mounts_shipyard_db_auxiliary.volumeMounts }}{{ toYaml $mounts_shipyard_db_auxiliary.volumeMounts | indent 10 }}{{ end }}
93 volumes:
94 - name: shipyard-bin
95 configMap:
96 name: shipyard-bin
97 defaultMode: 0555
98{{ if $mounts_shipyard_db_auxiliary.volumes }}{{ toYaml $mounts_shipyard_db_auxiliary.volumes | indent 6 }}{{ end }}
99{{- end }}
diff --git a/charts/shipyard/templates/job-shipyard-db-init.yaml b/charts/shipyard/templates/job-shipyard-db-init.yaml
index 081dc2d..1362378 100644
--- a/charts/shipyard/templates/job-shipyard-db-init.yaml
+++ b/charts/shipyard/templates/job-shipyard-db-init.yaml
@@ -46,24 +46,22 @@ spec:
46 imagePullPolicy: {{ .Values.images.pull_policy | quote }} 46 imagePullPolicy: {{ .Values.images.pull_policy | quote }}
47{{ tuple $envAll $envAll.Values.pod.resources.jobs.shipyard_db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} 47{{ tuple $envAll $envAll.Values.pod.resources.jobs.shipyard_db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
48 env: 48 env:
49 - name: SHIPYARD_DB_URL 49 - name: DB_HOST
50 valueFrom: 50 valueFrom:
51 secretKeyRef: 51 secretKeyRef:
52 name: {{ .Values.secrets.postgresql_shipyard_db.user }} 52 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
53 key: SHIPYARD_DATABASE_URI 53 key: SHIPYARD_DATABASE_HOST
54 - name: SHIPYARD_CONFIG_FILE 54 - name: USER_DB_NAME
55 value: /etc/shipyard/shipyard.conf
56 - name: DB_NAME
57 valueFrom: 55 valueFrom:
58 secretKeyRef: 56 secretKeyRef:
59 name: {{ .Values.secrets.postgresql_shipyard_db.user }} 57 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
60 key: SHIPYARD_DATABASE_NAME 58 key: SHIPYARD_DATABASE_NAME
61 - name: DB_SERVICE_USER 59 - name: USER_DB_USER
62 valueFrom: 60 valueFrom:
63 secretKeyRef: 61 secretKeyRef:
64 name: {{ .Values.secrets.postgresql_shipyard_db.user }} 62 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
65 key: SHIPYARD_DATABASE_USERNAME 63 key: SHIPYARD_DATABASE_USERNAME
66 - name: DB_SERVICE_PASSWORD 64 - name: USER_DB_PASS
67 valueFrom: 65 valueFrom:
68 secretKeyRef: 66 secretKeyRef:
69 name: {{ .Values.secrets.postgresql_shipyard_db.user }} 67 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
@@ -83,6 +81,13 @@ spec:
83 secretKeyRef: 81 secretKeyRef:
84 name: {{ .Values.secrets.postgresql_airflow_db.user }} 82 name: {{ .Values.secrets.postgresql_airflow_db.user }}
85 key: AIRFLOW_DATABASE_NAME 83 key: AIRFLOW_DATABASE_NAME
84 - name: DB_PORT
85 valueFrom:
86 secretKeyRef:
87 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
88 key: DATABASE_PORT
89 - name: SHIPYARD_AUXILIARY_CONFIG
90 value: "True"
86 command: 91 command:
87 - /tmp/shipyard-db-init.sh 92 - /tmp/shipyard-db-init.sh
88 volumeMounts: 93 volumeMounts:
diff --git a/charts/shipyard/templates/job-shipyard-db-sync.yaml b/charts/shipyard/templates/job-shipyard-db-sync.yaml
index 5f45c3a..03dafa6 100644
--- a/charts/shipyard/templates/job-shipyard-db-sync.yaml
+++ b/charts/shipyard/templates/job-shipyard-db-sync.yaml
@@ -46,28 +46,8 @@ spec:
46 imagePullPolicy: {{ .Values.images.pull_policy }} 46 imagePullPolicy: {{ .Values.images.pull_policy }}
47{{ tuple $envAll $envAll.Values.pod.resources.jobs.shipyard_db_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} 47{{ tuple $envAll $envAll.Values.pod.resources.jobs.shipyard_db_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
48 env: 48 env:
49 - name: SHIPYARD_DB_URL
50 valueFrom:
51 secretKeyRef:
52 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
53 key: SHIPYARD_DATABASE_URI
54 - name: SHIPYARD_CONFIG_FILE 49 - name: SHIPYARD_CONFIG_FILE
55 value: /etc/shipyard/shipyard.conf 50 value: /etc/shipyard/shipyard.conf
56 - name: DB_NAME
57 valueFrom:
58 secretKeyRef:
59 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
60 key: SHIPYARD_DATABASE_NAME
61 - name: DB_SERVICE_USER
62 valueFrom:
63 secretKeyRef:
64 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
65 key: SHIPYARD_DATABASE_USERNAME
66 - name: DB_SERVICE_PASSWORD
67 valueFrom:
68 secretKeyRef:
69 name: {{ .Values.secrets.postgresql_shipyard_db.user }}
70 key: SHIPYARD_DATABASE_PASSWORD
71 command: 51 command:
72 - /tmp/shipyard-db-sync.sh 52 - /tmp/shipyard-db-sync.sh
73 volumeMounts: 53 volumeMounts:
diff --git a/charts/shipyard/templates/secret-airflow-db.yaml b/charts/shipyard/templates/secret-airflow-db.yaml
index 30c2f1d..8331fe2 100644
--- a/charts/shipyard/templates/secret-airflow-db.yaml
+++ b/charts/shipyard/templates/secret-airflow-db.yaml
@@ -35,6 +35,9 @@ data:
35{{ $auth.username | b64enc | indent 4 }} 35{{ $auth.username | b64enc | indent 4 }}
36 AIRFLOW_DATABASE_URI: |- 36 AIRFLOW_DATABASE_URI: |-
37{{ tuple "postgresql_airflow_db" "internal" "user" "postgresql" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc | indent 4 }} 37{{ tuple "postgresql_airflow_db" "internal" "user" "postgresql" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc | indent 4 }}
38 AIRFLOW_DATABASE_HOST: |-
39{{ tuple "postgresql_airflow_db" "internal" $envAll | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" | b64enc | indent 4 }}
40 DATABASE_PORT: {{ tuple "postgresql_airflow_db" "internal" "postgresql" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | b64enc }}
38... 41...
39{{- end }} 42{{- end }}
40{{- end }} 43{{- end }}
diff --git a/charts/shipyard/templates/secret-shipyard-db.yaml b/charts/shipyard/templates/secret-shipyard-db.yaml
index 0922957..be10988 100644
--- a/charts/shipyard/templates/secret-shipyard-db.yaml
+++ b/charts/shipyard/templates/secret-shipyard-db.yaml
@@ -33,8 +33,9 @@ data:
33{{ $auth.password | b64enc | indent 4 }} 33{{ $auth.password | b64enc | indent 4 }}
34 SHIPYARD_DATABASE_USERNAME: |- 34 SHIPYARD_DATABASE_USERNAME: |-
35{{ $auth.username | b64enc | indent 4 }} 35{{ $auth.username | b64enc | indent 4 }}
36 SHIPYARD_DATABASE_URI: |- 36 SHIPYARD_DATABASE_HOST: |-
37{{ tuple "postgresql_shipyard_db" "internal" "user" "postgresql" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc | indent 4 }} 37{{ tuple "postgresql_shipyard_db" "internal" $envAll | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" | b64enc | indent 4 }}
38 DATABASE_PORT: {{ tuple "postgresql_shipyard_db" "internal" "postgresql" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | b64enc }}
38... 39...
39{{- end }} 40{{- end }}
40{{- end }} 41{{- end }}
diff --git a/charts/shipyard/values.yaml b/charts/shipyard/values.yaml
index 5e78018..03c3670 100644
--- a/charts/shipyard/values.yaml
+++ b/charts/shipyard/values.yaml
@@ -32,6 +32,7 @@ images:
32 shipyard: quay.io/airshipit/shipyard:latest 32 shipyard: quay.io/airshipit/shipyard:latest
33 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1 33 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
34 shipyard_db_init: docker.io/postgres:9.5 34 shipyard_db_init: docker.io/postgres:9.5
35 shipyard_db_auxiliary: docker.io/postgres:9.5
35 shipyard_db_sync: quay.io/airshipit/shipyard:latest 36 shipyard_db_sync: quay.io/airshipit/shipyard:latest
36 airflow_db_init: docker.io/postgres:9.5 37 airflow_db_init: docker.io/postgres:9.5
37 rabbit_init: docker.io/rabbitmq:3.7-management 38 rabbit_init: docker.io/rabbitmq:3.7-management
@@ -79,9 +80,12 @@ dependencies:
79 services: 80 services:
80 - service: postgresql_shipyard_db 81 - service: postgresql_shipyard_db
81 endpoint: internal 82 endpoint: internal
82 shipyard_db_sync: 83 shipyard_db_auxiliary:
83 jobs: 84 jobs:
84 - shipyard-db-init 85 - shipyard-db-init
86 shipyard_db_sync:
87 jobs:
88 - shipyard-db-auxiliary
85 services: 89 services:
86 - service: postgresql_shipyard_db 90 - service: postgresql_shipyard_db
87 endpoint: internal 91 endpoint: internal
@@ -115,7 +119,6 @@ dependencies:
115 endpoint: internal 119 endpoint: internal
116 shipyard: 120 shipyard:
117 jobs: 121 jobs:
118 - shipyard-db-init
119 - shipyard-db-sync 122 - shipyard-db-sync
120 - shipyard-ks-endpoints 123 - shipyard-ks-endpoints
121 - shipyard-ks-user 124 - shipyard-ks-user
@@ -128,7 +131,6 @@ dependencies:
128 airflow_server: 131 airflow_server:
129 jobs: 132 jobs:
130 - airflow-rabbit-init 133 - airflow-rabbit-init
131 - airflow-db-init
132 - airflow-db-sync 134 - airflow-db-sync
133 services: 135 services:
134 - service: postgresql_airflow_db 136 - service: postgresql_airflow_db
@@ -691,6 +693,9 @@ pod:
691 shipyard_db_init: 693 shipyard_db_init:
692 init_container: null 694 init_container: null
693 shipyard_db_init: 695 shipyard_db_init:
696 shipyard_db_auxiliary:
697 init_container: null
698 shipyard_db_auxiliary:
694 shipyard_db_sync: 699 shipyard_db_sync:
695 init_container: null 700 init_container: null
696 shipyard_db_sync: 701 shipyard_db_sync:
@@ -801,6 +806,13 @@ pod:
801 requests: 806 requests:
802 memory: "128Mi" 807 memory: "128Mi"
803 cpu: "500m" 808 cpu: "500m"
809 shipyard_db_auxiliary:
810 limits:
811 memory: "128Mi"
812 cpu: "500m"
813 requests:
814 memory: "128Mi"
815 cpu: "500m"
804 shipyard_db_sync: 816 shipyard_db_sync:
805 limits: 817 limits:
806 memory: "128Mi" 818 memory: "128Mi"
@@ -829,6 +841,7 @@ manifests:
829 statefulset_airflow_worker: true 841 statefulset_airflow_worker: true
830 ingress_shipyard_api: true 842 ingress_shipyard_api: true
831 job_shipyard_db_init: true 843 job_shipyard_db_init: true
844 job_shipyard_db_auxiliary: true
832 job_shipyard_db_sync: true 845 job_shipyard_db_sync: true
833 job_rabbit_init: true 846 job_rabbit_init: true
834 job_airflow_db_init: true 847 job_airflow_db_init: true