Loading cmd/s3driver/main.go +2 −2 Original line number Diff line number Diff line Loading @@ -40,14 +40,14 @@ var ( func main() { flag.Parse() cr := &s3.Credentials{ cfg := &s3.Config{ AccessKeyID: *accessKeyID, SecretAccessKey: *secretAccessKey, Endpoint: *s3endpoint, Region: *region, } driver, err := s3.NewS3(*nodeID, *endpoint, cr) driver, err := s3.NewS3(*nodeID, *endpoint, cfg) if err != nil { log.Fatal(err) } Loading pkg/s3/credentials.go→pkg/s3/config.go +2 −2 Original line number Diff line number Diff line package s3 // Credentials holds s3 credentials and parameters type Credentials struct { // Config holds values to configure the driver type Config struct { AccessKeyID string SecretAccessKey string Region string Loading pkg/s3/goofys.go +7 −7 Original line number Diff line number Diff line Loading @@ -11,11 +11,11 @@ import ( const defaultRegion = "us-east-1" func goofysMount(bucket string, cr *Credentials, targetPath string) error { cfg := &goofys.Config{ func goofysMount(bucket string, cfg *Config, targetPath string) error { goofysCfg := &goofys.Config{ MountPoint: targetPath, Endpoint: cr.Endpoint, Region: cr.Region, Endpoint: cfg.Endpoint, Region: cfg.Region, DirMode: 0755, FileMode: 0644, MountOptions: map[string]string{ Loading @@ -25,10 +25,10 @@ func goofysMount(bucket string, cr *Credentials, targetPath string) error { if cfg.Endpoint != "" { cfg.Region = defaultRegion } os.Setenv("AWS_ACCESS_KEY_ID", cr.AccessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", cr.SecretAccessKey) os.Setenv("AWS_ACCESS_KEY_ID", cfg.AccessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", cfg.SecretAccessKey) _, _, err := goofys.Mount(context.Background(), bucket, cfg) _, _, err := goofys.Mount(context.Background(), bucket, goofysCfg) if err != nil { return fmt.Errorf("Error mounting via goofys: %s", err) Loading pkg/s3/nodeserver.go +2 −2 Original line number Diff line number Diff line Loading @@ -87,11 +87,11 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis mounter, exists := attrib[mounterKey] if !exists || mounter == s3fsMounter { if err := s3fsMount(volumeID, ns.s3.cr, targetPath); err != nil { if err := s3fsMount(volumeID, ns.s3.cfg, targetPath); err != nil { return nil, err } } else if mounter == goofysMounter { if err := goofysMount(volumeID, ns.s3.cr, targetPath); err != nil { if err := goofysMount(volumeID, ns.s3.cfg, targetPath); err != nil { return nil, err } } else { Loading pkg/s3/s3-client.go +6 −6 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ const ( ) type s3Client struct { cr *Credentials cfg *Config minio *minio.Client } Loading @@ -21,11 +21,11 @@ type bucketMetadata struct { CapacityBytes int64 } func newS3Client(cr *Credentials) (*s3Client, error) { func newS3Client(cfg *Config) (*s3Client, error) { var client = &s3Client{} client.cr = cr u, err := url.Parse(client.cr.Endpoint) client.cfg = cfg u, err := url.Parse(client.cfg.Endpoint) if err != nil { return nil, err } Loading @@ -34,7 +34,7 @@ func newS3Client(cr *Credentials) (*s3Client, error) { if u.Port() != "" { endpoint = u.Hostname() + ":" + u.Port() } minioClient, err := minio.New(endpoint, client.cr.AccessKeyID, client.cr.SecretAccessKey, ssl) minioClient, err := minio.New(endpoint, client.cfg.AccessKeyID, client.cfg.SecretAccessKey, ssl) if err != nil { return nil, err } Loading @@ -47,7 +47,7 @@ func (client *s3Client) bucketExists(bucketName string) (bool, error) { } func (client *s3Client) createBucket(bucketName string) error { return client.minio.MakeBucket(bucketName, client.cr.Region) return client.minio.MakeBucket(bucketName, client.cfg.Region) } func (client *s3Client) removeBucket(bucketName string) error { Loading Loading
cmd/s3driver/main.go +2 −2 Original line number Diff line number Diff line Loading @@ -40,14 +40,14 @@ var ( func main() { flag.Parse() cr := &s3.Credentials{ cfg := &s3.Config{ AccessKeyID: *accessKeyID, SecretAccessKey: *secretAccessKey, Endpoint: *s3endpoint, Region: *region, } driver, err := s3.NewS3(*nodeID, *endpoint, cr) driver, err := s3.NewS3(*nodeID, *endpoint, cfg) if err != nil { log.Fatal(err) } Loading
pkg/s3/credentials.go→pkg/s3/config.go +2 −2 Original line number Diff line number Diff line package s3 // Credentials holds s3 credentials and parameters type Credentials struct { // Config holds values to configure the driver type Config struct { AccessKeyID string SecretAccessKey string Region string Loading
pkg/s3/goofys.go +7 −7 Original line number Diff line number Diff line Loading @@ -11,11 +11,11 @@ import ( const defaultRegion = "us-east-1" func goofysMount(bucket string, cr *Credentials, targetPath string) error { cfg := &goofys.Config{ func goofysMount(bucket string, cfg *Config, targetPath string) error { goofysCfg := &goofys.Config{ MountPoint: targetPath, Endpoint: cr.Endpoint, Region: cr.Region, Endpoint: cfg.Endpoint, Region: cfg.Region, DirMode: 0755, FileMode: 0644, MountOptions: map[string]string{ Loading @@ -25,10 +25,10 @@ func goofysMount(bucket string, cr *Credentials, targetPath string) error { if cfg.Endpoint != "" { cfg.Region = defaultRegion } os.Setenv("AWS_ACCESS_KEY_ID", cr.AccessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", cr.SecretAccessKey) os.Setenv("AWS_ACCESS_KEY_ID", cfg.AccessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", cfg.SecretAccessKey) _, _, err := goofys.Mount(context.Background(), bucket, cfg) _, _, err := goofys.Mount(context.Background(), bucket, goofysCfg) if err != nil { return fmt.Errorf("Error mounting via goofys: %s", err) Loading
pkg/s3/nodeserver.go +2 −2 Original line number Diff line number Diff line Loading @@ -87,11 +87,11 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis mounter, exists := attrib[mounterKey] if !exists || mounter == s3fsMounter { if err := s3fsMount(volumeID, ns.s3.cr, targetPath); err != nil { if err := s3fsMount(volumeID, ns.s3.cfg, targetPath); err != nil { return nil, err } } else if mounter == goofysMounter { if err := goofysMount(volumeID, ns.s3.cr, targetPath); err != nil { if err := goofysMount(volumeID, ns.s3.cfg, targetPath); err != nil { return nil, err } } else { Loading
pkg/s3/s3-client.go +6 −6 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ const ( ) type s3Client struct { cr *Credentials cfg *Config minio *minio.Client } Loading @@ -21,11 +21,11 @@ type bucketMetadata struct { CapacityBytes int64 } func newS3Client(cr *Credentials) (*s3Client, error) { func newS3Client(cfg *Config) (*s3Client, error) { var client = &s3Client{} client.cr = cr u, err := url.Parse(client.cr.Endpoint) client.cfg = cfg u, err := url.Parse(client.cfg.Endpoint) if err != nil { return nil, err } Loading @@ -34,7 +34,7 @@ func newS3Client(cr *Credentials) (*s3Client, error) { if u.Port() != "" { endpoint = u.Hostname() + ":" + u.Port() } minioClient, err := minio.New(endpoint, client.cr.AccessKeyID, client.cr.SecretAccessKey, ssl) minioClient, err := minio.New(endpoint, client.cfg.AccessKeyID, client.cfg.SecretAccessKey, ssl) if err != nil { return nil, err } Loading @@ -47,7 +47,7 @@ func (client *s3Client) bucketExists(bucketName string) (bool, error) { } func (client *s3Client) createBucket(bucketName string) error { return client.minio.MakeBucket(bucketName, client.cr.Region) return client.minio.MakeBucket(bucketName, client.cfg.Region) } func (client *s3Client) removeBucket(bucketName string) error { Loading