Skip to content

Commit

Permalink
object: remove default value us-east-1 as region from s3 client
Browse files Browse the repository at this point in the history
Currently s3 client apis sets default value as `us-east-1`. This patch
removes that, since if the region is not mention RGW server will pick
default zonegroup while handling the request.

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
  • Loading branch information
thotz committed Feb 16, 2022
1 parent 1d5b435 commit 572bbae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion deploy/examples/storageclass-bucket-delete.yaml
Expand Up @@ -9,7 +9,7 @@ reclaimPolicy: Delete
parameters:
objectStoreName: my-store
objectStoreNamespace: rook-ceph # namespace:cluster
region: us-east-1
# region: us-east-1
# To accommodate brownfield cases reference the existing bucket name here instead
# of in the ObjectBucketClaim (OBC). In this case the provisioner will grant
# access to the bucket by creating a new user, attaching it to the bucket, and
Expand Down
2 changes: 1 addition & 1 deletion deploy/examples/storageclass-bucket-retain.yaml
Expand Up @@ -8,7 +8,7 @@ reclaimPolicy: Retain
parameters:
objectStoreName: my-store # port 80 assumed
objectStoreNamespace: rook-ceph # namespace:cluster
region: us-east-1
# region: us-east-1
# To accommodate brownfield cases reference the existing bucket name here instead
# of in the ObjectBucketClaim (OBC). In this case the provisioner will grant
# access to the bucket by creating a new user, attaching it to the bucket, and
Expand Down
28 changes: 12 additions & 16 deletions pkg/operator/ceph/object/s3-handlers.go
Expand Up @@ -45,11 +45,6 @@ func NewInsecureS3Agent(accessKey, secretKey, endpoint, region string, debug boo
}

func newS3Agent(accessKey, secretKey, endpoint, region string, debug bool, tlsCert []byte, insecure bool) (*S3Agent, error) {
var cephRegion = "us-east-1"
if region != "" {
cephRegion = region
}

logLevel := aws.LogOff
if debug {
logLevel = aws.LogDebug
Expand All @@ -62,17 +57,18 @@ func newS3Agent(accessKey, secretKey, endpoint, region string, debug bool, tlsCe
tlsEnabled = true
client.Transport = BuildTransportTLS(tlsCert, insecure)
}
session, err := awssession.NewSession(
aws.NewConfig().
WithRegion(cephRegion).
WithCredentials(credentials.NewStaticCredentials(accessKey, secretKey, "")).
WithEndpoint(endpoint).
WithS3ForcePathStyle(true).
WithMaxRetries(5).
WithDisableSSL(!tlsEnabled).
WithHTTPClient(&client).
WithLogLevel(logLevel),
)
awsConfig := aws.NewConfig().
WithCredentials(credentials.NewStaticCredentials(accessKey, secretKey, "")).
WithEndpoint(endpoint).
WithS3ForcePathStyle(true).
WithMaxRetries(5).
WithDisableSSL(!tlsEnabled).
WithHTTPClient(&client).
WithLogLevel(logLevel)
if region != "" {
awsConfig = awsConfig.WithRegion(region)
}
session, err := awssession.NewSession(awsConfig)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 572bbae

Please sign in to comment.