MCPcopy
hub / github.com/kubernetes/client-go / Token

Method Token

plugin/pkg/client/auth/gcp/gcp.go:214–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212}
213
214func (t *cachedTokenSource) Token() (*oauth2.Token, error) {
215 tok := t.cachedToken()
216 if tok.Valid() && !tok.Expiry.IsZero() {
217 return tok, nil
218 }
219 tok, err := t.source.Token()
220 if err != nil {
221 return nil, err
222 }
223 cache := t.update(tok)
224 if t.persister != nil {
225 if err := t.persister.Persist(cache); err != nil {
226 klog.V(4).Infof("Failed to persist token: %v", err)
227 }
228 }
229 return tok, nil
230}
231
232func (t *cachedTokenSource) cachedToken() *oauth2.Token {
233 t.lk.Lock()

Callers

nothing calls this directly

Calls 4

cachedTokenMethod · 0.95
updateMethod · 0.95
TokenMethod · 0.65
PersistMethod · 0.65

Tested by

no test coverage detected