Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions pkg/cli/login/loginoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (o *LoginOptions) getClientConfig() (*restclient.Config, error) {
}
o.Server = serverNormalized
clientConfig.Host = o.Server
clientConfig.Insecure = o.InsecureTLS
clientConfig.Insecure = o.InsecureTLS || hasExistingInsecureCluster(*clientConfig, *o.StartingKubeConfig)

if !o.InsecureTLS {
// use specified CA or find existing CA
Expand Down Expand Up @@ -188,9 +188,7 @@ func (o *LoginOptions) getClientConfig() (*restclient.Config, error) {
// connection or if we already have a cluster stanza that tells us to
// connect to this particular server insecurely
case x509.UnknownAuthorityError, x509.HostnameError, x509.CertificateInvalidError:
if o.InsecureTLS ||
hasExistingInsecureCluster(*clientConfig, *o.StartingKubeConfig) ||
promptForInsecureTLS(o.In, o.Out, err) {
if promptForInsecureTLS(o.In, o.Out, err) {
clientConfig.Insecure = true
clientConfig.CAFile = ""
clientConfig.CAData = nil
Expand Down