From 12ece85bd6c8a30917696bb7fca91279120fba31 Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Tue, 25 Apr 2017 12:43:33 +0100 Subject: [PATCH] Fix ironic-conductor so that it can run on multiple hosts Currently you can only provide one IP address for the Ironic conductor and conductor TFTP service to use. This doesn't work if you scale out your conductors because every conductor needs a different address. This patch allows the operator to provide a CIDR in cloud.yaml and the ironic-conductor service will pick the IP address the host has in that network. Change-Id: I1321c0a7b0dfeadfb12e993d6ea38c0176328ff7 --- helm/all_values.yaml | 2 +- .../templates/ironic-conductor.yaml | 10 ++++++---- tests/bin/ceph_workflow_service.sh | 6 ++++-- tests/bin/common_iscsi_config_v4.sh | 2 +- tests/bin/common_workflow_config.sh | 2 +- tests/bin/deploy_iscsi_common.sh | 6 ++++-- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/helm/all_values.yaml b/helm/all_values.yaml index b91b877dd..87f1f0072 100755 --- a/helm/all_values.yaml +++ b/helm/all_values.yaml @@ -1144,7 +1144,7 @@ ironic-conductor-daemonset: ironic: all: ironic_api_ip: 172.21.0.10 - ironic_tftp_server: 172.21.0.10 + ironic_provision_cidr: 172.21.0.0/24 conductor: all: initramfs_url: diff --git a/helm/microservice/ironic-conductor-daemonset/templates/ironic-conductor.yaml b/helm/microservice/ironic-conductor-daemonset/templates/ironic-conductor.yaml index 25d4f19bd..48ac91bce 100644 --- a/helm/microservice/ironic-conductor-daemonset/templates/ironic-conductor.yaml +++ b/helm/microservice/ironic-conductor-daemonset/templates/ironic-conductor.yaml @@ -21,7 +21,7 @@ {{- $selectorValue := include "kolla_val_get_str" (dict "key" "selector_value" "searchPath" $searchPath "Values" .Values ) }} {{- $elementName := .Values.element_name | default $resourceName }} {{- $ironicAPI := include "kolla_val_get_str" (dict "key" "ironic_api_ip" "searchPath" $searchPath "Values" .Values )}} -{{- $ironicTFTP := include "kolla_val_get_str" (dict "key" "ironic_tftp_server" "searchPath" $searchPath "Values" .Values )}} +{{- $ironicProvisionCIDR := include "kolla_val_get_str" (dict "key" "ironic_provision_cidr" "searchPath" $searchPath "Values" .Values )}} {{- $url1 := include "kolla_val_get_str" (dict "key" "initramfs_url" "searchPath" $searchPath "Values" .Values )}} {{- $url2 := include "kolla_val_get_str" (dict "key" "kernel_url" "searchPath" $searchPath "Values" .Values )}} {{- with $env := dict "netHostTrue" $netHostTrue "podTypeBootstrap" $podTypeBootstrap "imageFull" $imageFull "resourceName" $resourceName "serviceName" $serviceName "serviceType" $serviceType "privileged" $privileged "Values" .Values "Release" .Release "searchPath" $searchPath }} @@ -48,13 +48,15 @@ spec: "command": [ "sh", "-xec", - "cp -a /config/ironic/..data/* /ironic/; + "IP=$(ip addr show to {{ $ironicProvisionCIDR }} | grep -m1 -G ''inet'' | awk ''{print $2}'' | cut -d ''/'' -f 1); + if test -z $IP; then exit 1; fi; + cp -a /config/ironic/..data/* /ironic/; cp -a /config/pxe/..data/* /pxe/; curl -L {{ $url1 }} -o /tftpboot/ironic-agent.initramfs; curl -L {{ $url2 }} -o /tftpboot/ironic-agent.kernel; - jq ''.command = \"in.tftpd -v -L -u root -a {{ $ironicTFTP }}:69 --map-file /map-file /tftpboot\"'' /config/pxe/..data/config.json > /pxe/config.json; + jq ''.command = \"in.tftpd -v -L -u root -a ''$IP'':69 --map-file /map-file /tftpboot\"'' /config/pxe/..data/config.json > /pxe/config.json; crudini --set /ironic/ironic.conf conductor api_url http://{{ $ironicAPI }}:6385; - crudini --set /ironic/ironic.conf pxe tftp_server {{ $ironicTFTP }} ; + crudini --set /ironic/ironic.conf pxe tftp_server $IP; "], "volumeMounts": [ { diff --git a/tests/bin/ceph_workflow_service.sh b/tests/bin/ceph_workflow_service.sh index 5ce020420..b567ace33 100755 --- a/tests/bin/ceph_workflow_service.sh +++ b/tests/bin/ceph_workflow_service.sh @@ -8,6 +8,9 @@ branch="$3" IP=${4:-172.18.0.1} tunnel_interface=${5:-docker0} +# IP address to configure on the Ironic conductor network interface +IRONIC_CONDUCTOR_IP=${6:-172.21.0.10} + # Break out devenv behavior since we will use different polling logic # and we also assume ceph-multi use in the devenv devenv=false @@ -128,8 +131,7 @@ sudo docker ps | grep openvswitch sudo docker exec -tu root $(sudo docker ps | grep openvswitch-vswitchd@ \ | awk '{print $1}') ovs-vsctl add-br br-tenants sudo ifconfig br-tenants up -sudo ifconfig br-tenants $(grep ironic_tftp_server $DIR/helm/all_values.yaml \ - | awk '{print $2}')/24 +sudo ifconfig br-tenants ${IRONIC_CONDUCTOR_IP}/24 helm install kolla/ironic --version $VERSION --namespace kolla \ --name ironic \ diff --git a/tests/bin/common_iscsi_config_v4.sh b/tests/bin/common_iscsi_config_v4.sh index 3a0e18a7f..20b2d270f 100755 --- a/tests/bin/common_iscsi_config_v4.sh +++ b/tests/bin/common_iscsi_config_v4.sh @@ -26,7 +26,7 @@ function common_iscsi_config { echo " initramfs_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.gz" echo " kernel_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.vmlinuz" echo " ironic_api_ip: 172.21.0.10" - echo " ironic_tftp_server: 172.21.0.10" + echo " ironic_provision_cidr: 172.21.0.0/24" echo " dnsmasq:" echo " all:" echo " initramfs_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.gz" diff --git a/tests/bin/common_workflow_config.sh b/tests/bin/common_workflow_config.sh index f475d8c7a..828ff8612 100755 --- a/tests/bin/common_workflow_config.sh +++ b/tests/bin/common_workflow_config.sh @@ -34,7 +34,7 @@ function common_workflow_config { echo " initramfs_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.gz" echo " kernel_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.vmlinuz" echo " ironic_api_ip: 172.21.0.10" - echo " ironic_tftp_server: 172.21.0.10" + echo " ironic_provision_cidr: 172.21.0.0/24" echo " dnsmasq:" echo " all:" echo " initramfs_url: http://tarballs.openstack.org/ironic-python-agent/tinyipa/files/tinyipa-stable-newton.gz" diff --git a/tests/bin/deploy_iscsi_common.sh b/tests/bin/deploy_iscsi_common.sh index 529798697..1e8f823dc 100755 --- a/tests/bin/deploy_iscsi_common.sh +++ b/tests/bin/deploy_iscsi_common.sh @@ -55,6 +55,9 @@ base_distro="$2" branch="$4" config="$5" +# IP address to configure on the Ironic conductor network interface +IRONIC_CONDUCTOR_IP=${6:-172.21.0.10} + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )" . "$DIR/tests/bin/common_workflow_config.sh" @@ -244,8 +247,7 @@ if [ "x$config" == "xironic" ]; then sudo docker exec -tu root $(sudo docker ps | grep openvswitch-vswitchd@ \ | awk '{print $1}') ovs-vsctl add-br br-tenants sudo ifconfig br-tenants up - sudo ifconfig br-tenants $(grep ironic_tftp_server $DIR/helm/all_values.yaml \ - | awk '{print $2}')/24 + sudo ifconfig br-tenants ${IRONIC_CONDUCTOR_IP}/24 fi helm install kolla/neutron-create-keystone-service-job --version $VERSION \