Skip to content

Commit 955072d

Browse files
committed
openstack: pass through InsecureSkipVerify into openstack components
1 parent 5b7ecd6 commit 955072d

6 files changed

Lines changed: 22 additions & 2 deletions

File tree

dnsprovider/pkg/dnsprovider/providers/openstack/designate/designate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func newDesignate(_ io.Reader) (*Interface, error) {
6363
klog.V(4).Infof("Using user-agent %s", ua.Join())
6464

6565
tlsconfig := &tls.Config{}
66-
tlsconfig.InsecureSkipVerify = true
66+
tlsconfig.InsecureSkipVerify = oc.GetInsecureSkipVerify()
6767
transport := &http.Transport{TLSClientConfig: tlsconfig}
6868
provider.HTTPClient = http.Client{
6969
Transport: transport,

nodeup/pkg/bootstrap/install.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func (i *Installation) buildEnvFile() *nodetasks.InstallFile {
108108
"OS_REGION_NAME",
109109
"OS_APPLICATION_CREDENTIAL_ID",
110110
"OS_APPLICATION_CREDENTIAL_SECRET",
111+
"OS_CACERT_INSECURE",
111112
} {
112113
envVars[envVar] = os.Getenv(envVar)
113114
}

nodeup/pkg/model/protokube.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ func (t *ProtokubeBuilder) buildEnvFile() (*nodetasks.File, error) {
268268
"OS_REGION_NAME",
269269
"OS_APPLICATION_CREDENTIAL_ID",
270270
"OS_APPLICATION_CREDENTIAL_SECRET",
271+
"OS_CACERT_INSECURE",
271272
} {
272273
envVars[envVar] = os.Getenv(envVar)
273274
}

pkg/model/resources/nodeup.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,11 @@ func buildEnvironmentVariables(cluster *kops.Cluster, ig *kops.InstanceGroup) (m
385385
)
386386
}
387387

388+
// Map our Insecure Skip Verify setting
389+
if cluster.Spec.CloudProvider.Openstack != nil && fi.ValueOf(cluster.Spec.CloudProvider.Openstack.InsecureSkipVerify) {
390+
os.Setenv("OS_CACERT_INSECURE", "true")
391+
}
392+
388393
// credentials needed always in control-plane and when using gossip also in nodes
389394
passEnvs := false
390395
if ig.IsControlPlane() || cluster.UsesLegacyGossip() {

util/pkg/env/standard.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ func BuildSystemComponentEnvVars(spec *kops.ClusterSpec) EnvVars {
6464
vars.addEnvVariableIfExist("OS_APPLICATION_CREDENTIAL_ID")
6565
vars.addEnvVariableIfExist("OS_APPLICATION_CREDENTIAL_SECRET")
6666

67+
// Map our Insecure Skip Verify setting
68+
if spec.CloudProvider.Openstack != nil && fi.ValueOf(spec.CloudProvider.Openstack.InsecureSkipVerify) {
69+
vars["OS_CACERT_INSECURE"] = "true"
70+
}
71+
6772
// Digital Ocean related values.
6873
vars.addEnvVariableIfExist("DIGITALOCEAN_ACCESS_TOKEN")
6974

util/pkg/vfs/swiftfs.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func NewSwiftClient(ctx context.Context) (*gophercloud.ServiceClient, error) {
6262
klog.V(4).Infof("Using user-agent %s", ua.Join())
6363

6464
tlsconfig := &tls.Config{}
65-
tlsconfig.InsecureSkipVerify = true
65+
tlsconfig.InsecureSkipVerify = config.GetInsecureSkipVerify()
6666
transport := &http.Transport{TLSClientConfig: tlsconfig}
6767
pc.HTTPClient = http.Client{
6868
Transport: transport,
@@ -150,6 +150,14 @@ func (oc OpenstackConfig) GetCredential() (gophercloud.AuthOptions, error) {
150150
return env, nil
151151
}
152152

153+
func (oc OpenstackConfig) GetInsecureSkipVerify() bool {
154+
s := os.Getenv("OS_CACERT_INSECURE")
155+
if s == "true" || s == "1" {
156+
return true
157+
}
158+
return false
159+
}
160+
153161
func (oc OpenstackConfig) GetRegion() (string, error) {
154162
var region string
155163
if region = os.Getenv("OS_REGION_NAME"); region != "" {

0 commit comments

Comments
 (0)