diff --git a/pkg/client/helper.go b/pkg/client/helper.go index 176259014b6..e77ae7c26b0 100644 --- a/pkg/client/helper.go +++ b/pkg/client/helper.go @@ -231,7 +231,7 @@ func IsConfigTransportSecure(config *Config) bool { func defaultServerUrlFor(config *Config) (*url.URL, error) { version := defaultVersionFor(config) // TODO: move the default to secure when the apiserver supports TLS by default - defaultSecure := config.CertFile != "" + defaultSecure := config.CertFile != "" || config.Insecure host := config.Host if host == "" { host = "localhost" diff --git a/pkg/client/helper_test.go b/pkg/client/helper_test.go index d24296ffc40..e925b4d6e0f 100644 --- a/pkg/client/helper_test.go +++ b/pkg/client/helper_test.go @@ -76,6 +76,13 @@ func TestIsConfigTransportSecure(t *testing.T) { }, Secure: false, }, + { + Config: &Config{ + Host: "1.2.3.4:567", + Insecure: true, + }, + Secure: true, + }, } for _, testCase := range testCases { secure := IsConfigTransportSecure(testCase.Config)