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

Use 'alias' as kube-context username when arg is passed #5413

Conversation

sarmad-abualkaz
Copy link

Issue #, if available: #4079

Description of changes:
We have a similar issue to #4079, whereby admin users want to perform tests on eks clusters with both developer-like and admin permissions. We use alias's as our way to distinguish between contexts.

With current setup, the following two commands executed one after the other would overwrite the user entry since its sharing the same user-name (i.e. the cluster ARN is always the user-name):
aws eks update-kubeconfig --name mycluster --role-arn arn:aws:iam::123456789123:role/k8s-admin --alias mycluster-admin
aws eks update-kubeconfig --name mycluster --role-arn arn:aws:iam::123456789123:role/k8s-dev --alias mycluster-dev

I feel like an easy win would be to use the --alias name as the user-name for the context, since the alias is anyway being used as the kube-context name. With this change if the alias arg isn't passed, the user-name would continue to be named as before, i.e. cluster-ARN.

@swetashre, since the issue is assigned to you, I was wondering what you think of this approach?

Thanks.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2020

Codecov Report

Merging #5413 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5413   +/-   ##
========================================
  Coverage    94.06%   94.06%           
========================================
  Files          190      190           
  Lines        14757    14758    +1     
========================================
+ Hits         13881    13882    +1     
  Misses         876      876           
Impacted Files Coverage Δ
awscli/customizations/eks/update_kubeconfig.py 97.95% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bdbf05...1ee6ee4. Read the comment docs.

@kdaily kdaily added eks-kubeconfig pr:needs-review This PR needs a review from a Member. labels Oct 20, 2020
@kdaily kdaily added the customization Issues related to CLI customizations (located in /awscli/customizations) label Nov 12, 2020
@sarmad-abualkaz
Copy link
Author

I'm just curious, is anyone actually looking at this PR?

The PR has been open for more than 2 years and I have not received any feedback. If I'm being honest, I've never had such a bad 'open-source' collab experience.

If this is not useful or no longer required, let me know and I can close it. If you have some feedback, also let me know and I can improve on the changes.

Thanks

@splichy
Copy link

splichy commented Jan 4, 2023

@kdaily @nateprewitt can you look at this please?

@yuxiang-zhang
Copy link
Contributor

Kindly note that this feature has been added with the --user-alias flag, available since v1.27.98 and v2.11.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customization Issues related to CLI customizations (located in /awscli/customizations) eks-kubeconfig pr:needs-review This PR needs a review from a Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants