lib/promscrape/discovery/kubernetes: reuse a client for empty api_server inside different jobs

This commit is contained in:
Aliaksandr Valialkin 2020-04-20 17:07:02 +03:00
parent d5b38eeac4
commit 81481abaa9

View file

@ -57,6 +57,10 @@ func getAPIResponse(cfg *APIConfig, role, path string) ([]byte, error) {
}
func getHostClient(apiServer string, ac *promauth.Config) (*hcValue, error) {
if len(apiServer) == 0 {
// ac is ignored when apiServer should be auto-discovered when running inside k8s pod.
ac = nil
}
k := hcKey{
apiServer: apiServer,
ac: ac,