Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1797638: baremetal: Changes needed for IPv6 #2727

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -32,7 +32,7 @@ fi
# Wait for the interface to come up
# This is how the ironic container currently detects IRONIC_IP, this could probably be improved by using
# nmcli show provisioning there instead, but we need to confirm that works with the static-ip-manager
while [ -z "$(ip -4 address show dev "$PROVISIONING_NIC" | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -n 1)" ]; do
while [ -z "$(ip -o addr show dev $PROVISIONING_NIC | grep -v link)" ]; do
sleep 1
done

Expand All @@ -50,13 +50,6 @@ while ! iptables -L; do
sleep 1
done

# Add firewall rules to ensure the IPA ramdisk can reach httpd, Ironic and the Inspector API on the host
for port in 80 5050 6385 ; do
if ! sudo iptables -C INPUT -i $PROVISIONING_NIC -p tcp -m tcp --dport $port -j ACCEPT > /dev/null 2>&1; then
sudo iptables -I INPUT -i $PROVISIONING_NIC -p tcp -m tcp --dport $port -j ACCEPT
fi
done

# Start dnsmasq, http, mariadb, and ironic containers using same image
# Currently we do this outside of a pod because we need to ensure the images
# are downloaded before starting the API pods
Expand All @@ -73,10 +66,18 @@ podman run -d --net host --privileged --name httpd \
--env PROVISIONING_INTERFACE=$PROVISIONING_NIC \
-v $IRONIC_SHARED_VOLUME:/shared:z --entrypoint /bin/runhttpd ${IRONIC_IMAGE}

# Set CACHEURL to the default route, so we try to consume any images cached on the host
# running the VM (dev-scripts configures a cache here), if none is found then the
# downloader containers just skip and download from the internet location
CACHEURL="http://$(ip r | grep $PROVISIONING_NIC | awk '/default/ {print $3};')/images"
{{ if .PlatformData.BareMetal.ProvisioningIPv6 }}
IPTABLES=ip6tables
{{ else }}
IPTABLES=iptables
{{ end }}


# Set CACHEURL to the the same IP as is used in RHCOS_BOOT_IMAGE_URL, assuming any cache would
# be the same host, if none is found then the downloader containers just skip and download
# from the internet location ( IP=n.n.n.n:nn or [x:x::x]:nn )
IP=$(echo $RHCOS_BOOT_IMAGE_URL | sed -e 's/.*:\/\/\([^/]*\)\/.*/\1/g' )
CACHEURL="http://$IP/images"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since openshift/ironic-rhcos-downloader#24 this is no longer used, but I guess we can remove that in a follow-up PR

podman run -d --net host --name ipa-downloader \
--env CACHEURL=${CACHEURL} \
-v $IRONIC_SHARED_VOLUME:/shared:z ${IPA_DOWNLOADER_IMAGE} /usr/local/bin/get-resource.sh
Expand All @@ -85,6 +86,16 @@ podman run -d --net host --name coreos-downloader \
--env CACHEURL=${CACHEURL} \
-v $IRONIC_SHARED_VOLUME:/shared:z ${COREOS_DOWNLOADER_IMAGE} /usr/local/bin/get-resource.sh $RHCOS_BOOT_IMAGE_URL


# Add firewall rules to ensure the IPA ramdisk can reach httpd, Ironic and the Inspector API on the host
for port in 80 5050 6385 ; do
if ! sudo $IPTABLES -C INPUT -i $PROVISIONING_NIC -p tcp -m tcp --dport $port -j ACCEPT > /dev/null 2>&1; then
sudo $IPTABLES -I INPUT -i $PROVISIONING_NIC -p tcp -m tcp --dport $port -j ACCEPT
fi
done



# Wait for images to be downloaded/ready
podman wait -i 1000 ipa-downloader
podman wait -i 1000 coreos-downloader
Expand Down
5 changes: 3 additions & 2 deletions pkg/tfvars/baremetal/baremetal.go
Expand Up @@ -78,8 +78,9 @@ func TFVars(libvirtURI, bootstrapProvisioningIP, bootstrapOSImage, externalBridg

// Properties
propertiesMap := map[string]interface{}{
"local_gb": profile.LocalGB,
"cpu_arch": profile.CPUArch,
"local_gb": profile.LocalGB,
"cpu_arch": profile.CPUArch,
"capabilities": "boot_mode:uefi",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this only be conditional on IPv6?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It instructs ironic to install the bootloader into the EFI system partition for UEFI systems, but it doesn't (at least in my tests) prevent BIOS from working, so it shouldn't break the existing deploy process on BIOS hosts.

}

// Root device hints
Expand Down