Loading pkg/s3/client.go +24 −10 Original line number Diff line number Diff line Loading @@ -3,8 +3,11 @@ package s3 import ( "bytes" "context" "crypto/tls" "fmt" "net/http" "net/url" "strconv" "sync/atomic" "github.com/golang/glog" Loading @@ -29,6 +32,7 @@ type Config struct { Region string Endpoint string Mounter string Insecure bool } type FSMeta struct { Loading @@ -52,7 +56,15 @@ func NewClient(cfg *Config) (*s3Client, error) { if u.Port() != "" { endpoint = u.Hostname() + ":" + u.Port() } var transport = &http.Transport{} if client.Config.Insecure { tlsConfig := &tls.Config{} tlsConfig.InsecureSkipVerify = true transport.TLSClientConfig = tlsConfig } minioClient, err := minio.New(endpoint, &minio.Options{ Transport: transport, Creds: credentials.NewStaticV4(client.Config.AccessKeyID, client.Config.SecretAccessKey, ""), Region: client.Config.Region, Secure: ssl, Loading @@ -66,6 +78,7 @@ func NewClient(cfg *Config) (*s3Client, error) { } func NewClientFromSecret(secret map[string]string) (*s3Client, error) { insecure, _ := strconv.ParseBool(secret["insecure"]) return NewClient(&Config{ AccessKeyID: secret["accessKeyID"], SecretAccessKey: secret["secretAccessKey"], Loading @@ -73,6 +86,7 @@ func NewClientFromSecret(secret map[string]string) (*s3Client, error) { Endpoint: secret["endpoint"], // Mounter is set in the volume preferences, not secrets Mounter: "", Insecure: insecure, }) } Loading Loading
pkg/s3/client.go +24 −10 Original line number Diff line number Diff line Loading @@ -3,8 +3,11 @@ package s3 import ( "bytes" "context" "crypto/tls" "fmt" "net/http" "net/url" "strconv" "sync/atomic" "github.com/golang/glog" Loading @@ -29,6 +32,7 @@ type Config struct { Region string Endpoint string Mounter string Insecure bool } type FSMeta struct { Loading @@ -52,7 +56,15 @@ func NewClient(cfg *Config) (*s3Client, error) { if u.Port() != "" { endpoint = u.Hostname() + ":" + u.Port() } var transport = &http.Transport{} if client.Config.Insecure { tlsConfig := &tls.Config{} tlsConfig.InsecureSkipVerify = true transport.TLSClientConfig = tlsConfig } minioClient, err := minio.New(endpoint, &minio.Options{ Transport: transport, Creds: credentials.NewStaticV4(client.Config.AccessKeyID, client.Config.SecretAccessKey, ""), Region: client.Config.Region, Secure: ssl, Loading @@ -66,6 +78,7 @@ func NewClient(cfg *Config) (*s3Client, error) { } func NewClientFromSecret(secret map[string]string) (*s3Client, error) { insecure, _ := strconv.ParseBool(secret["insecure"]) return NewClient(&Config{ AccessKeyID: secret["accessKeyID"], SecretAccessKey: secret["secretAccessKey"], Loading @@ -73,6 +86,7 @@ func NewClientFromSecret(secret map[string]string) (*s3Client, error) { Endpoint: secret["endpoint"], // Mounter is set in the volume preferences, not secrets Mounter: "", Insecure: insecure, }) } Loading