Skip to content

Conversation

@vr4manta
Copy link

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR enhances the dedicated host logic to verify that the tenancy is host if any of the dedicated host fields (hostAffinity, hostID, dynamic hosts) are set.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

In testing this feature in OCP, we came across configuration combinations that were working with AWS with CAPA but not as expected with CLI. If we test this directly with AWS cli, and setting only Affinity=default, we see it is not allowed:

prompt > AWS_PROFILE=saml aws ec2 run-instances --region us-east-2 \
    --image-id ami-0bc8dda494f111572 --count 1 \
    --instance-type m6i.xlarge --key-name huliu-testdns \
    --security-group-ids <value> \
    --subnet-id <value> \
    --placement Affinity=default

An error occurred (InvalidParameterCombination) when calling the RunInstances operation: The parameter affinity cannot be used without specifying a tenancy of 'host'

This confirms that Affinity requires Tenancy=host to be set as well. We should align with AWS's behavior, shouldn't we?

Special notes for your reviewer:

Checklist:

  • [X ] squashed commits
  • includes documentation
  • [X ] includes emoji in title
  • [X ] adds unit tests
  • adds or updates e2e tests

Release note:

Enhanced dedicated host logic to require tenancy=host when attempting to use dedicated hosts for instances.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Jan 15, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign fabriziopandini for approval. For more information see the Code Review Process.

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

Details 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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Jan 15, 2026
@k8s-ci-robot
Copy link
Contributor

Welcome @vr4manta!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-aws 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-aws has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 15, 2026
@k8s-ci-robot
Copy link
Contributor

Hi @vr4manta. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@rvanderp3
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 15, 2026
@damdo
Copy link
Member

damdo commented Jan 16, 2026

/assign @nrb

Copy link
Contributor

@nrb nrb left a comment

Choose a reason for hiding this comment

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

Overall this lgtm. One question that I have, but otherwise I'm 👍

},
wantError: false,
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

You'd mentioned something about 8 character host IDs also being valid - do we want to include a test case for that here too, or is that not relevant within CAPA since we're mostly passing values through?

Copy link
Author

Choose a reason for hiding this comment

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

In one of the earlier PRs, Joel Speed had mentioned we could add formatting validation. I think if we want to address that, we can do that via a different PR since this one is fixing an issue. My opinion is that the older 8 character hosts should really no longer exist after the transition from 2018. If someone is holding onto an older one that hasn't been migrated to new id format, what are the odds that it may not meet the requirements for running k8s clusters. For the unit tests, I think we can ignore adding tests for the format until we actually start validating for them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good, we can omit it until/unless we see it cause an actual problem.

@nrb
Copy link
Contributor

nrb commented Jan 16, 2026

/ok-to-test

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jan 16, 2026

@vr4manta: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-aws-test 21f603f link true /test pull-cluster-api-provider-aws-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@nrb
Copy link
Contributor

nrb commented Jan 16, 2026

/test pull-cluster-api-provider-aws-e2e-blocking

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants