kubectl-whoami icon indicating copy to clipboard operation
kubectl-whoami copied to clipboard

add output format option for json output

Open larhauga opened this issue 2 years ago • 2 comments

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?

larhauga avatar Mar 17 '22 14:03 larhauga

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

rajatjindal avatar Apr 08 '22 07:04 rajatjindal

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"
  ]
}

larhauga avatar Apr 08 '22 07:04 larhauga