mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Use https when Insecure is selected.
This commit is contained in:
parent
9f2750694c
commit
dd3c85be09
@ -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"
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user