-
Notifications
You must be signed in to change notification settings - Fork 983
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: "iam:PassRole" defined in CFN to work properly in AWS China #6839
Conversation
✅ Deploy Preview for karpenter-docs-prod ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
e232ebb
to
2b172a6
Compare
It looks like this is not enough to fix the problem, which is weird. Originally, with unmodified CFN I got to the point of NodeClaim being created, but stuck in unknown status due to Based on this result, I assumed that fix in CFN should work. However, after actually testing it from scratch with new CFN, I got result of EC2NodeClass stuck in unknown status, and controller contains the following in the log:
Is it possible that controller has some iam simulate policy calls with hardcoded "ec2.amazonaws.com" principal? I now created an issue for this, since it turned out to be not as simple fix as I hoped. |
Update: completely removing condition block fixes the problem. |
7db25d2
to
e1dba85
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/karpenter snapshot
Pull Request Test Coverage Report for Build 10624166177Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
@jonathan-innis Please, check my last 2 comments before merge. |
The principal that you are giving access to looks correct to me, so not sure why you would be running into issues with the PassRole. Please let me know but we can hold this PR until then |
It sounds like you were able to get this to work by just editing the condition key originally so I'm surprised if there's anything else that we need to do here. |
e1dba85
to
910a4a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/karpenter snapshot
Snapshot successfully published to
|
Yes, but this implies that we're already at the stage where NodeClaim is created, and EC2NodeClass was created and reconciled before, which for me only works with old condition (without .cn suffix), or without a condition at all. |
That sounds odd to me -- I'm surprised that that's the case |
I also don't understand the reason, but those are the test results. |
Yeah, I was going to try and track this down. Don't have an account at this point, but we'll see what I can do :) |
Hmmm -- you're right. I was able to repro with the same policy and I'm getting authorization failures. I'm following up with some folks on the EC2 team to see if we can track-down what's going on here. |
Ok, so I think I figured out what you're running into here: This seems to be failing because one call (
Something seems weird here (this definitely isn't behavior I would expect) so I'm following-up with some folks to see if I can make some headway. |
Ok, confirmed with the EC2 folks -- this is just "the way it is" and won't be changed now so we have to code in a conditional into the CF code to make sure both SPs get added in China. @artem-nefedov Is this something that you want to add? |
Potentially related: aws/aws-cdk#1282 |
@jonathan-innis I've updated PR accordingly. If it would make sense to also add service names from other AWS partitions (gov and such), I'm not aware what these are. |
@jonathan-innis My bad, I didn't notice the "conditional" part, let me change this |
140f403
to
441e058
Compare
I use a mapping instead of a condition because there could be more than 2 partitions. @jonathan-innis Check 441e058. Does this look correct to you? (other partitions may need to be added) EDIT: Nope, doesn't work, throws a syntax error. Is it even possible to use functions inside json that's passed as a string? If not, I don't see how this can be done conditionally. |
Ah, yeah, that's a good point -- we are doing a substitution at the top above that should allow us to replace everything in the string, but you would have to have the function resolve the value outside of that context. The good news is that we are close to completely removing the need to "stringify" this whole thing. The whole reason we had to is because you can't template permission policies around keys for I suspect that would also simplify the integration here as well. cc: @jigisha620 |
Would it be acceptable to put a hardcoded list for the time being in order to unblock AWS China users? |
441e058
to
140f403
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Yep, seems reasonable to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/karpenter snapshot
Snapshot successfully published to
|
@jonathan-innis for some reason, URLs for all releases (including new one v1.0.2) still return old policy without the list: |
Fixes #6843
Description
This change fixes
User <role> is not authorized to perform: iam:PassRole on resource...
error in AWS ChinaHow was this change tested?
Manually in aws-cn partition.
Does this change impact docs?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.