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

Unable to override throughput requirement when building gp2 AMI builds #1102

Closed
abhay-krishna opened this issue Mar 10, 2023 · 2 comments
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@abhay-krishna
Copy link
Contributor

abhay-krishna commented Mar 10, 2023

The packer.json for AMI builds has a throughput field in the block device mappings section with a default value of 125, but this field is valid only for gp3 volumes. I tried building an Ubuntu gp2 AMI by overriding the throughput from a different JSON var-file (ami.json below) by setting it to "" or even null , but in both cases the build failed with the following error message.

Throughput is not available for device /dev/sda1

Only when I removed that field from image-builder's packer.json did the build proceed past this point. But removal also doesn't seem to be a permanent solution because now there's no way of passing throughput in if I do want to build a gp3 volume. Should I be overriding the default value and/or presence of throughput field in some other way?

What steps did you take and what happened:

PACKER_FLAGS="-force" PACKER_LOG=1 PACKER_LOG_PATH=$PWD/packer.log PACKER_VAR_FILES=$PWD/ami.json make -C $PWD/image-builder/images/capi build-ami-ubuntu-2004

Here is my var-file with some override vars

// ami.json
{
  "ami_filter_name": "ubuntu/images/*ubuntu-focal-20.04-amd64-server-*",
  "ami_filter_owners": "amazon",
  "ami_regions": "us-east-1",
  "aws_region": "us-east-1",
  "builder_instance_type": "t3.large",
  "root_device_name": "/dev/sda1",
  "throughput": "",
  "volume_size": "16",
  "volume_type": "gp2",
}

What did you expect to happen:
I am able to override throughput to a non-empty/non-null value and use it to build a gp3 AMI. Similarly, I expected that setting throughput to "" or null in the ami.json would nullify the throughput input and successfully build a gp2 (or any non-gp3, for that matter) AMI.

Maybe I am doing something wrong or this truly is a limitation. Appreciate any help on this!

Environment:
I built this on an Ubuntu 20.04 EC2 instance.

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 10, 2023
@kkeshavamurthy
Copy link
Member

@abhay-krishna Looks like throughput variable should only be provided if gp3 volumes are being used.
If you'd like to use gp2, I suggest you run a jq command to remove the throughput var from the builder config. Since packer does not allow conditionals in the builder config, incompatibilities like this are quite common. There are similar issues for vsphere export, azure custom rg etc.

@abhay-krishna
Copy link
Contributor Author

abhay-krishna commented Mar 10, 2023

Thanks @kkeshavamurthy, that makes sense, removing using jq is my current workaround, so I will just script that. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants