Adding extra condition for simple cell0 create job

Adding extra condition for simple cell0 create job, nova api will be checked
to confirm there is at least one compute in UP state.

Change-Id: Ic788397b114828ac5c36b7d6c0e4d6cc9ac71a56
This commit is contained in:
Serguei Bezverkhi 2017-06-01 13:59:02 -04:00
parent 9f5704b6da
commit 29e0998e73
5 changed files with 93 additions and 3 deletions

View File

@ -466,6 +466,16 @@ nova-api-delete-db-job:
database_name: "nova_api"
database_user: "nova_api"
nova-api-create-simple-cell-job:
global:
kolla:
nova:
api:
create_cell:
all:
cell_wait_compute: true
cell_wait_compute_sleep: 5
nova-cell0-create-db-job:
global:
kolla:

View File

@ -11,6 +11,19 @@
{{- $containerConfigDirectory := include "kolla_val_get_str" (dict "key" "container_config_directory" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorKey := include "kolla_val_get_str" (dict "key" "selector_key" "searchPath" $searchPath "Values" .Values ) }}
{{- $selectorValue := include "kolla_val_get_str" (dict "key" "selector_value" "searchPath" $searchPath "Values" .Values ) }}
{{- $keystoneSearchPath := ":global.kolla.keystone.all:global.kolla.all" }}
{{- $keystonePort := include "kolla_val_get_str" (dict "key" "port" "searchPath" $keystoneSearchPath "Values" .Values ) }}
{{- $elementName := include "kolla_val_get_str" (dict "key" "element_name" "searchPath" $keystoneSearchPath "Values" .Values ) | default "keystone" }}
{{- $keystoneURL := printf "%s-internal" $elementName }}
{{- $localVals := dict }}
{{- $c1 := dict "key" "cell_wait_compute" "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c1 "retDict" $localVals }}
{{- $_ := set $c1 "retKey" "cell_wait_compute" }}
{{- $_ := include "kolla_val_get_raw" $c1 }}
{{- $c2 := dict "key" "cell_wait_compute_sleep" "searchPath" $searchPath "Values" .Values }}
{{- $_ := set $c2 "retDict" $localVals }}
{{- $_ := set $c2 "retKey" "cell_wait_compute_sleep" }}
{{- $_ := include "kolla_val_get_raw" $c2 }}
{{- with $env := dict "resourceName" $resourceName "serviceName" $serviceName "podTypeBootstrap" $podTypeBootstrap "imageFull" $imageFull "Values" .Values "Release" .Release "searchPath" $searchPath }}
apiVersion: batch/v1
kind: Job
@ -21,6 +34,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{- include "common_dependency_container_multi" $env | indent 10 }}
{
"name": "initialize-cell-api-logs",
"image": "{{ $imageFull }}",
@ -37,7 +51,74 @@ spec:
"mountPath": "/var/log/kolla"
}
]
}{{- if $localVals.cell_wait_compute }},
{
"name": "wait-for-nova-compute-up",
"image": {{ include "kolla_toolbox_image_full" . | quote }},
"imagePullPolicy": "{{ $imagePullPolicy }}",
"env": [
{
"name": "OS_PASSWORD",
"valueFrom":
{
"secretKeyRef":
{
"name": "keystone-admin-password",
"key": "password"
}
}
},
{
"name": "OS_AUTH_URL",
"value": "http://{{ $keystoneURL }}:{{ $keystonePort }}/v3"
},
{
"name": "OS_PROJECT_NAME",
"value": "admin"
},
{
"name": "OS_USER_DOMAIN_NAME",
"value": "Default"
},
{
"name": "OS_USERNAME",
"value": "admin"
},
{
"name": "OS_PROJECT_DOMAIN_NAME",
"value": "Default"
},
{
"name": "OS_IDENTITY_API_VERSION",
"value": "3"
},
{
"name": "OS_REGION_NAME",
"value": "RegionOne"
}
],
"command": [
"sh",
"-ce",
"touch /tmp/not_found;
while [[ -f /tmp/not_found ]]; do
openstack hypervisor list -f value -c State | while read compute_state; do
if [ ''x''$compute_state == ''xup'' ]; then
echo ''Detected at least one compute node in UP state. Exiting...'';
rm -f /tmp/not_found;
fi;
done;
sleep {{ $localVals.cell_wait_compute_sleep }};
done;
"],
"volumeMounts": [
{
"name": "kolla-logs",
"mountPath": "/var/log/kolla"
}
]
}
{{- end }}
]'
spec:
nodeSelector:

View File

@ -12,8 +12,6 @@ global:
service:
- nova-metadata
- nova-api
socket:
- /var/run/libvirt/libvirt-sock
compute:
daemonset:
dependencies:

View File

@ -12,6 +12,7 @@ function common_workflow_config {
echo " all:"
echo " admin_port_external: true"
echo " dns_name: $IP"
echo " port: 5000"
echo " public:"
echo " all:"
echo " port_external: true"

View File

@ -531,7 +531,7 @@ $DIR/tools/build_local_admin_keystonerc.sh
wait_for_openstack
if [ "x$branch" != "x2" -a "x$branch" != "x3" ]; then
helm install kolla/nova-cell0-create-db-job --debug --version $VERSION \
helm install kolla/nova-cell0-create-db-job --version $VERSION \
--namespace kolla --name nova-cell0-create-db-job \
--values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml