Skip to content
Open
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
25 changes: 25 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package utils

import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/hashicorp/go-version"
Expand All @@ -27,6 +28,7 @@ import (
"io/ioutil"
"k8s.io/client-go/tools/clientcmd"
"net"
"net/http"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -338,6 +340,7 @@ func RetrieveVSLFromVeleroBSLs(params map[string]interface{}, bslName string, co
params["s3ForcePathStyle"] = backupStorageLocation.Spec.Config["s3ForcePathStyle"]
params["s3Url"] = backupStorageLocation.Spec.Config["s3Url"]
params["profile"] = backupStorageLocation.Spec.Config["profile"]
params["insecureSkipTLSVerify"] = backupStorageLocation.Spec.Config["insecureSkipTLSVerify"]

if backupStorageLocation.Spec.ObjectStorage.CACert != nil {
params["caCert"] = string(backupStorageLocation.Spec.ObjectStorage.CACert)
Expand Down Expand Up @@ -403,6 +406,28 @@ func GetS3PETMFromParamsMap(params map[string]interface{}, logger logrus.FieldLo
}
}

insecureSkipTLSVerify, ok := GetStringFromParamsMap(params, "insecureSkipTLSVerify", logger)
if ok {
if GetBool(insecureSkipTLSVerify, false) {
defaultTransport := http.DefaultTransport.(*http.Transport)
sess.Config.HTTPClient = &http.Client{
// Copied from net/http
Transport: &http.Transport{
Proxy: defaultTransport.Proxy,
DialContext: defaultTransport.DialContext,
MaxIdleConns: defaultTransport.MaxIdleConns,
IdleConnTimeout: defaultTransport.IdleConnTimeout,
TLSHandshakeTimeout: defaultTransport.TLSHandshakeTimeout,
ExpectContinueTimeout: defaultTransport.ExpectContinueTimeout,
// Set insecureSkipVerify true
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
}
}

prefix, ok := params["prefix"].(string)
if !ok {
prefix = constants.DefaultS3RepoPrefix
Expand Down