Bug 1268100

Summary: [RFE] oc whoami -t equivalent for service accounts
Product: OpenShift Container Platform Reporter: Erik M Jacobs <ejacobs>
Component: apiserver-authAssignee: Steve Kuznetsov <skuznets>
Status: CLOSED CURRENTRELEASE QA Contact: Chuan Yu <chuyu>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.0.0CC: aos-bugs, dmcphers, jokerman, mmccomas, pweil, tdawson
Target Milestone: ---   
Target Release: 3.2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-22 23:24:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Erik M Jacobs 2015-10-01 20:14:59 UTC
This is kinda complicated:

oc get sa/WHATEVER -n SOMETHINGELSE --template='{{range .secrets}}{{ .name }} {{end}}' | xargs -n 1 oc get secret --template='{{ if .data.token }}{{ .data.token }}{{end}}' | base64 -d


I'm also guessing most people wouldn't know how to do that without coaching. Getting a token for a service account seems like something pretty common to do for providing external API access into projects, etc.

Comment 2 Steve Kuznetsov 2016-02-16 15:31:50 UTC
Work on creating new tokens for service accounts and retrieving current tokens from service accounts in progress here: https://github.com/openshift/origin/pull/6941

Comment 4 Steve Kuznetsov 2016-10-31 14:15:26 UTC
This work has been long finished, this feature is in Origin releases now.

Comment 5 Chuan Yu 2016-11-02 01:26:00 UTC
Verified with openshift v3.4.0.18+ada983f.
The `oc sa get-token SA-NAME` and `oc sa new-token SA-NAME` could get and create new token for the SA.