Skip to content

Commit

Permalink
dns: hack: new k8s client for each query
Browse files Browse the repository at this point in the history
 - rest.Config Timeout setting does not work right now [1]
 - number of connections will not increase along with newed client: they
   use a single connection always...

 [1] kubernetes/client-go#374 (comment)
  • Loading branch information
yousong committed Aug 25, 2018
1 parent ed2bf2e commit 5b12bdc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ func (r *SRegionDNS) getK8sServiceBackends(req *recordRequest) ([]string, error)
}

func (r *SRegionDNS) getK8sServicePods(namespace, name string) ([]v1.Pod, error) {
cli := r.K8sClient
cli, err := k8s.NewClientByFile(r.K8sConfigFile, nil)
if err != nil {
ylog.Errorf("Init kubernetes client error: %v", err)
return nil, err
}
svc, err := cli.CoreV1().Services(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return nil, err
Expand Down

0 comments on commit 5b12bdc

Please sign in to comment.