-
Notifications
You must be signed in to change notification settings - Fork 86
Add support for "Server" and "x-noobaa-available-storage-classes" headers #8255
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
Add support for "Server" and "x-noobaa-available-storage-classes" headers #8255
Conversation
3d9db3c
to
0484a96
Compare
0484a96
to
6dd7dc0
Compare
6dd7dc0
to
ef811c9
Compare
ef811c9
to
b49929d
Compare
b49929d
to
0ce7b95
Compare
src/endpoint/endpoint.js
Outdated
@@ -269,6 +270,8 @@ function create_endpoint_handler(init_request_sdk, virtual_hosts, sts, logger) { | |||
|
|||
/** @type {EndpointHandler} */ | |||
const endpoint_request_handler = (req, res) => { | |||
res.setHeader('Server', `NooBaa/${pkg.version}`); |
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.
but what about the other handlers - sts/iam?
can you add it as function in entpoint_utils and call from all handlers?
// no headers or reply needed | ||
async function head_bucket(req, res) { | ||
const bucket_info = await req.object_sdk.read_bucket({ name: req.params.bucket }); | ||
s3_utils.set_response_supported_storage_classes(res, bucket_info.supported_storage_classes || []); |
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.
s3_utils.set_response_supported_storage_classes(res, bucket_info.supported_storage_classes || []); | |
s3_utils.set_response_supported_storage_classes(res, bucket_info.supported_storage_classes); |
src/endpoint/s3/s3_utils.js
Outdated
*/ | ||
function set_response_supported_storage_classes(res, supported_storage_classes = []) { | ||
if (!config.DENY_UPLOAD_TO_STORAGE_CLASS_STANDARD) { | ||
supported_storage_classes.push(STORAGE_CLASS_STANDARD); |
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.
so now the storage classes returned by the bucket always do not include STANDARD, which just becomes confusing. I didn't mean that. I only meant that if the bucketspace does not return anything, that we set the default based on the config too, but separating the responsibility like this is too weird. So I think we should just do this instead - have the bucketspace return the list, and if it doesn't return anything, just not set the header.
0ce7b95
to
13bb77c
Compare
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.
just missing the call to set_noobaa_server_header to iam handler. approving
13bb77c
to
87ce31e
Compare
…ders Signed-off-by: Utkarsh Srivastava <[email protected]> make supported storage classes bucketspace specific Signed-off-by: Utkarsh Srivastava <[email protected]> add server header to IAM handler Signed-off-by: Utkarsh Srivastava <[email protected]>
87ce31e
to
4e7790f
Compare
Explain the changes
This PR adds support for:
Server
HTTP header whose value is constant and is sent as part of every response.x-noobaa-available-storage-classes
which is sent as part ofHeadBucket
response. The value could be any combination of storage classesGLACIER
andSTANDARD
based on NooBaa config.Issues: Fixed #xxx / Gap #xxx
Fixed #8229