Azure / kubelogin

A Kubernetes credential (exec) plugin implementing azure authentication

Home Page:https://azure.github.io/kubelogin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`get-token --login azurecli` should be fast when a local token exists

enj opened this issue · comments

Currently it takes 500ms to get a locally cached token when --login azurecli is used:

$ time kubelogin get-token --login azurecli --server-id _val_ 1> /dev/null
real	0m0.508s
user	0m0.223s
sys	0m0.122s

This is likely caused by the token cache being disabled for azurecli in #142 (to address #137). Instead of disabling caching altogether, I propose a middle ground - cache azurecli tokens for 10s (which the same length as the Kube API server's internal token cache). This will keep the majority of kubectl calls from being slow.

Locally I did git revert 7252d376 to drop 7252d37 and now calls are 10x faster:

$ time kubelogin get-token --login azurecli --server-id _val_ 1> /dev/null

real	0m0.061s
user	0m0.016s
sys	0m0.022s

I need faster requests for tab completion, so I hope this can be fixed.