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
This commit is contained in:
Serguei Bezverkhi 2017-04-14 16:05:47 -04:00
parent 9604930b7e
commit 0996b57604
4 changed files with 96 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,4 @@
dependencies:
- name: kolla-common
repository: file://../../kolla-common
version: 0.6.0-1

View File

@ -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 }}

View File

@ -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
}