-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Baremetal] Support For Deploying with ISOs for Baremetal IPI #5425
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
Changes from all commits
0e83811
c72688c
72c6f19
3cb6090
db0b0a5
a88a377
c35a7a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,13 @@ set -ex | |
| . /usr/local/bin/release-image.sh | ||
|
|
||
| IRONIC_IMAGE=$(image_for ironic) | ||
| IPA_DOWNLOADER_IMAGE=$(image_for ironic-ipa-downloader) | ||
| COREOS_DOWNLOADER_IMAGE=$(image_for ironic-machine-os-downloader || image_for ironic-rhcos-downloader) | ||
| IRONIC_AGENT_IMAGE=$(image_for ironic-agent) | ||
| CUSTOMIZATION_IMAGE=$(image_for image-customization-controller) | ||
|
|
||
| # This image is templated in via the installer pkg/asset/ignition/bootstrap/bootstrap.go | ||
| # This image is templated in via the installer pkg/asset/ignition/bootstrap/common.go | ||
| RHCOS_BOOT_IMAGE_URL="{{.BootImage}}" | ||
| RHCOS_LIVE_IMAGE_URL="{{.PlatformData.BareMetal.ClusterOSImage}}" | ||
|
|
||
| # This DHCP range is used by dnsmasq to serve DHCP to the cluster. If empty | ||
| # dnsmasq will only serve TFTP, and DHCP will be disabled. | ||
|
|
@@ -19,7 +21,7 @@ IRONIC_RAMDISK_SSH_KEY="{{.SSHKey}}" | |
|
|
||
| # First we stop any previously started containers, because ExecStop only runs when the ExecStart process | ||
| # e.g this script is still running, but we exit if *any* of the containers exits unexpectedly | ||
| for name in ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs dnsmasq httpd mariadb ipa-downloader coreos-downloader; do | ||
| for name in ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs dnsmasq httpd mariadb coreos-downloader image-customization; do | ||
| podman ps | grep -w "$name$" && podman kill $name | ||
| podman ps --all | grep -w "$name$" && podman rm $name -f | ||
| done | ||
|
|
@@ -114,12 +116,7 @@ podman run -d --net host --name coreos-downloader \ | |
| --restart on-failure \ | ||
| --env CACHEURL=${CACHEURL} \ | ||
| --env IP_OPTIONS=${IP_OPTIONS} \ | ||
| -v $IRONIC_SHARED_VOLUME:/shared:z ${COREOS_DOWNLOADER_IMAGE} /usr/local/bin/get-resource.sh $RHCOS_BOOT_IMAGE_URL | ||
|
|
||
| podman run -d --net host --name ipa-downloader \ | ||
| --restart on-failure \ | ||
| --env CACHEURL=${CACHEURL} \ | ||
| -v $IRONIC_SHARED_VOLUME:/shared:z ${IPA_DOWNLOADER_IMAGE} /usr/local/bin/get-resource.sh | ||
| -v $IRONIC_SHARED_VOLUME:/shared:z ${COREOS_DOWNLOADER_IMAGE} /usr/local/bin/get-live-images.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 | ||
|
|
@@ -152,11 +149,47 @@ $IPTABLES -t raw -A DHCP_IRONIC -j DROP | |
| {{end}} | ||
|
|
||
| # Wait for images to be downloaded/ready | ||
| podman wait -i 1000ms ipa-downloader | ||
| podman wait -i 1000ms coreos-downloader | ||
| while ! curl --fail http://localhost/images/rhcos-ootpa-latest.qcow2.md5sum ; do sleep 1; done | ||
| while ! curl --fail --head http://localhost/images/ironic-python-agent.initramfs ; do sleep 1; done | ||
| while ! curl --fail --head http://localhost/images/ironic-python-agent.kernel ; do sleep 1; done | ||
|
|
||
| export KUBECONFIG=/opt/openshift/auth/kubeconfig-loopback | ||
|
|
||
| mkdir -p /tmp/nmstate | ||
|
|
||
| {{range .PlatformData.BareMetal.Hosts}} | ||
| until oc get -n openshift-machine-api baremetalhost {{.Name}}; do | ||
| echo Waiting for Host {{.Name}} to appear... | ||
| sleep 10 | ||
| done | ||
| secret_name=$(oc get -n openshift-machine-api baremetalhost {{.Name}} -o jsonpath="{.spec.preprovisioningNetworkDataName}") | ||
| if [ -n "${secret_name}" ]; then | ||
| until oc get -n openshift-machine-api secret "${secret_name}"; do | ||
| echo Waiting for Secret "${secret_name}" to appear... | ||
| sleep 10 | ||
| done | ||
| oc get -n openshift-machine-api secret ${secret_name} -o jsonpath="{.data.nmstate}" | base64 -d > /tmp/nmstate/{{.Name}}.yaml | ||
| else | ||
| touch /tmp/nmstate/{{.Name}}.yaml | ||
| fi | ||
| {{end}} | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @imain I think that this whole block could be simplified, given that the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's actually what I had before. Steve wanted to use the network secrets to get the data. Apparently they could be modified by the user after configuration and before/during deployment.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hardys just to clarify, do you have more details about this point? In understood that the main purpose of the secret was for day-2 operation. |
||
|
|
||
| # Embed agent ignition into the rhcos live iso | ||
| sudo podman run -d -p 8084:8084 --privileged --name image-customization \ | ||
imain marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --env DEPLOY_ISO="/shared/html/images/ironic-python-agent.iso" \ | ||
imain marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --env IRONIC_BASE_URL="http://{{.PlatformData.BareMetal.APIVIP}}" \ | ||
| --env IRONIC_AGENT_IMAGE="" \ | ||
| --env IRONIC_AGENT_PULL_SECRET="" \ | ||
imain marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --env IRONIC_RAMDISK_SSH_KEY="$IRONIC_RAMDISK_SSH_KEY" \ | ||
| --env IRONIC_AGENT_IMAGE="$IRONIC_AGENT_IMAGE" \ | ||
| --env IRONIC_AGENT_PULL_SECRET="{{.PlatformData.BareMetal.PullSecretBase64}}" \ | ||
| --env DEPLOY_INITRD="/shared/html/images/ironic-python-agent.initramfs" \ | ||
| --env PROVISIONING_INTERFACE=$PROVISIONING_NIC \ | ||
| --env REGISTRIES_CONF_PATH=/tmp/containers/registries.conf \ | ||
| --entrypoint '["/image-customization-server", "--nmstate-dir=/tmp/nmstate/", "--images-publish-addr=http://0.0.0.0:8084"]' \ | ||
| -v /tmp/nmstate/:/tmp/nmstate/ \ | ||
| -v $IRONIC_SHARED_VOLUME:/shared:z \ | ||
| -v /etc/containers:/tmp/containers:z \ | ||
| ${CUSTOMIZATION_IMAGE} | ||
|
|
||
| sudo podman run -d --net host --privileged --name ironic-conductor \ | ||
| --restart on-failure \ | ||
|
|
@@ -165,6 +198,7 @@ sudo podman run -d --net host --privileged --name ironic-conductor \ | |
| --env PROVISIONING_INTERFACE=$PROVISIONING_NIC \ | ||
| --env OS_CONDUCTOR__HEARTBEAT_TIMEOUT=120 \ | ||
| --env HTTP_BASIC_HTPASSWD=${IRONIC_HTPASSWD} \ | ||
| --env IRONIC_KERNEL_PARAMS="${IRONIC_KERNEL_PARAMS}" \ | ||
| --entrypoint /bin/runironic-conductor \ | ||
| -v $AUTH_DIR:/auth:ro \ | ||
| -v $IRONIC_SHARED_VOLUME:/shared:z ${IRONIC_IMAGE} | ||
|
|
@@ -216,7 +250,7 @@ while true; do | |
| done | ||
|
|
||
| echo "Stopping provisioning services..." | ||
| podman stop ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs $dnsmasq_container_name httpd mariadb | ||
| podman stop ironic-api ironic-conductor ironic-inspector ironic-ramdisk-logs $dnsmasq_container_name httpd mariadb image-customization | ||
| exit 0 | ||
| fi | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.