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

Add OKD installer images #4453

Merged
merged 9 commits into from
Jul 18, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ case "$STATUS" in
logger -s "NM local-dns-prepender triggered by ${1} ${2}."
DNS_IP="127.0.0.1"
set +e
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
if systemctl -q is-enabled systemd-resolved; then
Copy link
Member

Choose a reason for hiding this comment

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

Ahh whee the resolved thing. I have only been tangentially following this, I think @dustymabe took the brunt of it.

This duplicates code that landed in the MCD right? I think it's going to be a long term win if we change the bootstrap process to extract config files from the MCD instead of duplicating things in the installer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I'd love to reuse the code, but prepender runs before FCOS pivots to OKD payload.

What we could do is to have a separate set of config, fetched from the image in the payload perhaps?

>&2 echo "NM resolv-prepender: Setting up systemd-resolved for local DNS"
vrutkovs marked this conversation as resolved.
Show resolved Hide resolved
if [[ ! -f /etc/systemd/resolved.conf.d/60-kni.conf ]]; then
>&2 echo "NM resolv-prepender: Creating /etc/systemd/resolved.conf.d/60-kni.conf"
mkdir -p /etc/systemd/resolved.conf.d
echo "[Resolve]" > /etc/systemd/resolved.conf.d/60-kni.conf
echo "DNS=$DNS_IP" >> /etc/systemd/resolved.conf.d/60-kni.conf
if systemctl -q is-active systemd-resolved; then
>&2 echo "NM resolv-prepender: restarting systemd-resolved"
systemctl restart systemd-resolved
Copy link
Member

Choose a reason for hiding this comment

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

Hmm too bad it doesn't support reload right now, I think this might transiently fail any in-flight DNS lookups (OTOH I guess this is mostly done when the network first comes up).

fi
fi
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf
fi
fi
;;
*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function cluster_bootstrap_gather() {
FILTER=gzip queue resources/openapi.json.gz oc --request-timeout=5s get --raw /openapi/v2

echo "Waiting for logs ..."
wait
while wait -n; do jobs; done

if (( $(stat -c%s "${ARTIFACTS_TEMP}/resources/openapi.json.gz") <= 20 ))
then
Expand Down
30 changes: 30 additions & 0 deletions data/data/bootstrap/files/usr/local/bin/bootstrap-pivot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
# Update bootstrap node with latest content. Required for OKD as it starts with FCOS image
# and needs to be updated to the machine-os-content used by masters / nodes.

vrutkovs marked this conversation as resolved.
Show resolved Hide resolved
# shellcheck disable=SC1091
. /usr/local/bin/bootstrap-service-record.sh

# Pivot bootstrap to FCOS + OKD machine-os-content
if [ ! -f /opt/openshift/.pivot-done ]; then
record_service_stage_start "pivot-to-release-image"

# shellcheck disable=SC1091
. /usr/local/bin/release-image.sh

# Run pre-pivot.sh script to update bootstrap node
MACHINE_CONFIG_OSCONTENT=$(image_for machine-os-content)
while ! podman pull --quiet "$MACHINE_CONFIG_OSCONTENT"
do
record_service_stage_failure
echo "Pull failed. Retrying $MACHINE_CONFIG_OSCONTENT..."
done
record_service_stage_success
mnt="$(podman image mount "${MACHINE_CONFIG_OSCONTENT}")"
pushd "${mnt}/bootstrap"
# shellcheck disable=SC1091
. ./pre-pivot.sh
popd
record_service_stage_success
fi
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ do
done

echo "Waiting for logs ..."
wait
while wait -n; do jobs; done
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ case "$STATUS" in
logger -s "NM local-dns-prepender triggered by ${1} ${2}."
DNS_IP="127.0.0.1"
set +e
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
if systemctl -q is-enabled systemd-resolved; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Outside of the scope of this PR, but I wonder if it would be better to have a single instance of these files and link to that single instance from the various platform directories. That way we don't have to worry about making the identical changes in 4 places.

Copy link
Member Author

Choose a reason for hiding this comment

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

This file is shared with MCO and previously we used https://github.com/openshift/baremetal-runtimecfg/ to share scripts (like non-virtual-ip). Perhaps we could use this repo as a script storage and extract it from runtimecfg image in installer/MCO?

>&2 echo "NM resolv-prepender: Setting up systemd-resolved for local DNS"
if [[ ! -f /etc/systemd/resolved.conf.d/60-kni.conf ]]; then
>&2 echo "NM resolv-prepender: Creating /etc/systemd/resolved.conf.d/60-kni.conf"
mkdir -p /etc/systemd/resolved.conf.d
echo "[Resolve]" > /etc/systemd/resolved.conf.d/60-kni.conf
echo "DNS=$DNS_IP" >> /etc/systemd/resolved.conf.d/60-kni.conf
if systemctl -q is-active systemd-resolved; then
>&2 echo "NM resolv-prepender: restarting systemd-resolved"
systemctl restart systemd-resolved
fi
fi
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf
fi
fi
;;
*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ case "$STATUS" in
logger -s "NM local-dns-prepender triggered by ${1} ${2}."
DNS_IP="127.0.0.1"
set +e
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
if systemctl -q is-enabled systemd-resolved; then
>&2 echo "NM resolv-prepender: Setting up systemd-resolved for local DNS"
if [[ ! -f /etc/systemd/resolved.conf.d/60-kni.conf ]]; then
>&2 echo "NM resolv-prepender: Creating /etc/systemd/resolved.conf.d/60-kni.conf"
mkdir -p /etc/systemd/resolved.conf.d
echo "[Resolve]" > /etc/systemd/resolved.conf.d/60-kni.conf
echo "DNS=$DNS_IP" >> /etc/systemd/resolved.conf.d/60-kni.conf
if systemctl -q is-active systemd-resolved; then
>&2 echo "NM resolv-prepender: restarting systemd-resolved"
systemctl restart systemd-resolved
fi
fi
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf
fi
fi
;;
*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Description=Configure CRI-O to use the pause image
After=release-image.service
Requires=release-image.service
{{if .IsOKD -}}
Requires=release-image-pivot.service
{{end -}}
Before=crio.service

[Service]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{if .IsOKD -}}
[Unit]
Description=Pivot bootstrap to the OpenShift Release Image
Wants=release-image.service
After=release-image.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/bootstrap-pivot.sh
RemainAfterExit=true
{{end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Unit]
ConditionPathExists=/enoent
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,27 @@ case "$STATUS" in
fi
EOF
set +e
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
if systemctl -q is-enabled systemd-resolved; then
>&2 echo "NM resolv-prepender: Setting up systemd-resolved for local DNS"
if [[ ! -f /etc/systemd/resolved.conf.d/60-kni.conf ]]; then
>&2 echo "NM resolv-prepender: Creating /etc/systemd/resolved.conf.d/60-kni.conf"
mkdir -p /etc/systemd/resolved.conf.d
echo "[Resolve]" > /etc/systemd/resolved.conf.d/60-kni.conf
echo "DNS=$DNS_IP" >> /etc/systemd/resolved.conf.d/60-kni.conf
if systemctl -q is-active systemd-resolved; then
>&2 echo "NM resolv-prepender: restarting systemd-resolved"
systemctl restart systemd-resolved
fi
fi
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by/a nameserver $DNS_IP" /etc/resolv.conf
logger -s "NM local-dns-prepender: Checking if local DNS IP is the first entry in resolv.conf"
if grep nameserver /etc/resolv.conf | head -n 1 | grep -q "$DNS_IP" ; then
logger -s "NM local-dns-prepender: local DNS IP already is the first entry in resolv.conf"
exit 0
else
logger -s "NM local-dns-prepender: Looking for '# Generated by NetworkManager' in /etc/resolv.conf to place 'nameserver $DNS_IP'"
sed -i "/^# Generated by.*$/a nameserver $DNS_IP" /etc/resolv.conf
fi
fi
{{end}}
;;
Expand Down
145 changes: 145 additions & 0 deletions data/data/fcos-amd64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"amis": {
"af-south-1": {
"hvm": "ami-0a1a411aaa6d4b527"
},
"ap-east-1": {
"hvm": "ami-05e431ec2fc9c924a"
},
"ap-northeast-1": {
"hvm": "ami-05b9fd3d730ef83ef"
},
"ap-northeast-2": {
"hvm": "ami-0bd42cc4365783d16"
},
"ap-northeast-3": {
"hvm": "ami-05215c82eaf761a11"
},
"ap-south-1": {
"hvm": "ami-0cd02ddff2f1a86ab"
},
"ap-southeast-1": {
"hvm": "ami-0770399b81c733429"
},
"ap-southeast-2": {
"hvm": "ami-075698bf311039797"
},
"ca-central-1": {
"hvm": "ami-0e12eb0c73669c145"
},
"eu-central-1": {
"hvm": "ami-08eeb2c051c7b2746"
},
"eu-north-1": {
"hvm": "ami-0aa4087237e3caa37"
},
"eu-south-1": {
"hvm": "ami-0ddaea57ee7f8c041"
},
"eu-west-1": {
"hvm": "ami-04294ca44dde3b013"
},
"eu-west-2": {
"hvm": "ami-0e30f22ddf8ff928d"
},
"eu-west-3": {
"hvm": "ami-071daa3ab6169a1fa"
},
"me-south-1": {
"hvm": "ami-0539270d61a06080e"
},
"sa-east-1": {
"hvm": "ami-0f3bd27a50373ee82"
},
"us-east-1": {
"hvm": "ami-01f39e95b77950f08"
},
"us-east-2": {
"hvm": "ami-0729394053ccbb99c"
},
"us-west-1": {
"hvm": "ami-021238084bf8c95ff"
},
"us-west-2": {
"hvm": "ami-0181746be6e4558fe"
}
},
"azure": {
"image": "fedora-coreos-33.20210217.3.0-azure.x86_64.vhd",
"url": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/33.20210217.3.0/x86_64/fedora-coreos-33.20210217.3.0-azure.x86_64.vhd.xz"
},
"baseURI": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/33.20210217.3.0/x86_64/",
"buildid": "33.20210217.3.0",
"gcp": {
"family": "fedora-coreos-stable",
"image": "fedora-coreos-33-20210217-3-0-gcp-x86-64",
"project": "fedora-coreos-cloud",
"url": "https://storage.googleapis.com/fedora-coreos-cloud-image-uploads/image-import/fedora-coreos-33-20210217-3-0-gcp-x86-64.tar.gz"
},
"images": {
"aws": {
"path": "fedora-coreos-33.20210217.3.0-aws.x86_64.vmdk.xz",
"sha256": "b8e8b2dde46c0040df51671c18663469c423fb949f64afc659b0467a9fe940ca",
"size": 808156944,
"uncompressed-sha256": "fd39d70cb0739053bc306ef2b8d09c06c051797b8c7e176466c0de2a8e3f609e",
"uncompressed-size": 852023808
},
"azure": {
"path": "fedora-coreos-33.20210217.3.0-azure.x86_64.vhd.xz",
"sha256": "9e5522a7f36c4e2562771c84ca47b85a67cfb1054598cdd991838d972a7d9657",
"size": 566575332,
"uncompressed-sha256": "d0ea0f0f8d33388b71234e85a45c059a86acbbaa30bc1fed8e78d0a0084afdea",
"uncompressed-size": 8589935104
},
"gcp": {
"path": "fedora-coreos-33.20210217.3.0-gcp.x86_64.tar.gz",
"sha256": "dcb4032d6a71cfa2da475d57218de2086847f07890f24eea308d174dd3f9f792",
"size": 833626256
},
"initramfs": {
"path": "fedora-coreos-33.20210217.3.0-live-initramfs.x86_64.img",
"sha256": "8a180dc5276738847869ac3790edf36409b41a548c42a74ba0247d28a1be2f4a"
},
"iso": {
"path": "fedora-coreos-33.20210217.3.0-live.x86_64.iso",
"sha256": "bf91335e07a97593b66e2ae9fd43924c3aa2353a5443e37b6efd77d3df883254"
},
"kernel": {
"path": "fedora-coreos-33.20210217.3.0-live-kernel-x86_64",
"sha256": "ef7c2c6d17c5434957586dc50cb24a11a70c91069ea99fbf7ee1f596817d4efd"
},
"metal": {
"path": "fedora-coreos-33.20210217.3.0-metal.x86_64.raw.xz",
"sha256": "fb3d401633f970c6a2218519ed4846597fb9673f66186b63da426442de880fc4",
"size": 566731348,
"uncompressed-sha256": "77a2272e09f1b8feec4a99f52740f016fb3b8a219fd812618747101372383e28",
"uncompressed-size": 3064987648
},
"openstack": {
"path": "fedora-coreos-33.20210217.3.0-openstack.x86_64.qcow2.xz",
"sha256": "0d6b6f1d0ffd7d5d5cc39fdaa2aa8120815ee6c81a73d8109002d2a78e50906b",
"size": 565259844,
"uncompressed-sha256": "ae088d752a52859ad38c53c29090efd5930453229ef6d1204645916aab856fb1",
"uncompressed-size": 1906311168
},
"ostree": {
"path": "fedora-coreos-33.20210217.3.0-ostree.x86_64.tar",
"sha256": "606a12da93e23f911b65bed2a843f82a5a564e7151ac0a5c013a43935e61e473",
"size": 760145920
},
"qemu": {
"path": "fedora-coreos-33.20210217.3.0-qemu.x86_64.qcow2.xz",
"sha256": "2e70980a0768a4f670546093df79f325fe5a1f3fa405367dd85392fb9b5de8c7",
"size": 569397416,
"uncompressed-sha256": "4d1933eb6aaf94a4bf1772d6191feb5bf8c42e5666a0dfcc4e8f1237734de6b0",
"uncompressed-size": 1921843200
},
"vmware": {
"path": "fedora-coreos-33.20210217.3.0-vmware.x86_64.ova",
"sha256": "3856ff9b1faa3210c0d8bcb10b4d481974fbdcd92204f1632bda66da313fa18c",
"size": 852039680
}
},
"ostree-commit": "4e69a32ac9dc553b1bf0c98b07c5f82ab52cd0cef2c366d5f6766ec4aa19e70f",
"ostree-version": "33.20210217.3.0"
}
Loading