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
This commit is contained in:
Sam Betts 2017-04-25 12:43:33 +01:00
parent c5b88df43a
commit 12ece85bd6
6 changed files with 17 additions and 11 deletions

View File

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

View File

@ -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": [
{

View File

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

View File

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

View File

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

View File

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