mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	mw/kubernetes: revert if-else for health (#970)
Do the return early and dedent the rest of the function.
This commit is contained in:
		| @@ -154,7 +154,15 @@ func (k *Kubernetes) getClientConfig() (*rest.Config, error) { | ||||
| 	overrides := &clientcmd.ConfigOverrides{} | ||||
| 	clusterinfo := clientcmdapi.Cluster{} | ||||
| 	authinfo := clientcmdapi.AuthInfo{} | ||||
| 	if len(k.APIServerList) > 0 { | ||||
|  | ||||
| 	if len(k.APIServerList) == 0 { | ||||
| 		cc, err := rest.InClusterConfig() | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 		return cc, err | ||||
| 	} | ||||
|  | ||||
| 	endpoint := k.APIServerList[0] | ||||
| 	if len(k.APIServerList) > 1 { | ||||
| 		// Use a random port for api proxy, will get the value later through listener.Addr() | ||||
| @@ -210,13 +218,7 @@ func (k *Kubernetes) getClientConfig() (*rest.Config, error) { | ||||
| 		endpoint = fmt.Sprintf("http://%s", listener.Addr()) | ||||
| 	} | ||||
| 	clusterinfo.Server = endpoint | ||||
| 	} else { | ||||
| 		cc, err := rest.InClusterConfig() | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 		return cc, err | ||||
| 	} | ||||
|  | ||||
| 	if len(k.APICertAuth) > 0 { | ||||
| 		clusterinfo.CertificateAuthority = k.APICertAuth | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user