diff --git a/neutron/templates/bin/_bootstrap.sh.tpl b/neutron/templates/bin/_bootstrap.sh.tpl new file mode 100644 index 0000000000..81a1391466 --- /dev/null +++ b/neutron/templates/bin/_bootstrap.sh.tpl @@ -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'" }} diff --git a/neutron/templates/configmap-bin.yaml b/neutron/templates/configmap-bin.yaml index bd72ea3670..9a27660847 100644 --- a/neutron/templates/configmap-bin.yaml +++ b/neutron/templates/configmap-bin.yaml @@ -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: |+ diff --git a/neutron/templates/job-bootstrap.yaml b/neutron/templates/job-bootstrap.yaml new file mode 100644 index 0000000000..b59ae866f7 --- /dev/null +++ b/neutron/templates/job-bootstrap.yaml @@ -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 }} diff --git a/neutron/values.yaml b/neutron/values.yaml index 12387e7764..566f98b096 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -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: