-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[WIP] use machine-config-osimagestream to avoid hard-coding image tag names #10416
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
base: main
Are you sure you want to change the base?
Changes from all commits
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,13 +4,39 @@ set -euo pipefail | |
| # shellcheck source=release-image.sh.template | ||
| . /usr/local/bin/release-image.sh | ||
|
|
||
| # yuck... this is a good argument for renaming the node image to just `node` in both OCP and OKD | ||
| coreos_img={{.StreamTag}} | ||
| until COREOS_IMAGE=$(image_for ${coreos_img}); do | ||
| echo 'Failed to query release image; retrying...' | ||
| # Get the Machine Config Operator image from the release payload | ||
| until MCO_IMAGE=$(image_for 'machine-config-operator'); do | ||
| echo 'Failed to query MCO image from release; retrying...' | ||
| sleep 10 | ||
| done | ||
|
|
||
| # Create temporary directory for binary extraction | ||
| TEMP_DIR=$(mktemp -d) | ||
| echo "Extracting machine-config-osimagestream binary to ${TEMP_DIR}" | ||
|
|
||
| # Extract the machine-config-osimagestream binary from the MCO image. This avoids having to munge podman args, paths, env vars, etc. | ||
| podman create --name mco-osimagestream "${MCO_IMAGE}" | ||
| podman cp mco-osimagestream:/usr/bin/machine-config-osimagestream "${TEMP_DIR}/machine-config-osimagestream" | ||
| podman rm mco-osimagestream | ||
|
|
||
| # Execute the binary to get the CoreOS image pullspec | ||
| # Note: Proxy environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) are | ||
| # automatically inherited from the environment if set via /etc/profile.d/proxy.sh | ||
| until COREOS_IMAGE=$("${TEMP_DIR}/machine-config-osimagestream" \ | ||
| get os-image-pullspec \ | ||
| --release-image "${RELEASE_IMAGE_DIGEST}" \ | ||
| --authfile /root/.docker/config.json \ | ||
| --per-host-certs /etc/containers/certs.d \ | ||
| --osimagestream-name '{{ .OSImageStream }}' \ | ||
| --trust-bundle /etc/pki/ca-trust/source/anchors \ | ||
| --registry-config /etc/containers/registries.conf); do | ||
|
Comment on lines
+28
to
+32
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. Can't we rely on the defaults? (Just asking not a blocking question or ask for change)
Member
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. In #10406, I don't think we can rely on the defaults since |
||
| echo 'Failed to query for OS image pullspec; retrying...' | ||
| sleep 10 | ||
| done | ||
|
|
||
| # Clean up temporary directory | ||
| rm -rf "${TEMP_DIR}" | ||
|
|
||
| # need to use rpm-ostree here since `bootc status` doesn't work in the live ISO currently | ||
| # https://github.com/containers/bootc/issues/1043 | ||
| booted_version=$(rpm-ostree status --json | jq -r .deployments[0].version) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use
podman runviainstaller/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template
Lines 24 to 28 in ac9a370
If so, would be a little cleaner, but I'm not sure we can. Just an idea/suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I tried to do this in a different PR. While I eventually got it to work, it seemed really brittle.