Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

Commit d0a9bd2

Browse files
Merge pull request #289 from portdirect/0.3.0/db-management-job-scripts
feat: replace ansible with PyMySQL for DB Creation
2 parents 2da1aa6 + c0141e1 commit d0a9bd2

39 files changed

+556
-311
lines changed

cinder/templates/bin/_db-init.sh.tpl

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Copyright 2017 The Openstack-Helm Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ex
18+
19+
cinder-manage db sync

cinder/templates/configmap-bin.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ kind: ConfigMap
1717
metadata:
1818
name: cinder-bin
1919
data:
20-
db-init.sh: |+
21-
{{ tuple "bin/_db-init.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
20+
db-init.py: |
21+
{{- include "helm-toolkit.db_init" . | indent 4 }}
22+
db-sync.sh: |
23+
{{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
2224
ks-service.sh: |+
2325
{{- include "helm-toolkit.keystone_service" . | indent 4 }}
2426
ks-endpoints.sh: |+

cinder/templates/etc/_cinder.conf.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ os_region_name = {{ .Values.keystone.cinder_region_name }}
4040
host=cinder-volume-worker
4141

4242
[database]
43-
connection = mysql+pymysql://{{ .Values.database.cinder_user }}:{{ .Values.database.cinder_password }}@{{ .Values.database.address }}:{{ .Values.database.port }}/{{ .Values.database.cinder_database_name }}
43+
connection = {{ tuple "oslo_db" "internal" "user" "mysql" . | include "helm-toolkit.authenticated_endpoint_uri_lookup" }}
4444
max_retries = -1
4545

4646
[keystone_authtoken]

cinder/templates/job-db-init.yaml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,37 @@ spec:
4343
cpu: {{ .Values.resources.cinder_db_init.limits.cpu | quote }}
4444
{{- end }}
4545
env:
46-
- name: ANSIBLE_LIBRARY
47-
value: /usr/share/ansible/
46+
- name: ROOT_DB_CONNECTION
47+
valueFrom:
48+
secretKeyRef:
49+
name: cinder-db-root
50+
key: DB_CONNECTION
51+
- name: OPENSTACK_CONFIG_FILE
52+
value: /etc/cinder/cinder.conf
53+
- name: OPENSTACK_CONFIG_DB_SECTION
54+
value: database
55+
- name: OPENSTACK_CONFIG_DB_KEY
56+
value: connection
4857
command:
49-
- bash
50-
- /tmp/db-init.sh
58+
- python
59+
- /tmp/db-init.py
5160
volumeMounts:
52-
- name: dbinitsh
53-
mountPath: /tmp/db-init.sh
54-
subPath: db-init.sh
61+
- name: cinder-bin
62+
mountPath: /tmp/db-init.py
63+
subPath: db-init.py
64+
readOnly: true
65+
- name: etccinder
66+
mountPath: /etc/cinder
67+
- name: cinderconf
68+
mountPath: /etc/cinder/cinder.conf
69+
subPath: cinder.conf
5570
readOnly: true
5671
volumes:
57-
- name: dbinitsh
72+
- name: etccinder
73+
emptyDir: {}
74+
- name: cinderconf
75+
configMap:
76+
name: cinder-etc
77+
- name: cinder-bin
5878
configMap:
5979
name: cinder-bin

cinder/templates/job-db-sync.yaml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,25 @@ spec:
4343
cpu: {{ .Values.resources.cinder_db_sync.limits.cpu | quote }}
4444
{{- end }}
4545
command:
46-
- cinder-manage
47-
args:
48-
- --config-dir
49-
- /etc/cinder/conf
50-
- db
51-
- sync
46+
- bash
47+
- /tmp/db-sync.sh
5248
volumeMounts:
53-
- name: pod-etc-cinder
49+
- name: cinder-bin
50+
mountPath: /tmp/db-sync.sh
51+
subPath: db-sync.sh
52+
readOnly: true
53+
- name: etccinder
5454
mountPath: /etc/cinder
55-
- name: cinderconf
56-
mountPath: /etc/cinder/conf/cinder.conf
55+
- name: cinderapiconf
56+
mountPath: /etc/cinder/cinder.conf
5757
subPath: cinder.conf
5858
readOnly: true
5959
volumes:
60-
- name: pod-etc-cinder
60+
- name: etccinder
6161
emptyDir: {}
62-
- name: cinderconf
62+
- name: cinderapiconf
6363
configMap:
6464
name: cinder-etc
65+
- name: cinder-bin
66+
configMap:
67+
name: cinder-bin
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: cinder-db-root
5+
type: Opaque
6+
data:
7+
DB_CONNECTION: {{ tuple "oslo_db" "internal" "admin" "mysql" . | include "helm-toolkit.authenticated_endpoint_uri_lookup" | b64enc }}

cinder/values.yaml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ labels:
2727
node_selector_value: enabled
2828

2929
images:
30-
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.1.1
30+
db_init: quay.io/stackanetes/stackanetes-cinder-api:newton
31+
db_sync: quay.io/stackanetes/stackanetes-cinder-api:newton
3132
ks_user: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
3233
ks_service: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
3334
ks_endpoints: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
34-
db_init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton
35-
db_sync: quay.io/stackanetes/stackanetes-cinder-api:newton
3635
api: quay.io/stackanetes/stackanetes-cinder-api:newton
3736
scheduler: quay.io/stackanetes/stackanetes-cinder-scheduler:newton
3837
volume: quay.io/stackanetes/stackanetes-cinder-volume:newton
38+
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.1.1
3939
pull_policy: "IfNotPresent"
4040

4141
upgrades:
@@ -69,15 +69,6 @@ network:
6969
enabled: false
7070
port: 30877
7171

72-
database:
73-
address: mariadb
74-
port: 3306
75-
root_user: root
76-
root_password: password
77-
cinder_database_name: cinder
78-
cinder_password: password
79-
cinder_user: cinder
80-
8172
ceph:
8273
enabled: true
8374
monitors: []
@@ -203,6 +194,20 @@ endpoints:
203194
scheme: 'http'
204195
port:
205196
api: 8776
197+
oslo_db:
198+
auth:
199+
admin:
200+
username: root
201+
password: password
202+
user:
203+
username: cinder
204+
password: password
205+
hosts:
206+
default: mariadb
207+
path: /cinder
208+
scheme: mysql+pymysql
209+
port:
210+
mysql: 3306
206211

207212
resources:
208213
enabled: false
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Copyright 2017 The Openstack-Helm Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -ex
18+
19+
glance-manage db_sync

glance/templates/bin/_init.sh.tpl

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)