3 LIBDIR="$(dirname "$PWD")"
5 source $LIBDIR/lib/logging.sh
6 source $LIBDIR/lib/common.sh
8 if [[ $EUID -ne 0 ]]; then
9 echo "confgiure script must be run as root"
13 function check_inteface_ip {
17 if [ ! $(ip addr show dev $interface) ]; then
21 local ipv4address=$(ip addr show dev $interface | awk '$1 == "inet" { sub("/.*", "", $2); print $2 }')
22 if [ "$ipv4address" != "$ipaddr" ]; then
27 function configure_dhcp_bridge {
30 brctl addif dhcp0 $BS_DHCP_INTERFACE
31 ip addr add dev dhcp0 $BS_DHCP_INTERFACE_IP
34 function configure_ironic_bridge {
35 brctl addbr provisioning
36 ip link set provisioning up
37 brctl addif provisioning $IRONIC_INTERFACE
38 ip addr add dev provisioning 172.22.0.1/24
41 function configure_kubelet {
43 #Todo addition kubelet configuration
46 function configure_kubeadm {
48 if [ "$1" == "offline" ]; then
49 for images in kube-apiserver kube-controller-manager kube-scheduler kube-proxy; do
50 docker load --input $CONTAINER_IMAGES_DIR/$images.tar;
53 docker load --input $CONTAINER_IMAGES_DIR/pause.tar
54 docker load --input $CONTAINER_IMAGES_DIR/etcd.tar
55 docker load --input $CONTAINER_IMAGES_DIR/coredns.tar
58 kubeadm config images pull --kubernetes-version=$KUBE_VERSION
61 function configure_ironic_interfaces {
62 #Todo later to change the CNI networking for podman networking
63 # Add firewall rules to ensure the IPA ramdisk can reach httpd, Ironic and the Inspector API on the host
64 if [ "$IRONIC_PROVISIONING_INTERFACE" ]; then
65 check_inteface_ip $IRONIC_PROVISIONING_INTERFACE $IRONIC_PROVISIONING_INTERFACE_IP
70 if [ "$IRONIC_IPMI_INTERFACE" ]; then
71 check_inteface_ip $IRONIC_IPMI_INTERFACE $IRONIC_IPMI_INTERFACE_IP
76 for port in 80 5050 6385 ; do
77 if ! sudo iptables -C INPUT -i $IRONIC_PROVISIONING_INTERFACE -p tcp -m tcp --dport $port -j ACCEPT > /dev/null 2>&1; then
78 sudo iptables -I INPUT -i $IRONIC_PROVISIONING_INTERFACE -p tcp -m tcp --dport $port -j ACCEPT
82 # Allow ipmi to the bmc processes
83 if ! sudo iptables -C INPUT -i $IRONIC_IPMI_INTERFACE -p udp -m udp --dport 6230:6235 -j ACCEPT 2>/dev/null ; then
84 sudo iptables -I INPUT -i $IRONIC_IPMI_INTERFACE -p udp -m udp --dport 6230:6235 -j ACCEPT
87 #Allow access to dhcp and tftp server for pxeboot
88 for port in 67 69 ; do
89 if ! sudo iptables -C INPUT -i $IRONIC_PROVISIONING_INTERFACE -p udp --dport $port -j ACCEPT 2>/dev/null ; then
90 sudo iptables -I INPUT -i $IRONIC_PROVISIONING_INTERFACE -p udp --dport $port -j ACCEPT
95 function configure_ironic_offline {
96 if [ ! -d $CONTAINER_IMAGES_DIR ] && [ ! -d $BUILD_DIR ]; then
100 for image in ironic-inspector-image ironic-image podman-pause \
101 baremetal-operator socat; do
102 if [ ! -f "$CONTAINER_IMAGES_DIR/$image" ]; then
107 if [ ! -f "$BUILD_DIR/ironic-python-agent.initramfs"] && [ ! -f \
108 "$BUILD_DIR/ironic-python-agent.kernel" ] && [ ! -f
109 "$BUILD_DIR/$BM_IMAGE" ]; then
113 podman load --input $CONTAINER_IMAGES_DIR/ironic-inspector-image.tar
114 podman load --input $CONTAINER_IMAGES_DIR/ironic-image.tar
115 podman load --input $CONTAINER_IMAGES_DIR/podman-pause.tar
117 docker load --input $CONTAINER_IMAGES_DIR/baremetal-operator.tar
118 docker load --input $CONTAINER_IMAGES_DIR/socat.tar
120 mkdir -p "$IRONIC_DATA_DIR/html/images"
122 cp $BUILD_DIR/ironic-python-agent.initramfs $IRONIC_DATA_DIR/html/images/
123 cp $BUILD_DIR/ironic-python-agent.kernel $IRONIC_DATA_DIR/html/images/
124 cp $BUILD_DIR/$BM_IMAGE $IRONIC_DATA_DIR/html/images/
125 md5sum $BUILD_DIR/$BM_IMAGE | awk '{print $1}' > $BUILD_DIR/${BM_IMAGE}.md5sum
128 function configure_ironic {
129 if [ "$1" == "offline" ]; then
130 configure_ironic_offline
134 #Podman usage is deprecated for v1.0.0 release
135 #podman pull $IRONIC_IMAGE
136 docker pull $IRONIC_IMAGE
137 #podman pull $IRONIC_INSPECTOR_IMAGE
138 docker pull $IRONIC_INSPECTOR_IMAGE
140 mkdir -p "$IRONIC_DATA_DIR/html/images"
141 pushd $IRONIC_DATA_DIR/html/images
143 if [ ! -f ironic-python-agent.initramfs ]; then
144 curl --insecure --compressed -L https://images.rdoproject.org/master/rdo_trunk/current-tripleo-rdo/ironic-python-agent.tar | tar -xf -
147 if [[ "$BM_IMAGE_URL" && "$BM_IMAGE" ]]; then
148 curl -o ${BM_IMAGE} --insecure --compressed -O -L ${BM_IMAGE_URL}
149 md5sum ${BM_IMAGE} | awk '{print $1}' > ${BM_IMAGE}.md5sum
155 #Kubeadm usage deprecated for v1.0.0 release
156 #configure_kubeadm $1
159 configure_dhcp_bridge
160 configure_ironic_bridge
161 configure_ironic_interfaces
164 if [ "$1" == "-o" ]; then