Commit ec3b2c44 authored by Dr. Stefan Schimanski's avatar Dr. Stefan Schimanski

Fix logic in loopback client creation

parent 527d502b
...@@ -31,13 +31,17 @@ import ( ...@@ -31,13 +31,17 @@ import (
// NewSelfClientConfig returns a clientconfig which can be used to talk to this apiserver. // NewSelfClientConfig returns a clientconfig which can be used to talk to this apiserver.
func NewSelfClientConfig(secureServingInfo *SecureServingInfo, insecureServingInfo *ServingInfo, token string) (*restclient.Config, error) { func NewSelfClientConfig(secureServingInfo *SecureServingInfo, insecureServingInfo *ServingInfo, token string) (*restclient.Config, error) {
if cfg, err := secureServingInfo.NewSelfClientConfig(token); err != nil || cfg != nil { cfg, err := secureServingInfo.NewSelfClientConfig(token)
if cfg != nil && err == nil {
return cfg, nil
}
if err != nil {
if insecureServingInfo == nil { if insecureServingInfo == nil {
// be fatal if insecure port is not available // be fatal if insecure port is not available
return cfg, err return nil, err
} else {
glog.Warningf("Failed to create secure local client, falling back to insecure local connection: %v", err)
} }
glog.Warningf("Failed to create secure local client, falling back to insecure local connection: %v", err)
} }
if cfg, err := insecureServingInfo.NewSelfClientConfig(token); err != nil || cfg != nil { if cfg, err := insecureServingInfo.NewSelfClientConfig(token); err != nil || cfg != nil {
return cfg, err return cfg, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment