New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache: support Alibaba Cloud oss backend cache #4502
base: master
Are you sure you want to change the base?
Conversation
b3e2e4b
to
bcafb0a
Compare
Signed-off-by: njucjc <njucjc@gmail.com>
bcafb0a
to
01152b5
Compare
Can we have integration tests similar to buildkit/client/client_test.go Lines 5224 to 5260 in fc9de56
I see in the docs that we could use the S3 SDK to access OSS. Can we consider it to reduce dependencies overhead as we support S3 already?: https://www.alibabacloud.com/help/en/oss/developer-reference/use-amazon-s3-sdks-to-access-oss#section-sp0-q7h-dvj This way we could use the same integration tests as s3 one using minio. |
bucket, ok := attrs[attrBucket] | ||
if !ok { | ||
bucket, ok = os.LookupEnv("ALIBABA_CLOUD_OSS_BUCKET") | ||
if !ok { | ||
return &Config{}, errors.Errorf("bucket ($ALIBABA_CLOUD_OSS_BUCKET) not set for oss cache") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like s3 should we also consider having an env var to set the region? It seems the region is inferred from endpoint url so maybe not needed?: https://www.alibabacloud.com/help/en/oss/developer-reference/go-configure-access-credentials
// Create an OSSClient instance.
// Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. Specify your actual endpoint.
Just asking because I see the SDK having a method to set it: https://github.com/aliyun/aliyun-oss-go-sdk/blob/2bc58741fa507528ff70b501e7e881a92f88ce3e/oss/client.go#L2891-L2895
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the region
env var is not needed for OSS SDK
per discussion in #4487 I think we need to figure out some external plugin model for this instead as adding lots of builtin code for every possible vendor does not scale. Isn't using s3 option for this case? There seems to be some compatibility. |
Yes, there are some compatibility between S3 and OSS driver, but in S3 cache code,it does not use concurrent multi-part upload when uploading blobs, so there may be some performance issues if the cached layer is large. buildkit/cache/remotecache/s3/s3.go Line 424 in fc9de56
I'm not sure if S3 can also implement concurrent multi-part uploads. I agree we need to figure out some external plugin model for cache driver, I'd like to have a try, but it will be a long term case. |
* `secret_access_key`: Security Token (optional) | ||
|
||
`--export-cache` options: | ||
* `type=oss` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be called "alibaba-oss" to avoid confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also wonder if this should be an external plugin that would talk to buildkitd over grpc or something
Fix #4487