rajatjindal / kubectl-whoami

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

add output format option for json output #19

Closed larhauga closed 5 months ago

larhauga commented 2 years ago

Hi, thanks for creating this useful tool. I wanted to add this functionality that returns the output the status response of the tokenreview as json.

Is this something you would consider merging?

rajatjindal commented 2 years ago

if this is something you need, we can consider merging it. could you please ensure it is backward compatible by default?

larhauga commented 2 years ago

if this is something you need, we can consider merging it. could you please ensure it is backward compatible by default?

Would really appreciate that. This change should be backwards comparable by default. To use this new feature, you would have to run kubectl whoami -ojson, where you then get the output of tokenreview

{
  "authenticated": true,
  "user": {
    "username": "user",
    "uid": "uid",
    "groups": [
      "system:authenticated"
    ],
  },
  "audiences": [
    "https://kubernetes.default.svc"
  ]
}