diff --git a/go.work.sum b/go.work.sum index c7057756..7b832525 100644 --- a/go.work.sum +++ b/go.work.sum @@ -3,6 +3,7 @@ cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxK cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go v0.97.0 h1:3DXvAyifywvq64LfkKaMOmkWPS1CikIQdMe2lY9vxU8= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= @@ -449,6 +450,7 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 h1:hrbNEivu7Zn1pxvHk6MBrq9iE22woVILTHqexqBxe6I= google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= diff --git a/pkg/controllers/common/fileservice.go b/pkg/controllers/common/fileservice.go index 8a90c716..6bbcd9a0 100644 --- a/pkg/controllers/common/fileservice.go +++ b/pkg/controllers/common/fileservice.go @@ -16,11 +16,13 @@ package common import ( "fmt" - "github.com/matrixorigin/controller-runtime/pkg/util" - "github.com/matrixorigin/matrixone-operator/api/core/v1alpha1" + "strings" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" - "strings" + + "github.com/matrixorigin/controller-runtime/pkg/util" + "github.com/matrixorigin/matrixone-operator/api/core/v1alpha1" ) const ( @@ -146,12 +148,18 @@ func sharedFileServiceConfig(sp v1alpha1.SharedStorageProvider, cache *v1alpha1. m["backend"] = fsBackendTypeS3 } s3Config := map[string]interface{}{} + + // init default values + // TODO: let AWS SDK discover its own endpoint by default + s3Config["endpoint"] = "s3.us-west-2.amazonaws.com" + if s3.Endpoint != "" { s3Config["endpoint"] = s3.Endpoint - } else { - // TODO: let AWS SDK discover its own endpoint by default - s3Config["endpoint"] = "s3.us-west-2.amazonaws.com" } + if s3.Region != "" { + s3Config["region"] = s3.Region + } + paths := strings.SplitN(strings.Trim(s3.Path, "/"), "/", 2) s3Config["bucket"] = paths[0] keyPrefix := subDir