Use 'alias' as kube-context username when arg is passed #5413
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thealias
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.