-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add token cache for MFA users and credentials #4194
Conversation
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, although have a second pair of eyes for review 👀 👍🏻
@Callisto13 Are you okay now with merging this? |
The test still has that duplication in it, should that be there? otherwise yeh all good |
@Callisto13 Wait, what duplication? I thought you mean the IsExpire check which was duplicated. :D The file content checking is not. It's checking that the file contains whatever the |
# This works
aws s3 ls
....
....bunch of info...
# Right after try to create cluster prompted for MFA
eksctl create cluster
Assume Role MFA token code:
This is no longer working by the way. @Skarlso |
You have to explicitly enable caching like this:
If you do that, does it still ask? |
@ckdarby ^^ |
@Skarlso It doesn't look like any of the AWS sts is carrying forward anymore.
|
That is super strange. Can you check if the aws cli is working? It looks like it can't authenticate in the first place so it's unable to cache the credentials. |
@Skarlso Yes, I am able to do the normal |
No, I mean, can you try the aws cli WITH mfa? |
Oh, right, you are saying that you are able to use |
rm -fr ~/.aws/cli/cache/
export AWS_PROFILE=st4
aws sts get-caller-identity
Enter MFA code for arn:aws:iam::**********:mfa/cdarby:
## successful sts output {userId, Account, Arn}
export EKSCTL_ENABLE_CREDENTIAL_CACHE=1
eksctl create cluster
2022-01-10 15:39:26 [!] Cache file /home/ckdarby/.eksctl/cache/credentials.yaml does not exist.
2022-01-10 15:39:26 [ℹ] No cached credential available. Refreshing...
Assume Role MFA token code: 🥲 |
And if you try again now, it's still not working? |
@Skarlso Correct. |
Okay, we updated the aws go-sdk pretty recently. :/ They might have messed something up. I will have to take a look at that. In the mean time, maybe pop over and see in recent issue if there is something about this. It's rather late in my TZ so I'm gonna drop off and take a look this tomorrow. Thanks for telling me. |
Description
NOTE: Going to re-write this whole thing. We don't need a lock that is this complex. We don't handle multiple creds, only the current one for example. And the mocking can be done a lot cleaner I think.
NOTE2: Significantly simplified the caching. We don't need locks as eksctl is not expected to be called concurrently. And we don't need role / cluster caching. We only cache per profile. I removed all the mocks, because I want to test with temporary filesystem rather than os mocks.
Closes #4052
TODO:
Checklist
README.md
, or theuserdocs
directory)area/nodegroup
) and kind (e.g.kind/improvement
)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯