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

mantle/aws: add configuration for default VolumeType, IMDSv2 support, and boot mode #3607

Merged
merged 3 commits into from
Sep 16, 2023

Conversation

prestist
Copy link
Contributor

#3586 Option 1

AWS now allows marking an AMI as "UEFI-preferred"; i.e. that both BIOS
and UEFI are supported, but the latter is preferred if the instance type
supports it.

Let's make use of it.

A change proposal has been submitted for Fedora 39 to also do this for
the Fedora Cloud image.

Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html
Ref: https://fedoraproject.org/wiki/Changes/CloudEC2UEFIPreferred
@openshift-ci
Copy link

openshift-ci bot commented Sep 12, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Yes, this is what I was suggesting. Except we'd still want something similar to what you had in #3586 in aws.py but except passing the flags, e.g.

if 'aws-imds2-support' in image_yaml:
  ore_args.extend(['--imds2-support'])
if 'aws-volume-type' in image_yaml:
  ore_args.extend(['--volume-type', image_yaml['aws-volume-type']])
if 'aws-x86-boot-mode' in image_yaml and image is for x86_64:
  ore_args.extend(['--boot-mode', image_yaml['aws-x86-boot-mode']])

if architecture == "" {
architecture = runtime.GOARCH
}
switch architecture {
case "amd64", "x86_64":
awsArch = ec2.ArchitectureTypeX8664
bootmode = "uefi-preferred"
Copy link
Member

Choose a reason for hiding this comment

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

I think this also may need to be parameterized so that we leave RHCOS the same for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I left out the bootmode bit just to make sure I was on the right track. I will add that shortly.

Copy link
Member

Choose a reason for hiding this comment

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

I think this also may need to be parameterized so that we leave RHCOS the same for now?

I notice this comment is now marked as outdated so maybe I'm looking at the wrong information, but just based on your comment I think we want the new defaults to go to latest development RHCOS don't we? We can back out the changes with image.yaml config if we find one of the new settings is not palatable for whatever reason.

Copy link
Member

Choose a reason for hiding this comment

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

I think this also may need to be parameterized so that we leave RHCOS the same for now?

I notice this comment is now marked as outdated so maybe I'm looking at the wrong information, but just based on your comment I think we want the new defaults to go to latest development RHCOS don't we?

I'm not sure. The last on this was Colin's suggestion in #3402 to make it opt-in, but I'm not sure if I've missed some conversations about it since then to track that change in OCP.

Copy link
Member

Choose a reason for hiding this comment

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

yeah. We probably do need some paperwork done in the OCP side. @mike-nguyen - could you help us track what we'd need to do here?

Either way I think I'd prefer we land the defaults the way it currently is and then opt-out in the development head in openshift/os, which isn't hard to do.

Copy link
Member

Choose a reason for hiding this comment

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

My thoughts offhand:

  • the gp3 change can probably just sail through - IMO it's sufficient to tag it for release notes
  • The IMDSv2 change seems not unlikely to actually break some things; until recently IIRC some in-tree code in kubelet actually talked to the cloud-init user data too (to e.g. determine which aws region it's in). There are potentially other operators. Some of that may be IMDSv2 ready. Others may not and it may sadly need some mechanism to opt out (openshift-install config and/or cluster-api/machineset?)
  • UEFI is probably OK going to just sail through too - IMO it's sufficient to tag it for release notes

Copy link
Member

Choose a reason for hiding this comment

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

IOW of these 3 things, I think only IMDSv2 may be worthy of an OCP enhancement, but it can probably be a small/quick one.

mantle/cmd/ore/aws/upload.go Outdated Show resolved Hide resolved
@prestist
Copy link
Contributor Author

Yes, this is what I was suggesting. Except we'd still want something similar to what you had in #3586 in aws.py but except passing the flags, e.g.

if 'aws-imds2-support' in image_yaml:
  ore_args.extend(['--imds2-support'])
if 'aws-volume-type' in image_yaml:
  ore_args.extend(['--volume-type', image_yaml['aws-volume-type']])
if 'aws-x86-boot-mode' in image_yaml and image is for x86_64:
  ore_args.extend(['--boot-mode', image_yaml['aws-x86-boot-mode']])

Ah awesome ok will do

src/cosalib/aws.py Outdated Show resolved Hide resolved
src/cosalib/aws.py Outdated Show resolved Hide resolved
src/cosalib/aws.py Outdated Show resolved Hide resolved
IMDSV2-only has the potential to break existing systems, expose configuration
through an environment vairable defined in 'image-default.yaml' to overide
defaults.

Default volume type to 'gp3', while 'gp3' is generally better there could be
a reason to change it. Expose configuration through enviornment variable
defined in 'image-default.yaml' to allow for overiding.

Docs:
IMDSv2: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-instances-ami-configuration
GP3: https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-storage-compare-volume-types.html
dustymabe
dustymabe previously approved these changes Sep 14, 2023
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

LGTM

@prestist prestist marked this pull request as ready for review September 14, 2023 20:47
jlebon
jlebon previously approved these changes Sep 14, 2023
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Looks sane to me overall! Were you able to confirm that an AMI created with this PR looks and works as intended?

The more conservative approach is to keep the status quo as default, but OK with this if we merge the appropriate openshift/os PR first before this one.

mantle/cmd/ore/aws/upload.go Show resolved Hide resolved
mantle/platform/api/aws/images.go Outdated Show resolved Hide resolved
@jlebon jlebon changed the title Ami updates option 2 mantle/aws: add configuration for default VolumeType, IMDSv2 support, and boot mode Sep 15, 2023
@prestist
Copy link
Contributor Author

Looks sane to me overall! Were you able to confirm that an AMI created with this PR looks and works as intended?

So I guess I am stuck in the How, on this?

I know I can build via cosa buildextend-aws, but how do I get the 'ami' data?
And sure I would love to verify, I am not sure if I have access to aws, I am going to look into that / maybe ask followup questions depending on what I find.

The more conservative approach is to keep the status quo as default, but OK with this if we merge the appropriate openshift/os PR first before this one.

Ok, I will make a pr to update the OpenShift/OS

prestist added a commit to prestist/os that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
prestist added a commit to prestist/os that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
prestist added a commit to prestist/os that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
Add configuration for boot mode when used with a supported architecture
i.e. 'amd64/x86_64'. With a default of 'uefi-preferred'.
@prestist prestist dismissed stale reviews from jlebon and dustymabe via e1eaa31 September 15, 2023 18:17
prestist added a commit to prestist/os that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

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

LGTM

prestist added a commit to prestist/fedora-coreos-config that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
prestist added a commit to prestist/fedora-coreos-config that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
prestist added a commit to prestist/fedora-coreos-config that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
@prestist
Copy link
Contributor Author

Ok, after working with @dustymabe we were able to upload an ami and see the correct values, then ran basic kola tests with flying colors!

I have since opened some PRS to insure no changes in
Openshift/OS ; stable ; testing; testing-devel

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

LGTM!

dustymabe pushed a commit to coreos/fedora-coreos-config that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
dustymabe pushed a commit to coreos/fedora-coreos-config that referenced this pull request Sep 15, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
coreosbot-releng pushed a commit to coreosbot-releng/os that referenced this pull request Sep 16, 2023
Dusty Mabe (1):
      Revert "manifests/fedora-coreos: ban initscripts-service"

Jonathan Lebon (2):
      Revert "Revert "manifests/fedora-coreos: ban initscripts-service""
      denylist: drop coreos.boot-mirror tests

Michael Armijo (1):
      denylist: extend snooze for `ext.config.networking.*` tests

Nikita Dubrovskii (1):
      overrides: fast-track rust-coreos-installer-0.18.0-1.fc38

Steven Presti (1):
      image.yaml: aws; add old defaults for new fields see coreos/coreos-assembler#3607
dustymabe pushed a commit to coreos/fedora-coreos-config that referenced this pull request Sep 16, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
dustymabe pushed a commit to prestist/os that referenced this pull request Sep 16, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
@dustymabe dustymabe merged commit 1b13b39 into coreos:main Sep 16, 2023
2 checks passed
dustymabe added a commit to dustymabe/fedora-coreos-config that referenced this pull request Sep 16, 2023
We switched to IMDSV2 by default in COSA so let's update our call here.
coreos/coreos-assembler#3607
dustymabe added a commit to coreosbot-releng/fedora-coreos-config that referenced this pull request Sep 16, 2023
We switched to IMDSV2 by default in COSA so let's update our call here.
coreos/coreos-assembler#3607
dustymabe added a commit to coreosbot-releng/fedora-coreos-config that referenced this pull request Sep 16, 2023
We switched to IMDSV2 by default in COSA so let's update our call here.
coreos/coreos-assembler#3607
coreosbot-releng pushed a commit to coreosbot-releng/os that referenced this pull request Sep 17, 2023
Dusty Mabe (2):
      Revert "manifests/fedora-coreos: ban initscripts-service"
      denylist: extend/rework kdump.crash snoozes

Jonathan Lebon (2):
      Revert "Revert "manifests/fedora-coreos: ban initscripts-service""
      denylist: drop coreos.boot-mirror tests

Michael Armijo (1):
      denylist: extend snooze for `ext.config.networking.*` tests

Nikita Dubrovskii (1):
      overrides: fast-track rust-coreos-installer-0.18.0-1.fc38

Steven Presti (1):
      image.yaml: aws; add old defaults for new fields see coreos/coreos-assembler#3607
jlebon pushed a commit to coreos/fedora-coreos-config that referenced this pull request Sep 17, 2023
We switched to IMDSV2 by default in COSA so let's update our call here.
coreos/coreos-assembler#3607
dustymabe added a commit to coreos/fedora-coreos-config that referenced this pull request Sep 17, 2023
We switched to IMDSV2 by default in COSA so let's update our call here.
coreos/coreos-assembler#3607
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
We switched to IMDSV2 by default in COSA so let's update our call here.
coreos/coreos-assembler#3607
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
see coreos/coreos-assembler#3607

With the above PR, cosa's image-default.yaml adds 3 configuration
fields. The defaults provided differ from before. Overide the new
configuration fields to maintain old defaults.
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
We switched to IMDSV2 by default in COSA so let's update our call here.
coreos/coreos-assembler#3607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants