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 support for creating AWS nodes for OCP 4.18 #507

Merged

Conversation

gparvin
Copy link
Member

@gparvin gparvin commented Oct 16, 2024

We have to provide AMI IDs. Not sure the best way to get them anymore so grabbed them off of aws site.

@@ -25,6 +26,7 @@ data:
us-east-2-4.15: ami-0b577c67f5371f6d1
us-east-2-4.16: ami-0f736c64d5751d7d3
us-east-2-4.17: ami-0dc8f3a200b9a6b1f
us-east-2-4.18: ami-01ad29897d6c9fd4c
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Okay, based on what I found from the AMIs already here (i.e. using the "531415883065" owner ID), this aws CLI command will get you the 10 most recent AMIs in a particular region (not sure if there's a better way since I'm not sure on the owner-id or the aws filtering parameter might have some better uses than dumping it over to jq...):

ocp_version=4.18
aws_region=us-east-1
ami_json=$(aws ec2 describe-images --region ${aws_region} --filters "Name=owner-id,Values=531415883065" --output json)
echo ${ami_json} | jq -r '.Images | sort_by(.Description) | .[] | select(.Name | startswith("rhcos-'${ocp_version//./}'")) | .ImageId + "\t" + .Description' | tail -10

But building on that, here's a loop to get the AMI for multiple OCP versions in different US regions:

for region in east west; do
  for idx in 1 2; do
    ami_json=$(aws ec2 describe-images --region us-${region}-${idx} --filters "Name=owner-id,Values=531415883065" --output json)
    for ocp_version in 4.16 4.17 4.18; do
      echo ${ami_json} | jq -r '.Images | sort_by(.Description) | .[] | select(.Name | startswith("rhcos-'${ocp_version//./}'")) | "us-'${region}-${idx}'\t" + .ImageId + "\t" + .Description' | tail -1
    done
  done
done

Copy link
Member

Choose a reason for hiding this comment

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

Okay, actually. Following breadcrumbs in this Bugzilla (old but might still be relevant?): https://bugzilla.redhat.com/show_bug.cgi?id=1775774

Looks like the AMIs are discoverable in each release branch in the openshift/installer repo: https://github.com/openshift/installer/blob/release-4.18/data/data/coreos/rhcos.json

So something like this might be more reliable/straightforward (assuming it's kept up-to-date):

curl -s https://raw.githubusercontent.com/openshift/installer/refs/heads/release-4.18/data/data/coreos/rhcos.json | jq '.architectures.x86_64.images.aws.regions'

Copy link
Member Author

Choose a reason for hiding this comment

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

Perfect! Thanks! I'll make an update and test it out to make sure these AMI IDs work for these worker nodes.

/hold

Copy link
Member Author

Choose a reason for hiding this comment

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

The AMI ids seem to be working fine. Just tested one release, but I'll try to use this method going forward to keep the images updated.

/unhold

We have to provide AMI IDs.  Not sure the best way to get them
anymore so grabbed them off of aws site.

Signed-off-by: Gus Parvin <[email protected]>
Copy link
Member

@dhaiducek dhaiducek left a comment

Choose a reason for hiding this comment

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

I was about to say I was just going to approve it, but since we've come this far I figured I'd do my due diligence. LGTM!

ids='<paste key:value list here>'

for idx in $(seq 0 "$(echo "${ids}" | yq 'keys | length - 1')"); do
  key=$(echo "$ids" | yq "keys | .[$idx]")
  aws_region=${key%-*}
  ocp_ver=${key##*-}
  printf "OCP-%s\t%s\t" ${ocp_ver} ${aws_region}
  aws ec2 describe-images --region $aws_region --image-ids "$(echo "$ids" | yq ".[\"${key}\"]")" | jq -r '.Images[].Description'
done
OCP-4.12	us-east-1	OpenShift 4 412.86.202402272018-0 x86_64
OCP-4.12	us-east-2	OpenShift 4 412.86.202402272018-0 x86_64
OCP-4.13	us-east-1	OpenShift 4 413.92.202402131523-0 x86_64
OCP-4.13	us-east-2	OpenShift 4 413.92.202402131523-0 x86_64
OCP-4.14	us-east-1	OpenShift 4 414.92.202407091253-0 x86_64
OCP-4.14	us-east-2	OpenShift 4 414.92.202407091253-0 x86_64
OCP-4.15	us-east-1	OpenShift 4 415.92.202407091355-0 x86_64
OCP-4.15	us-east-2	OpenShift 4 415.92.202407091355-0 x86_64
OCP-4.16	us-east-1	OpenShift 4 416.94.202406251923-0 x86_64
OCP-4.16	us-east-2	OpenShift 4 416.94.202406251923-0 x86_64
OCP-4.17	us-east-1	OpenShift 4.17 417.94.202410090854-0 x86_64
OCP-4.17	us-east-2	OpenShift 4.17 417.94.202410090854-0 x86_64
OCP-4.18	us-east-1	OpenShift 4.18 418.94.202410090804-0 x86_64
OCP-4.18	us-east-2	OpenShift 4.18 418.94.202410090804-0 x86_64

Copy link

openshift-ci bot commented Oct 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhaiducek, gparvin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 7757ce5 into open-cluster-management-io:main Oct 17, 2024
3 checks passed
@dhaiducek
Copy link
Member

For reference, the new list looks wayyyyy better than the old list 🎉 (more up-to-date, and there seem to have been some unintended mismatches in there):

OCP-4.10	us-east-1	OpenShift 4 49.84.202109241334-0 x86_64
OCP-4.10	us-east-2	
OCP-4.11	us-east-1	OpenShift 4 411.86.202207150124-0 x86_64
OCP-4.11	us-east-2	OpenShift 4 411.86.202207150124-0 x86_64
OCP-4.12	us-east-1	OpenShift 4 412.86.202212081411-0 x86_64
OCP-4.12	us-east-2	OpenShift 4 412.86.202212081411-0 x86_64
OCP-4.13	us-east-1	OpenShift 4 413.92.202305021736-0 x86_64
OCP-4.13	us-east-2	OpenShift 4 413.92.202305021736-0 x86_64
OCP-4.14	us-east-1	OpenShift 4 413.92.202307260246-0 x86_64
OCP-4.14	us-east-2	OpenShift 4 413.92.202305021736-0 x86_64
OCP-4.15	us-east-1	OpenShift 4 413.92.202307260246-0 x86_64
OCP-4.15	us-east-2	OpenShift 4 414.92.202310210434-0 x86_64
OCP-4.16	us-east-1	OpenShift 4 415.92.202402130021-0 x86_64
OCP-4.16	us-east-2	OpenShift 4 414.92.202402130420-0 x86_64
OCP-4.17	us-east-1	OpenShift 4.17 417.94.202407010929-0 x86_64
OCP-4.17	us-east-2	OpenShift 4.17 417.94.202407010929-0 x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants