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

fix: Use dynamic partition data source to determine DNS suffix for Karpenter EC2 pass role permission #3193

Merged
merged 2 commits into from
Oct 27, 2024

Conversation

joey100
Copy link
Contributor

@joey100 joey100 commented Oct 26, 2024

Description

Fix Karpenter module iam policy passrole to ec2 api bug. Related issue: #3190

Motivation and Context

The current iam:PassRole action condition only works for ec2.amazonaws.com, can't work for ec2.amazonaws.com.cn
If use karpenter module at AWS CN, it would throw the unauthorized error when Karpenter pods try to create new instances, the Karpenter iam role can't pass to Karpenter node iam role because of the ec2 api(ec2.amazonaws.com) is not correct.

Breaking Changes

No, it does not break backwards compatibility with the current major version.

How Has This Been Tested?

  • [Y] I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • [Y] I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@joey100 joey100 changed the title fix karpenter iam passrole to ec2 api bug, to support aws cn v20.26.0 fix karpenter iam passrole to ec2 api bug, to support aws cn Oct 26, 2024
@joey100 joey100 changed the title v20.26.0 fix karpenter iam passrole to ec2 api bug, to support aws cn fix v20.26.0 karpenter iam passrole to ec2 api bug, to support aws cn Oct 26, 2024
@joey100 joey100 changed the title fix v20.26.0 karpenter iam passrole to ec2 api bug, to support aws cn fix: v20.26.0 Karpenter iam passrole to ec2 api bug to support aws cn Oct 26, 2024
@joey100 joey100 changed the title fix: v20.26.0 Karpenter iam passrole to ec2 api bug to support aws cn fix: V20.26.0 Karpenter iam passrole to ec2 api bug to support aws cn Oct 26, 2024
@bryantbiggs bryantbiggs changed the title fix: V20.26.0 Karpenter iam passrole to ec2 api bug to support aws cn fix: Use dynamic partition data source to determine DNS suffix for Karpenter EC2 pass role permission Oct 27, 2024
@bryantbiggs bryantbiggs merged commit dea6c44 into terraform-aws-modules:master Oct 27, 2024
19 checks passed
antonbabenko pushed a commit that referenced this pull request Oct 27, 2024
## [20.26.1](v20.26.0...v20.26.1) (2024-10-27)

### Bug Fixes

* Use dynamic partition data source to determine DNS suffix for Karpenter EC2 pass role permission ([#3193](#3193)) ([dea6c44](dea6c44))
@antonbabenko
Copy link
Member

This PR is included in version 20.26.1 🎉

@Monster-Zhu
Copy link

I tested 20.26.1 in AWS CN region, unfortunately it failed. It only works when "ec2.amazonaws.com.cn" and "ec2.amazonaws.com" are both included in the AllowPassingInstanceRole statement.

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.

Karpenter failed to launch new EC2 instances due to controller IAM policy lacks support for China regions
4 participants