From 3fe1fc3354267ef169a022bcfd9fa700b458bab0 Mon Sep 17 00:00:00 2001
From: Pete Birley <pete@port.direct>
Date: Tue, 11 Jul 2017 12:03:35 -0500
Subject: [PATCH] Apply bootstrap framework to all remaining services

This PS applies the bootstrap framework to all remaining services.

Change-Id: Ib77778d69e743b1594fbadaf9842e95541703bd1
External-Tracking-ID: OSH-36
---
 barbican/templates/bin/_bootstrap.sh.tpl | 18 ++++++++
 barbican/templates/configmap-bin.yaml    |  4 ++
 barbican/templates/job-bootstrap.yaml    | 56 ++++++++++++++++++++++++
 barbican/values.yaml                     |  9 ++++
 etcd/templates/deployment.yaml           |  2 +-
 etcd/values.yaml                         |  5 +--
 heat/templates/bin/_bootstrap.sh.tpl     | 18 ++++++++
 heat/templates/configmap-bin.yaml        |  4 ++
 heat/templates/job-bootstrap.yaml        | 56 ++++++++++++++++++++++++
 heat/values.yaml                         |  9 ++++
 magnum/templates/bin/_bootstrap.sh.tpl   | 18 ++++++++
 magnum/templates/configmap-bin.yaml      |  4 ++
 magnum/templates/job-bootstrap.yaml      | 56 ++++++++++++++++++++++++
 magnum/values.yaml                       |  9 ++++
 mistral/templates/bin/_bootstrap.sh.tpl  | 18 ++++++++
 mistral/templates/configmap-bin.yaml     |  4 ++
 mistral/templates/job-bootstrap.yaml     | 56 ++++++++++++++++++++++++
 mistral/values.yaml                      |  9 ++++
 senlin/templates/bin/_bootstrap.sh.tpl   | 18 ++++++++
 senlin/templates/configmap-bin.yaml      |  4 ++
 senlin/templates/job-bootstrap.yaml      | 56 ++++++++++++++++++++++++
 senlin/values.yaml                       |  9 ++++
 22 files changed, 438 insertions(+), 4 deletions(-)
 create mode 100644 barbican/templates/bin/_bootstrap.sh.tpl
 create mode 100644 barbican/templates/job-bootstrap.yaml
 create mode 100644 heat/templates/bin/_bootstrap.sh.tpl
 create mode 100644 heat/templates/job-bootstrap.yaml
 create mode 100644 magnum/templates/bin/_bootstrap.sh.tpl
 create mode 100644 magnum/templates/job-bootstrap.yaml
 create mode 100644 mistral/templates/bin/_bootstrap.sh.tpl
 create mode 100644 mistral/templates/job-bootstrap.yaml
 create mode 100644 senlin/templates/bin/_bootstrap.sh.tpl
 create mode 100644 senlin/templates/job-bootstrap.yaml

diff --git a/barbican/templates/bin/_bootstrap.sh.tpl b/barbican/templates/bin/_bootstrap.sh.tpl
new file mode 100644
index 0000000000..81a1391466
--- /dev/null
+++ b/barbican/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/barbican/templates/configmap-bin.yaml b/barbican/templates/configmap-bin.yaml
index 29b952b1bc..641ac9a280 100644
--- a/barbican/templates/configmap-bin.yaml
+++ b/barbican/templates/configmap-bin.yaml
@@ -17,6 +17,10 @@ kind: ConfigMap
 metadata:
   name: barbican-bin
 data:
+{{- if .Values.bootstrap.enabled }}
+  bootstrap.sh: |+
+{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+{{- end }}
   db-init.py: |
 {{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
   db-sync.sh: |
diff --git a/barbican/templates/job-bootstrap.yaml b/barbican/templates/job-bootstrap.yaml
new file mode 100644
index 0000000000..855e3875f1
--- /dev/null
+++ b/barbican/templates/job-bootstrap.yaml
@@ -0,0 +1,56 @@
+# 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_barbican_bootstrap := .Values.mounts.barbican_bootstrap.barbican_bootstrap }}
+{{- $mounts_barbican_bootstrap_init := .Values.mounts.barbican_bootstrap.init_container }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: barbican-bootstrap
+spec:
+  template:
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies $mounts_barbican_bootstrap_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container"  | indent 8 }}
+      containers:
+        - name: barbican-bootstrap
+          image: {{ .Values.images.bootstrap }}
+          imagePullPolicy: {{ .Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.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: barbican-bin
+              mountPath: /tmp/bootstrap.sh
+              subPath: bootstrap.sh
+              readOnly: true
+{{- if $mounts_barbican_bootstrap.volumeMounts }}{{ toYaml $mounts_barbican_bootstrap.volumeMounts | indent 10 }}{{ end }}
+      volumes:
+        - name: barbican-bin
+          configMap:
+            name: barbican-bin
+            defaultMode: 0555
+{{- if $mounts_barbican_bootstrap.volumes }}{{ toYaml $mounts_barbican_bootstrap.volumes | indent 6 }}{{ end }}
+{{- end }}
diff --git a/barbican/values.yaml b/barbican/values.yaml
index 9cf6dedbd2..289a39b6b9 100644
--- a/barbican/values.yaml
+++ b/barbican/values.yaml
@@ -17,6 +17,7 @@ labels:
   node_selector_value: enabled
 
 images:
+  bootstrap: docker.io/kolla/ubuntu-source-barbican-api:3.0.3
   dep_check: docker.io/kolla/ubuntu-source-kubernetes-entrypoint:4.0.0
   db_init: docker.io/kolla/ubuntu-source-barbican-api:3.0.3
   db_sync: docker.io/kolla/ubuntu-source-barbican-api:3.0.3
@@ -106,6 +107,11 @@ network:
       enabled: false
       port: 39486
 
+bootstrap:
+  enabled: false
+  script: |
+    openstack token issue
+
 dependencies:
   db_init:
     services:
@@ -263,3 +269,6 @@ mounts:
   barbican_api:
     init_container: null
     barbican_api:
+  barbican_bootstrap:
+    init_container: null
+    barbican_bootstrap:
diff --git a/etcd/templates/deployment.yaml b/etcd/templates/deployment.yaml
index e6071a4a96..22c3d77def 100644
--- a/etcd/templates/deployment.yaml
+++ b/etcd/templates/deployment.yaml
@@ -19,7 +19,7 @@ kind: Deployment
 metadata:
   name: etcd
 spec:
-  replicas: {{ .Values.resources.etcd.replicas }}
+  replicas: {{ .Values.replicas.etcd }}
 {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
   template:
     metadata:
diff --git a/etcd/values.yaml b/etcd/values.yaml
index d89429aea1..001e5938d2 100644
--- a/etcd/values.yaml
+++ b/etcd/values.yaml
@@ -39,6 +39,5 @@ pod:
           max_surge: 3
           max_unavailable: 1
 
-resources:
-  etcd:
-    replicas: 1
+replicas:
+  etcd: 1
diff --git a/heat/templates/bin/_bootstrap.sh.tpl b/heat/templates/bin/_bootstrap.sh.tpl
new file mode 100644
index 0000000000..81a1391466
--- /dev/null
+++ b/heat/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/heat/templates/configmap-bin.yaml b/heat/templates/configmap-bin.yaml
index 3d8cc3e642..b657f2f19c 100644
--- a/heat/templates/configmap-bin.yaml
+++ b/heat/templates/configmap-bin.yaml
@@ -19,6 +19,10 @@ kind: ConfigMap
 metadata:
   name: heat-bin
 data:
+{{- if .Values.bootstrap.enabled }}
+  bootstrap.sh: |+
+{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+{{- end }}
   db-init.py: |
 {{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
   db-sync.sh: |
diff --git a/heat/templates/job-bootstrap.yaml b/heat/templates/job-bootstrap.yaml
new file mode 100644
index 0000000000..225e2c156d
--- /dev/null
+++ b/heat/templates/job-bootstrap.yaml
@@ -0,0 +1,56 @@
+# 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_heat_bootstrap := .Values.mounts.heat_bootstrap.heat_bootstrap }}
+{{- $mounts_heat_bootstrap_init := .Values.mounts.heat_bootstrap.init_container }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: heat-bootstrap
+spec:
+  template:
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies $mounts_heat_bootstrap_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container"  | indent 8 }}
+      containers:
+        - name: heat-bootstrap
+          image: {{ .Values.images.bootstrap }}
+          imagePullPolicy: {{ .Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.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: heat-bin
+              mountPath: /tmp/bootstrap.sh
+              subPath: bootstrap.sh
+              readOnly: true
+{{- if $mounts_heat_bootstrap.volumeMounts }}{{ toYaml $mounts_heat_bootstrap.volumeMounts | indent 10 }}{{ end }}
+      volumes:
+        - name: heat-bin
+          configMap:
+            name: heat-bin
+            defaultMode: 0555
+{{- if $mounts_heat_bootstrap.volumes }}{{ toYaml $mounts_heat_bootstrap.volumes | indent 6 }}{{ end }}
+{{- end }}
diff --git a/heat/values.yaml b/heat/values.yaml
index 2c36e75e8d..f10fc1c668 100644
--- a/heat/values.yaml
+++ b/heat/values.yaml
@@ -29,6 +29,7 @@ labels:
   node_selector_value: enabled
 
 images:
+  bootstrap: docker.io/kolla/ubuntu-source-heat-api:3.0.3
   db_init: docker.io/kolla/ubuntu-source-heat-api:3.0.3
   db_sync: docker.io/kolla/ubuntu-source-heat-api:3.0.3
   ks_user: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3
@@ -122,6 +123,11 @@ network:
       enabled: false
       port: 30003
 
+bootstrap:
+  enabled: false
+  script: |
+    openstack token issue
+
 dependencies:
   db_init:
     services:
@@ -442,3 +448,6 @@ mounts:
   heat_engine:
     init_container: null
     heat_engine:
+  heat_bootstrap:
+    init_container: null
+    heat_bootstrap:
diff --git a/magnum/templates/bin/_bootstrap.sh.tpl b/magnum/templates/bin/_bootstrap.sh.tpl
new file mode 100644
index 0000000000..81a1391466
--- /dev/null
+++ b/magnum/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/magnum/templates/configmap-bin.yaml b/magnum/templates/configmap-bin.yaml
index cbb2afbd43..b3473b5dfa 100644
--- a/magnum/templates/configmap-bin.yaml
+++ b/magnum/templates/configmap-bin.yaml
@@ -19,6 +19,10 @@ kind: ConfigMap
 metadata:
   name: magnum-bin
 data:
+{{- if .Values.bootstrap.enabled }}
+  bootstrap.sh: |+
+{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+{{- end }}
   db-init.py: |
 {{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
   db-sync.sh: |
diff --git a/magnum/templates/job-bootstrap.yaml b/magnum/templates/job-bootstrap.yaml
new file mode 100644
index 0000000000..697db3faca
--- /dev/null
+++ b/magnum/templates/job-bootstrap.yaml
@@ -0,0 +1,56 @@
+# 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_magnum_bootstrap := .Values.mounts.magnum_bootstrap.magnum_bootstrap }}
+{{- $mounts_magnum_bootstrap_init := .Values.mounts.magnum_bootstrap.init_container }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: magnum-bootstrap
+spec:
+  template:
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies $mounts_magnum_bootstrap_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container"  | indent 8 }}
+      containers:
+        - name: magnum-bootstrap
+          image: {{ .Values.images.bootstrap }}
+          imagePullPolicy: {{ .Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.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: magnum-bin
+              mountPath: /tmp/bootstrap.sh
+              subPath: bootstrap.sh
+              readOnly: true
+{{- if $mounts_magnum_bootstrap.volumeMounts }}{{ toYaml $mounts_magnum_bootstrap.volumeMounts | indent 10 }}{{ end }}
+      volumes:
+        - name: magnum-bin
+          configMap:
+            name: magnum-bin
+            defaultMode: 0555
+{{- if $mounts_magnum_bootstrap.volumes }}{{ toYaml $mounts_magnum_bootstrap.volumes | indent 6 }}{{ end }}
+{{- end }}
diff --git a/magnum/values.yaml b/magnum/values.yaml
index e5f803c078..54d283732e 100644
--- a/magnum/values.yaml
+++ b/magnum/values.yaml
@@ -26,6 +26,7 @@ labels:
   node_selector_value: enabled
 
 images:
+  bootstrap: docker.io/kolla/ubuntu-source-magnum-api:3.0.3
   db_init: docker.io/kolla/ubuntu-source-magnum-api:3.0.3
   db_sync: docker.io/kolla/ubuntu-source-magnum-api:3.0.3
   ks_user: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3
@@ -64,6 +65,11 @@ network:
       enabled: false
       port: 30511
 
+bootstrap:
+  enabled: false
+  script: |
+    openstack token issue
+
 dependencies:
   db_init:
     services:
@@ -292,3 +298,6 @@ mounts:
   magnum_conductor:
     init_container: null
     magnum_conductor:
+  magnum_bootstrap:
+    init_container: null
+    magnum_bootstrap:
diff --git a/mistral/templates/bin/_bootstrap.sh.tpl b/mistral/templates/bin/_bootstrap.sh.tpl
new file mode 100644
index 0000000000..81a1391466
--- /dev/null
+++ b/mistral/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/mistral/templates/configmap-bin.yaml b/mistral/templates/configmap-bin.yaml
index 498c08b323..9d93427197 100644
--- a/mistral/templates/configmap-bin.yaml
+++ b/mistral/templates/configmap-bin.yaml
@@ -19,6 +19,10 @@ kind: ConfigMap
 metadata:
   name: mistral-bin
 data:
+{{- if .Values.bootstrap.enabled }}
+  bootstrap.sh: |+
+{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+{{- end }}
   db-init.py: |+
 {{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
   db-sync.sh: |+
diff --git a/mistral/templates/job-bootstrap.yaml b/mistral/templates/job-bootstrap.yaml
new file mode 100644
index 0000000000..c6e03f947a
--- /dev/null
+++ b/mistral/templates/job-bootstrap.yaml
@@ -0,0 +1,56 @@
+# 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_mistral_bootstrap := .Values.mounts.mistral_bootstrap.mistral_bootstrap }}
+{{- $mounts_mistral_bootstrap_init := .Values.mounts.mistral_bootstrap.init_container }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: mistral-bootstrap
+spec:
+  template:
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies $mounts_mistral_bootstrap_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container"  | indent 8 }}
+      containers:
+        - name: mistral-bootstrap
+          image: {{ .Values.images.bootstrap }}
+          imagePullPolicy: {{ .Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.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: mistral-bin
+              mountPath: /tmp/bootstrap.sh
+              subPath: bootstrap.sh
+              readOnly: true
+{{- if $mounts_mistral_bootstrap.volumeMounts }}{{ toYaml $mounts_mistral_bootstrap.volumeMounts | indent 10 }}{{ end }}
+      volumes:
+        - name: mistral-bin
+          configMap:
+            name: mistral-bin
+            defaultMode: 0555
+{{- if $mounts_mistral_bootstrap.volumes }}{{ toYaml $mounts_mistral_bootstrap.volumes | indent 6 }}{{ end }}
+{{- end }}
diff --git a/mistral/values.yaml b/mistral/values.yaml
index 004a9a263d..0f67eac138 100644
--- a/mistral/values.yaml
+++ b/mistral/values.yaml
@@ -28,6 +28,7 @@ labels:
   node_selector_value: enabled
 
 images:
+  bootstrap: docker.io/kolla/ubuntu-source-mistral-api:3.0.3
   dep_check: docker.io/kolla/ubuntu-source-kubernetes-entrypoint:4.0.0
   db_init: docker.io/kolla/ubuntu-source-mistral-api:3.0.3
   db_sync: docker.io/kolla/ubuntu-source-mistral-api:3.0.3
@@ -48,6 +49,11 @@ network:
       enabled: false
       port: 28989
 
+bootstrap:
+  enabled: false
+  script: |
+    openstack token issue
+
 dependencies:
   db_init:
     services:
@@ -220,6 +226,9 @@ mounts:
   mistral_event_engine:
     init_container: null
     mistral_event_engine:
+  mistral_bootstrap:
+    init_container: null
+    mistral_bootstrap:
 
 conf:
   policy:
diff --git a/senlin/templates/bin/_bootstrap.sh.tpl b/senlin/templates/bin/_bootstrap.sh.tpl
new file mode 100644
index 0000000000..81a1391466
--- /dev/null
+++ b/senlin/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/senlin/templates/configmap-bin.yaml b/senlin/templates/configmap-bin.yaml
index bff03c7666..195827a83b 100644
--- a/senlin/templates/configmap-bin.yaml
+++ b/senlin/templates/configmap-bin.yaml
@@ -19,6 +19,10 @@ kind: ConfigMap
 metadata:
   name: senlin-bin
 data:
+{{- if .Values.bootstrap.enabled }}
+  bootstrap.sh: |+
+{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
+{{- end }}
   db-init.py: |
 {{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
   db-sync.sh: |
diff --git a/senlin/templates/job-bootstrap.yaml b/senlin/templates/job-bootstrap.yaml
new file mode 100644
index 0000000000..39aad55d72
--- /dev/null
+++ b/senlin/templates/job-bootstrap.yaml
@@ -0,0 +1,56 @@
+# 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_senlin_bootstrap := .Values.mounts.senlin_bootstrap.senlin_bootstrap }}
+{{- $mounts_senlin_bootstrap_init := .Values.mounts.senlin_bootstrap.init_container }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: senlin-bootstrap
+spec:
+  template:
+    spec:
+      restartPolicy: OnFailure
+      nodeSelector:
+        {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
+      initContainers:
+{{ tuple $envAll $dependencies $mounts_senlin_bootstrap_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container"  | indent 8 }}
+      containers:
+        - name: senlin-bootstrap
+          image: {{ .Values.images.bootstrap }}
+          imagePullPolicy: {{ .Values.images.pull_policy }}
+{{ tuple $envAll $envAll.Values.pod.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: senlin-bin
+              mountPath: /tmp/bootstrap.sh
+              subPath: bootstrap.sh
+              readOnly: true
+{{- if $mounts_senlin_bootstrap.volumeMounts }}{{ toYaml $mounts_senlin_bootstrap.volumeMounts | indent 10 }}{{ end }}
+      volumes:
+        - name: senlin-bin
+          configMap:
+            name: senlin-bin
+            defaultMode: 0555
+{{- if $mounts_senlin_bootstrap.volumes }}{{ toYaml $mounts_senlin_bootstrap.volumes | indent 6 }}{{ end }}
+{{- end }}
diff --git a/senlin/values.yaml b/senlin/values.yaml
index 1e6ddc6699..3796dec3a6 100644
--- a/senlin/values.yaml
+++ b/senlin/values.yaml
@@ -26,6 +26,7 @@ labels:
   node_selector_value: enabled
 
 images:
+  bootstrap: docker.io/kolla/ubuntu-source-senlin-api:3.0.3
   db_init: docker.io/kolla/ubuntu-source-senlin-api:3.0.3
   db_sync: docker.io/kolla/ubuntu-source-senlin-api:3.0.3
   ks_user: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3
@@ -64,6 +65,11 @@ network:
       enabled: false
       port: 30778
 
+bootstrap:
+  enabled: false
+  script: |
+    openstack token issue
+
 dependencies:
   db_init:
     services:
@@ -292,3 +298,6 @@ mounts:
   senlin_engine:
     init_container: null
     senlin_engine:
+  senlin_bootstrap:
+    init_container: null
+    senlin_bootstrap: