diff --git a/ironic/templates/bin/_ironic-api.sh.tpl b/ironic/templates/bin/_ironic-api.sh.tpl index eba0404c15..97e312ab9d 100644 --- a/ironic/templates/bin/_ironic-api.sh.tpl +++ b/ironic/templates/bin/_ironic-api.sh.tpl @@ -21,7 +21,8 @@ COMMAND="${@:-start}" function start () { exec ironic-api \ - --config-file /etc/ironic/ironic.conf + --config-file /etc/ironic/ironic.conf \ + --config-file /tmp/pod-shared/cleaning-network.conf } function stop () { diff --git a/ironic/templates/bin/_ironic-conductor-init.sh.tpl b/ironic/templates/bin/_ironic-conductor-init.sh.tpl index 2460925f5a..11cbd624ad 100644 --- a/ironic/templates/bin/_ironic-conductor-init.sh.tpl +++ b/ironic/templates/bin/_ironic-conductor-init.sh.tpl @@ -36,7 +36,7 @@ if [ "x" == "x${PXE_IP}" ]; then exit 1 fi -cat </tmp/pod-shared/conductor-local-ip.conf +tee /tmp/pod-shared/conductor-local-ip.conf << EOF [DEFAULT] # IP address of this host. If unset, will determine the IP diff --git a/ironic/templates/bin/_ironic-conductor.sh.tpl b/ironic/templates/bin/_ironic-conductor.sh.tpl index 7349b5bf05..c5e471b51e 100644 --- a/ironic/templates/bin/_ironic-conductor.sh.tpl +++ b/ironic/templates/bin/_ironic-conductor.sh.tpl @@ -23,4 +23,5 @@ mkdir -p /var/lib/openstack-helm/ironic/master_images exec ironic-conductor \ --config-file /etc/ironic/ironic.conf \ - --config-file /tmp/pod-shared/conductor-local-ip.conf + --config-file /tmp/pod-shared/conductor-local-ip.conf \ + --config-file /tmp/pod-shared/cleaning-network.conf diff --git a/ironic/templates/bin/_manage-cleaning-network.sh.tpl b/ironic/templates/bin/_manage-cleaning-network.sh.tpl new file mode 100644 index 0000000000..3b28a95adc --- /dev/null +++ b/ironic/templates/bin/_manage-cleaning-network.sh.tpl @@ -0,0 +1,47 @@ +#!/bin/bash + +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -ex + +if ! openstack network show ${neutron_network_name}; then + IRONIC_NEUTRON_CLEANING_NET_ID=$(openstack network create -f value -c id \ + --share \ + --provider-network-type flat \ + --provider-physical-network ${neutron_provider_network} \ + ${neutron_network_name}) +else + IRONIC_NEUTRON_CLEANING_NET_ID=$(openstack network show ${neutron_network_name} -f value -c id) +fi + +for SUBNET in $(openstack network show $IRONIC_NEUTRON_CLEANING_NET_ID -f value -c subnets); do + CURRENT_SUBNET=$(openstack subnet show $SUBNET -f value -c name) + if [ "x${CURRENT_SUBNET}" == "x${neutron_subnet_name}" ]; then + openstack subnet show ${neutron_subnet_name} + SUBNET_EXISTS=true + fi +done + +if [ "x${SUBNET_EXISTS}" != "xtrue" ]; then + openstack subnet create \ + --gateway ${neutron_subnet_gateway%/*} \ + --allocation-pool start=${neutron_subnet_alloc_start},end=${neutron_subnet_alloc_end} \ + --dns-nameserver 10.96.0.10 \ + --subnet-range ${neutron_subnet_cidr} \ + --network ${neutron_network_name} \ + ${neutron_subnet_name} +fi diff --git a/ironic/templates/bin/_retreive-cleaning-network.sh.tpl b/ironic/templates/bin/_retreive-cleaning-network.sh.tpl new file mode 100644 index 0000000000..985c390486 --- /dev/null +++ b/ironic/templates/bin/_retreive-cleaning-network.sh.tpl @@ -0,0 +1,25 @@ +#!/bin/bash + +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -ex + +IRONIC_NEUTRON_CLEANING_NET_ID=$(openstack network show ${neutron_network_name} -f value -c id) +tee /tmp/pod-shared/cleaning-network.conf <