Nova: Add initial cell v2 setup job

This PS adds a job to run post initial deployment to ensure at least
one node is added to the cell upon deploy.

Change-Id: I300ba9760bdcfcb01f17d731b0cbbc6d5d0bce61
This commit is contained in:
Pete Birley 2018-05-07 10:59:04 -05:00
parent ab07c9ccab
commit f4a0b57c9f
5 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,24 @@
#!/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
until openstack compute service list --service nova-compute -f value -c State | grep -q "^up$" ;do
echo "Waiting for Nova Compute processes to register"
sleep 10
done

View File

@ -79,6 +79,8 @@ data:
{{ tuple "bin/_ssh-start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
cell-setup.sh: |
{{ tuple "bin/_cell-setup.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
cell-setup-init.sh: |
{{ tuple "bin/_cell-setup-init.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
rabbit-init.sh: |
{{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }}
{{- end }}

View File

@ -18,7 +18,7 @@ limitations under the License.
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.static.cell_setup }}
{{- $serviceAccountName := "nova-cell-setup" }}
{{- $serviceAccountName := "nova-cell-setup-cron" }}
{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: batch/v1beta1

View File

@ -0,0 +1,88 @@
{{/*
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.manifests.job_cell_setup }}
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.static.cell_setup }}
{{- $serviceAccountName := "nova-cell-setup" }}
{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: nova-cell-setup
spec:
template:
metadata:
labels:
{{ tuple $envAll "nova" "cell-setup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
initContainers:
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: nova-cell-setup-init
image: {{ .Values.images.tags.nova_cell_setup_init }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.cell_setup | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
env:
{{- with $env := dict "ksUserSecret" $envAll.Values.secrets.identity.admin }}
{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
{{- end }}
command:
- /tmp/cell-setup-init.sh
volumeMounts:
- name: nova-bin
mountPath: /tmp/cell-setup-init.sh
subPath: cell-setup-init.sh
readOnly: true
containers:
- name: nova-cell-setup
image: {{ .Values.images.tags.nova_cell_setup }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.cell_setup | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command:
- /tmp/cell-setup.sh
volumeMounts:
- name: nova-bin
mountPath: /tmp/cell-setup.sh
subPath: cell-setup.sh
readOnly: true
- name: etcnova
mountPath: /etc/nova
- name: nova-etc
mountPath: /etc/nova/nova.conf
subPath: nova.conf
readOnly: true
- name: nova-etc
mountPath: /etc/nova/policy.yaml
subPath: policy.yaml
readOnly: true
volumes:
- name: etcnova
emptyDir: {}
- name: nova-etc
configMap:
name: nova-etc
defaultMode: 0444
- name: nova-bin
configMap:
name: nova-bin
defaultMode: 0555
{{- end }}

View File

@ -71,6 +71,7 @@ images:
ks_endpoints: docker.io/openstackhelm/heat:newton
nova_api: docker.io/openstackhelm/nova:newton
nova_cell_setup: docker.io/openstackhelm/nova:newton
nova_cell_setup_init: docker.io/openstackhelm/heat:newton
nova_compute: docker.io/openstackhelm/nova:newton
nova_compute_ironic: 'docker.io/kolla/ubuntu-source-nova-compute-ironic:3.0.3'
nova_compute_ssh: docker.io/openstackhelm/nova:newton
@ -1654,6 +1655,7 @@ manifests:
job_ks_placement_endpoints: true
job_ks_placement_service: true
job_ks_placement_user: true
job_cell_setup: true
pdb_metadata: true
pdb_placement: true
pdb_osapi: true