rajatjindal / kubectl-whoami

This plugin gets the subject name using the effective kubeconfig
Apache License 2.0
120 stars 14 forks source link

Display group info #15

Closed infa-mseelam closed 2 years ago

infa-ddeore commented 2 years ago

closes #14

infa-ddeore commented 2 years ago

tested this change on EKS, GKE and AKS clusters, it shows groups info as well as ARN details if present

sample outputs as below

EKS:

User:   userName
Groups:
    system:masters
    system:authenticated
ARN:
    arn:aws:sts::123456789:assumed-role/<aws-Role-Name>/<aws-user>

GKE:

User:   user@email.com
Groups:
    user-group1@email.com
    user-group2@email.com
    user-group3@email.com
    system:authenticated

AKS:

User:   user@email.com
Groups:
    sdbd146d-1234-lkfg-df56-1358tdyjf234
    ftwwf097-9845-92kj-294j-aerhg4557lmd
    sfty0942-rlew-2345-6jdl-678647123ger
        system:authenticated
infa-ddeore commented 2 years ago

@rajatjindal could you approve this PR to fix #14 issue?

rajatjindal commented 2 years ago

thanks a lot for the PR.

to ensure it is backward compatible, can we hide this new info behind a flag (or environment variable).

infa-mseelam commented 2 years ago

Sure @rajatjindal I will add a new flag and even variable and let you know.

infa-mseelam commented 2 years ago

@rajatjindal added the arg called "--all" to display user, group, and ARN info. The app behaves the same as previous If the user doesn't specify any flag. Please review and approve.

infa-ddeore commented 2 years ago

@rajatjindal README is also updated with --all option instructions, I have also tested and verified that it works as expected, i.e. shows only user name as before.

With --all option it shows the similar output that I have mentioned in my sample output comment above

rajatjindal commented 2 years ago

thanks again for the PR