summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Hussey <sh8121@att.com>2018-11-19 12:45:35 -0600
committerScott Hussey <sh8121@att.com>2018-11-19 14:50:19 -0600
commitb4d6562bbabdc87a7a29af9841fcf77c8ce6ab90 (patch)
tree52e914c25d49b00d35c99728c19ae092c763fc3e
parent2d71c24e0fceb7868de10dc750954a494713a04c (diff)
(fix) Fix import job race condition
- If the import job triggers before the rack controller pod(s) have registered w/ the region controller, then it must fully timeout and then reschedule to pass. Update it so that each time it checks for rack controller image sync, it updates the list of all registered rack controllers. - Update register service to be part of Dockerfile so it can be enabled. Change-Id: I72e190d472ad259da65b2e583b2a16d8adf660f5
Notes
Notes (review): Code-Review+2: Mark Burnett <mark.m.burnett@gmail.com> Code-Review+2: Bryan Strassner <bryan.strassner@gmail.com> Workflow+1: Bryan Strassner <bryan.strassner@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 20 Nov 2018 17:49:18 +0000 Reviewed-on: https://review.openstack.org/618803 Project: openstack/airship-maas Branch: refs/heads/master
-rw-r--r--charts/maas/templates/bin/_import-boot-resources.sh.tpl2
-rw-r--r--charts/maas/templates/configmap-etc.yaml2
-rw-r--r--charts/maas/templates/etc/_register-rack-controller.service.tpl12
-rw-r--r--images/maas-rack-controller/Dockerfile4
-rw-r--r--images/maas-rack-controller/scripts/register-rack-controller.sh22
5 files changed, 5 insertions, 37 deletions
diff --git a/charts/maas/templates/bin/_import-boot-resources.sh.tpl b/charts/maas/templates/bin/_import-boot-resources.sh.tpl
index cb0d704..15db50e 100644
--- a/charts/maas/templates/bin/_import-boot-resources.sh.tpl
+++ b/charts/maas/templates/bin/_import-boot-resources.sh.tpl
@@ -90,11 +90,11 @@ function check_then_set {
90} 90}
91 91
92function check_for_rack_sync { 92function check_for_rack_sync {
93 rack_list=$(maas ${ADMIN_USERNAME} rack-controllers read | tail -n +1 | jq -r '.[] | .system_id')
94 sync_list="" 93 sync_list=""
95 94
96 while [[ ${JOB_TIMEOUT} -gt 0 ]] 95 while [[ ${JOB_TIMEOUT} -gt 0 ]]
97 do 96 do
97 rack_list=$(maas ${ADMIN_USERNAME} rack-controllers read | tail -n +1 | jq -r '.[] | .system_id')
98 for rack_id in ${rack_list} 98 for rack_id in ${rack_list}
99 do 99 do
100 selected_imgs=$(maas ${ADMIN_USERNAME} rack-controller list-boot-images ${rack_id} | tail -n +1 | jq ".images[] | select( .name | contains(\"${MAAS_DEFAULT_DISTRO}\")) | .name") 100 selected_imgs=$(maas ${ADMIN_USERNAME} rack-controller list-boot-images ${rack_id} | tail -n +1 | jq ".images[] | select( .name | contains(\"${MAAS_DEFAULT_DISTRO}\")) | .name")
diff --git a/charts/maas/templates/configmap-etc.yaml b/charts/maas/templates/configmap-etc.yaml
index 0c98c22..4a07137 100644
--- a/charts/maas/templates/configmap-etc.yaml
+++ b/charts/maas/templates/configmap-etc.yaml
@@ -40,8 +40,6 @@ data:
40{{ tuple "etc/_regiond.conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} 40{{ tuple "etc/_regiond.conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
41 nsswitch.conf: | 41 nsswitch.conf: |
42{{ tuple "etc/_nsswitch.conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} 42{{ tuple "etc/_nsswitch.conf.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
43 register-rack-controller.service: |
44{{ tuple "etc/_register-rack-controller.service.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
45{{- if .Values.conf.drivers }} 43{{- if .Values.conf.drivers }}
46 drivers.yaml: | 44 drivers.yaml: |
47{{ tuple "etc/_drivers.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} 45{{ tuple "etc/_drivers.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
diff --git a/charts/maas/templates/etc/_register-rack-controller.service.tpl b/charts/maas/templates/etc/_register-rack-controller.service.tpl
deleted file mode 100644
index 0bf64b4..0000000
--- a/charts/maas/templates/etc/_register-rack-controller.service.tpl
+++ /dev/null
@@ -1,12 +0,0 @@
1[Unit]
2Description=Register with MaaS Region Controller
3Wants=network-online.target
4After=network-online.target
5
6[Service]
7Type=oneshot
8PassEnvironment=MAAS_ENDPOINT MAAS_REGION_SECRET
9ExecStart=/usr/local/bin/register-rack-controller.sh
10
11[Install]
12WantedBy=multi-user.target
diff --git a/images/maas-rack-controller/Dockerfile b/images/maas-rack-controller/Dockerfile
index 316c4bc..23e73da 100644
--- a/images/maas-rack-controller/Dockerfile
+++ b/images/maas-rack-controller/Dockerfile
@@ -43,6 +43,10 @@ RUN rsyslogd; apt-get install -y maas-cli=$MAAS_VERSION maas-rack-controller=$MA
43RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump 43RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
44RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump 44RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump
45 45
46# register ourselves with the region controller
47COPY scripts/register-rack-controller.service /lib/systemd/system/register-rack-controller.service
48RUN systemctl enable register-rack-controller.service
49
46# Patch so that Calico interfaces are ignored 50# Patch so that Calico interfaces are ignored
47# dc6350: this appears to be fixed in maas master as of 10/4/2018, but that change is not in 2.3.5 51# dc6350: this appears to be fixed in maas master as of 10/4/2018, but that change is not in 2.3.5
48COPY 2.3_nic_filter.patch /tmp/2.3_nic_filter.patch 52COPY 2.3_nic_filter.patch /tmp/2.3_nic_filter.patch
diff --git a/images/maas-rack-controller/scripts/register-rack-controller.sh b/images/maas-rack-controller/scripts/register-rack-controller.sh
deleted file mode 100644
index add7edf..0000000
--- a/images/maas-rack-controller/scripts/register-rack-controller.sh
+++ /dev/null
@@ -1,22 +0,0 @@
1#!/bin/bash
2
3# show env
4env > /tmp/env
5
6echo "register-rack-controller URL: ${MAAS_ENDPOINT}"
7
8# note the secret must be a valid hex value
9
10# register forever
11while [ 1 ];
12do
13 if maas-rack register --url=http://${MAAS_ENDPOINT}/MAAS --secret="${MAAS_REGION_SECRET}";
14 then
15 echo "Successfully registered with MaaS Region Controller"
16 break
17 else
18 echo "Unable to register with http://${MAAS_ENDPOINT}/MAAS... will try again"
19 sleep 10
20 fi;
21
22done;