Skip to content

Commit

Permalink
magnum: add an option to create insecure TLS connections
Browse files Browse the repository at this point in the history
We use self-signed certificates in the openstack for test purposes.
It is not always easy to bring a CA certificate. And so we ran into
the problem that there is no option to not check the validity of the
certificate in the autoscaler.

This patch adds a new option for the magnum plugin: tls-insecure

Signed-off-by: Anton Kurbatov <[email protected]>
  • Loading branch information
antonkurbatov committed Sep 25, 2022
1 parent 70efe28 commit 4491403
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type Config struct {
DomainName string `gcfg:"domain-name"`
Region string
CAFile string `gcfg:"ca-file"`
TLSInsecure string `gcfg:"tls-insecure"`
SecretName string `gcfg:"secret-name"`
SecretNamespace string `gcfg:"secret-namespace"`
}
Expand Down Expand Up @@ -169,15 +170,16 @@ func createProviderClient(cfg *Config, opts config.AutoscalingOptions) (*gopherc

klog.V(5).Infof("Using user-agent %q", userAgent.Join())

config := &tls.Config{}
config.InsecureSkipVerify = cfg.Global.TLSInsecure == "true"
if cfg.Global.CAFile != "" {
roots, err := certutil.NewPool(cfg.Global.CAFile)
if err != nil {
return nil, err
}
config := &tls.Config{}
config.RootCAs = roots
provider.HTTPClient.Transport = netutil.SetOldTransportDefaults(&http.Transport{TLSClientConfig: config})
}
provider.HTTPClient.Transport = netutil.SetOldTransportDefaults(&http.Transport{TLSClientConfig: config})

err = openstack.AuthenticateV3(provider, authOpts, gophercloud.EndpointOpts{})
if err != nil {
Expand Down

0 comments on commit 4491403

Please sign in to comment.