From 0996b57604b3dc99127092a0688ef9eadedc0582 Mon Sep 17 00:00:00 2001 From: Serguei Bezverkhi Date: Fri, 14 Apr 2017 16:05:47 -0400 Subject: [PATCH] Forcing ironic-compute registration with nova cell This PS addresses one racing condition when ironic gets requested to deploy a bare metal node, but ironic-compute process has not yet been registered with nova cell resulting deployment failure. Change-Id: I160b7e1f9f6b1de0beb3a0eabb4d5ee668ab4788 --- .../Chart.yaml | 14 ++++ .../requirements.yaml | 4 + .../nova-api-cell-discover-host.yaml | 73 +++++++++++++++++++ tests/bin/deploy_ironic.sh | 5 ++ 4 files changed, 96 insertions(+) create mode 100644 helm/microservice/nova-api-cell-discover-host-job/Chart.yaml create mode 100644 helm/microservice/nova-api-cell-discover-host-job/requirements.yaml create mode 100644 helm/microservice/nova-api-cell-discover-host-job/templates/nova-api-cell-discover-host.yaml diff --git a/helm/microservice/nova-api-cell-discover-host-job/Chart.yaml b/helm/microservice/nova-api-cell-discover-host-job/Chart.yaml new file mode 100644 index 000000000..433e21f28 --- /dev/null +++ b/helm/microservice/nova-api-cell-discover-host-job/Chart.yaml @@ -0,0 +1,14 @@ +name: nova-api-cell-discover-host-job +version: 0.6.0-1 +description: nova api job to discover new hosts and map to exisiting cell +keywords: + - openstack + - nova + - api + - cell + - host + - discover +sources: + - http://github.com/openstack +engine: gotpl +#icon: A URL to an SVG or PNG image to be used as an icon (optional). make this point to the new project icons when ready diff --git a/helm/microservice/nova-api-cell-discover-host-job/requirements.yaml b/helm/microservice/nova-api-cell-discover-host-job/requirements.yaml new file mode 100644 index 000000000..979b4758e --- /dev/null +++ b/helm/microservice/nova-api-cell-discover-host-job/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: kolla-common + repository: file://../../kolla-common + version: 0.6.0-1 diff --git a/helm/microservice/nova-api-cell-discover-host-job/templates/nova-api-cell-discover-host.yaml b/helm/microservice/nova-api-cell-discover-host-job/templates/nova-api-cell-discover-host.yaml new file mode 100644 index 000000000..8494d30e3 --- /dev/null +++ b/helm/microservice/nova-api-cell-discover-host-job/templates/nova-api-cell-discover-host.yaml @@ -0,0 +1,73 @@ +{{- $searchPath := ":global.kolla.nova.api.cell_discover_host.job:global.kolla.nova.api.cell_discover_host.all:global.kolla.nova.api.all:global.kolla.nova.all:global.kolla.all" }} +{{- $c := dict "searchPath" $searchPath "Values" .Values }} +{{- $_ := set $c "contName" "nova-api" }} +{{- $_ := set $c "imageName" "image_full" }} +{{- $_ := set $c "tagName" "image_tag" }} +{{- $imageFull := include "kolla_build_image_full" $c }} +{{- $resourceName := "nova-api" }} +{{- $serviceName := "nova-api" }} +{{- $podTypeBootstrap := true }} +{{- $imagePullPolicy := include "kolla_val_get_str" (dict "key" "image_pull_policy" "searchPath" $searchPath "Values" .Values ) }} +{{- $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 ) }} +{{- with $env := dict "resourceName" $resourceName "serviceName" $serviceName "podTypeBootstrap" $podTypeBootstrap "imageFull" $imageFull "Values" .Values "Release" .Release "searchPath" $searchPath }} +apiVersion: batch/v1 +kind: Job +metadata: + name: "nova-api-cell-discover-host" +spec: + template: + metadata: + annotations: + pod.beta.kubernetes.io/init-containers: '[ + { + "name": "initialize-cell-api-logs", + "image": "{{ $imageFull }}", + "imagePullPolicy": "{{ $imagePullPolicy }}", + "command": [ + "sh", + "-ce", + "mkdir /var/log/kolla/nova; + chown -R nova: /var/log/kolla/nova; + chmod 755 /var/log/kolla/nova; "], + "volumeMounts": [ + { + "name": "kolla-logs", + "mountPath": "/var/log/kolla" + } + ] + } + ]' + spec: + nodeSelector: + {{ $selectorKey }}: {{ $selectorValue | quote }} + restartPolicy: OnFailure + containers: + - image: {{ $imageFull | quote }} + imagePullPolicy: {{ $imagePullPolicy | quote }} + name: "main" + volumeMounts: +{{ include "common_volume_mounts" . | indent 12 }} + - mountPath: {{ $containerConfigDirectory }} + name: service-configmap + readOnly: true + env: + - name: KOLLA_KUBERNETES + value: "" + - name: KOLLA_BOOTSTRAP + value: "" + - name: KOLLA_CONFIG_STRATEGY + value: "COPY_ONCE" + command: [ + "bash", + "-ce", + "/bin/cp -aLf {{ $containerConfigDirectory }}/..data/nova.conf /etc/nova/nova.conf; + nova-manage cell_v2 discover_hosts; + "] + volumes: +{{- include "common_volumes" . | indent 8 }} + - name: service-configmap + configMap: + name: {{ .serviceName }} +{{- end }} diff --git a/tests/bin/deploy_ironic.sh b/tests/bin/deploy_ironic.sh index f7f818d70..5be8df52c 100755 --- a/tests/bin/deploy_ironic.sh +++ b/tests/bin/deploy_ironic.sh @@ -144,4 +144,9 @@ helm install kolla/ironic-dnsmasq-daemonset --version $VERSION \ $DIR/tools/wait_for_pods.sh kolla +helm install kolla/nova-api-cell-discover-host-job --debug --version $VERSION \ + --namespace kolla --name nova-api-cell-discover-host-job \ + --values /tmp/general_config.yaml --values /tmp/iscsi_config.yaml + +$DIR/tools/wait_for_pods.sh kolla }