Cinder Bootstrap
This commit adds the bootstrap framework to Cinder. - If volume type already exists do not recreate - Create volume types as defined in Values.conf.backends - Create additional volume types defined in Values.bootstrap, available backends must be defined in Values.conf.backends Change-Id: I577df7bf50d66c8ef70e74466a0bf1c4c221ca68 Partially implements: https://blueprints.launchpad.net/openstack-helm/+spec/service-bootstrap
This commit is contained in:
parent
c394d22112
commit
d95d9990de
53
cinder/templates/bin/_bootstrap.sh.tpl
Normal file
53
cinder/templates/bin/_bootstrap.sh.tpl
Normal file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2017 The Openstack-Helm Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -ex
|
||||
export HOME=/tmp
|
||||
|
||||
{{- if .Values.bootstrap.enabled | default "echo 'Not Enabled'" }}
|
||||
|
||||
{{- /* Create volumes defined in Values.bootstrap */}}
|
||||
{{- range $name, $properties := .Values.bootstrap.volume_types }}
|
||||
{{- if $properties.volume_backend_name }}
|
||||
openstack volume type show {{ $name }} || \
|
||||
openstack volume type create \
|
||||
--public \
|
||||
{{- range $key, $value := $properties }}
|
||||
--property {{ $key }}={{ $value }} \
|
||||
{{- end }}
|
||||
{{ $name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Create volumes defined in Values.conf.backends */}}
|
||||
{{- if .Values.bootstrap.bootstrap_conf_backends }}
|
||||
{{- range $name, $properties := .Values.conf.backends }}
|
||||
{{- if $properties }}
|
||||
openstack volume type show {{ $name }} || \
|
||||
openstack volume type create \
|
||||
--public \
|
||||
--property volume_backend_name={{ $properties.volume_backend_name }} \
|
||||
{{ $name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Check volume type and properties were added */}}
|
||||
cinder extra-specs-list
|
||||
|
||||
{{- end }}
|
||||
|
||||
exit 0
|
@ -33,3 +33,7 @@ data:
|
||||
{{ tuple "bin/_cinder-scheduler.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
cinder-volume.sh: |
|
||||
{{ tuple "bin/_cinder-volume.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
{{- if .Values.bootstrap.enabled }}
|
||||
bootstrap.sh: |+
|
||||
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
{{- end }}
|
||||
|
68
cinder/templates/job_bootstrap.yaml
Normal file
68
cinder/templates/job_bootstrap.yaml
Normal file
@ -0,0 +1,68 @@
|
||||
# Copyright 2017 The Openstack-Helm Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
{{- if .Values.bootstrap.enabled }}
|
||||
{{- $envAll := . }}
|
||||
{{- $ksAdminSecret := $envAll.Values.keystone.admin_secret | default "cinder-env-keystone-admin" }}
|
||||
{{- $dependencies := .Values.dependencies.bootstrap }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: cinder-bootstrap
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
pod.beta.kubernetes.io/init-containers: '[
|
||||
{{ tuple $envAll $dependencies "[]" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 10 }}
|
||||
]'
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
nodeSelector:
|
||||
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
|
||||
containers:
|
||||
- name: cinder-bootstrap
|
||||
image: {{ .Values.images.bootstrap }}
|
||||
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||
{{- if .Values.resources.enabled }}
|
||||
resources:
|
||||
requests:
|
||||
memory: {{ .Values.resources.bootstrap.requests.memory | quote }}
|
||||
cpu: {{ .Values.resources.bootstrap.requests.cpu | quote }}
|
||||
limits:
|
||||
memory: {{ .Values.resources.bootstrap.limits.memory | quote }}
|
||||
cpu: {{ .Values.resources.bootstrap.limits.cpu | quote }}
|
||||
{{- end }}
|
||||
command:
|
||||
- bash
|
||||
- /tmp/bootstrap.sh
|
||||
env:
|
||||
{{- with $env := dict "ksUserSecret" $ksAdminSecret }}
|
||||
{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: cinder-etc
|
||||
mountPath: /etc/cinder/cinder.conf
|
||||
subPath: cinder.conf
|
||||
- name: cinder-bin
|
||||
mountPath: /tmp/bootstrap.sh
|
||||
subPath: bootstrap.sh
|
||||
volumes:
|
||||
- name: cinder-etc
|
||||
configMap:
|
||||
name: cinder-etc
|
||||
- name: cinder-bin
|
||||
configMap:
|
||||
name: cinder-bin
|
||||
{{- end }}
|
@ -34,6 +34,7 @@ images:
|
||||
ks_service: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3
|
||||
ks_endpoints: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3
|
||||
api: docker.io/kolla/ubuntu-source-cinder-api:3.0.3
|
||||
bootstrap: docker.io/kolla/ubuntu-source-cinder-api:3.0.3
|
||||
scheduler: docker.io/kolla/ubuntu-source-cinder-scheduler:3.0.3
|
||||
volume: docker.io/kolla/ubuntu-source-cinder-volume:3.0.3
|
||||
backup: docker.io/kolla/ubuntu-source-cinder-backup:3.0.3
|
||||
@ -55,6 +56,14 @@ termination_grace_period:
|
||||
api:
|
||||
timeout: 30
|
||||
|
||||
bootstrap:
|
||||
enabled: true
|
||||
bootstrap_conf_backends: true
|
||||
volume_types:
|
||||
name:
|
||||
group:
|
||||
volume_backend_name:
|
||||
|
||||
keystone:
|
||||
admin_user: "admin"
|
||||
admin_user_domain: "default"
|
||||
@ -71,7 +80,6 @@ network:
|
||||
enabled: false
|
||||
port: 30877
|
||||
|
||||
|
||||
conf:
|
||||
paste:
|
||||
override:
|
||||
@ -171,6 +179,10 @@ dependencies:
|
||||
service:
|
||||
- mariadb
|
||||
- keystone-api
|
||||
bootstrap:
|
||||
service:
|
||||
- keystone-api
|
||||
- cinder-api
|
||||
volume:
|
||||
jobs:
|
||||
- cinder-db-sync
|
||||
@ -285,6 +297,13 @@ resources:
|
||||
limits:
|
||||
memory: "1024Mi"
|
||||
cpu: "2000m"
|
||||
cinder_bootstrap:
|
||||
requests:
|
||||
memory: "124Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "1024Mi"
|
||||
cpu: "2000m"
|
||||
cinder_scheduler:
|
||||
requests:
|
||||
memory: "124Mi"
|
||||
|
Loading…
Reference in New Issue
Block a user