Neutron: Add bootstrap job

This PS adds a bootstrap job to Neutron, in the same format as
Keystone and other services.

Change-Id: Ice724be9c8b20b27aaddf528f6cc0e848793c1c1
This commit is contained in:
Pete Birley 2017-07-06 21:16:05 -05:00
parent fecac47b5a
commit ab52a43425
4 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#!/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
{{ .Values.bootstrap.script | default "echo 'Not Enabled'" }}

View File

@ -19,6 +19,10 @@ kind: ConfigMap
metadata:
name: neutron-bin
data:
{{- if .Values.bootstrap.enabled }}
bootstrap.sh: |+
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
rally-test.sh: |
{{- include "helm-toolkit.scripts.rally_test" . | indent 4 }}
db-init.py: |+

View File

@ -0,0 +1,55 @@
# 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.
{{- $envAll := . }}
{{- if .Values.bootstrap.enabled }}
{{- $dependencies := .Values.dependencies.bootstrap }}
{{- $mounts_neutron_bootstrap := .Values.mounts.neutron_bootstrap.neutron_bootstrap }}
{{- $mounts_neutron_bootstrap_init := .Values.mounts.neutron_bootstrap.init_container }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: neutron-bootstrap
spec:
template:
spec:
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.server.node_selector_key }}: {{ .Values.labels.server.node_selector_value }}
initContainers:
{{ tuple $envAll $dependencies $mounts_neutron_bootstrap_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: neutron-bootstrap
image: {{ .Values.images.bootstrap }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.resources.jobs.bootstrap | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
env:
{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
{{- end }}
command:
- /tmp/bootstrap.sh
volumeMounts:
- name: neutron-bin
mountPath: /tmp/bootstrap.sh
subPath: bootstrap.sh
{{- if $mounts_neutron_bootstrap.volumeMounts }}{{ toYaml $mounts_neutron_bootstrap.volumeMounts | indent 10 }}{{ end }}
volumes:
- name: neutron-bin
configMap:
name: neutron-bin
defaultMode: 0555
{{- if $mounts_neutron_bootstrap.volumes }}{{ toYaml $mounts_neutron_bootstrap.volumes | indent 6 }}{{ end }}
{{- end }}

View File

@ -21,6 +21,7 @@ replicas:
server: 1
images:
bootstrap: docker.io/kolla/ubuntu-source-neutron-server:3.0.3
test: docker.io/kolla/ubuntu-binary-rally:4.0.0
db_init: docker.io/kolla/ubuntu-source-neutron-server:3.0.3
db_sync: docker.io/kolla/ubuntu-source-neutron-server:3.0.3
@ -137,6 +138,11 @@ network:
metadata:
workers: 4
bootstrap:
enabled: false
script: |
neutron agent-list
dependencies:
db_init:
services:
@ -218,6 +224,12 @@ dependencies:
endpoint: internal
- service: compute
endpoint: internal
bootstrap:
services:
- service: network
endpoint: internal
- service: compute
endpoint: internal
resources:
enabled: false
@ -622,3 +634,6 @@ mounts:
neutron_tests:
init_container: null
neutron_tests:
neutron_bootstrap:
init_container: null
neutron_bootstrap: