-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat: Add objstore support for Swift using thanos.io/objstore #11672
Conversation
pkg/storage/bucket/swift/config.go
Outdated
Timeout time.Duration `yaml:"timeout"` | ||
IdleConnTimeout time.Duration `yaml:"idle_conn_timeout"` | ||
ResponseHeaderTimeout time.Duration `yaml:"response_header_timeout"` |
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.
These values are define here but I don't see anywhere they are actually being used to configure the underlying transport?
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.
Thanks, you're right I had assumed that this was the struct being used inside the chunks
package. I've moved it there already.
Following @periklis 's advice to reuse the bucket_http
config inside the swift bucket config, I've noticed that the swift config used is coming from thanos-io/objstore
, which doesn't have an HTTP
field built into it (in contrary to s3's thanos/objstore config struct which does have the HTTP field).
This limits the addition of the HTTPConfig.Transport
field to the swift config.
So I need your advice here since I lack experience in this codebase, do you suggest that we wait until it's added to thanos-io/objstore
's swift config? Or should we proceed with this PR only with the object client, while leaving the bucket client until either a restructure of the config is done, or till the correct fields are added to the thanos/objstore config?
Edit: after discussing with @periklis, we agreed to 1) add the required HTTP config in thanos-io/objstore
and 2) use the thanos-io/objstore
config in both the bucket and object client, for the sake of unifying all storage clients.
pkg/storage/bucket/swift/config.go
Outdated
@@ -54,6 +64,11 @@ func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { | |||
f.IntVar(&cfg.MaxRetries, prefix+"swift.max-retries", 3, "Max retries on requests error.") | |||
f.DurationVar(&cfg.ConnectTimeout, prefix+"swift.connect-timeout", 10*time.Second, "Time after which a connection attempt is aborted.") | |||
f.DurationVar(&cfg.RequestTimeout, prefix+"swift.request-timeout", 5*time.Second, "Time after which an idle request is aborted. The timeout watchdog is reset each time some data is received, so the timeout triggers after X time no data is received on a request.") | |||
f.DurationVar(&cfg.HTTPConfig.IdleConnTimeout, prefix+"swift.http.idle-conn-timeout", 90*time.Second, "The maximum amount of time an idle connection will be held open.") |
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.
This would be a change from the currently used default value of 0
for unlimited, I think as we are trying to get this change into a patch fix release it would be better to keep the current default value.
Also as mentioned above I don't see where this value actually configures the underlying transport
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.
@slim-bean AFAICS, GCS, Azure and S3 all define as default 90sec. Maybe you refer to some different place?
@btaani @slim-bean After careful consideration the present state of this PR does not consider all the places to configure the HTTP transport capabilities as proposed. TL;DR; The PR considers adding parameters only to the chunk/object client but not to the bucket client. @btaani FYI the Loki code base is handling for historical reasons (part of it from Cortex's legacy) the buckets and object stored into them via separate clients. The main rationale for this separation is that for each use case we have different transport and encryption requirements (i.e. buckets are created once and is more of a fire and forget operation, while objects are accessed regularly). In any case we need to consider adding the HTTP capabilities in two places as of now:
For the sake of simplicity, you can consider reusing the bucket/http/config.go. For example S3 is using this in bucket/s3/config.go for the bucket client. OTH for the Swift object client you can keep your custom struct as other providers are doing. |
docs/sources/configure/_index.md
Outdated
@@ -5174,6 +5174,16 @@ The `swift_storage_config` block configures the connection to OpenStack Object S | |||
# is received on a request. | |||
# CLI flag: -<prefix>.swift.request-timeout | |||
[request_timeout: <duration> | default = 5s] | |||
|
|||
# Set to false to skip verifying the certificate chain and hostname. |
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.
Did you edit this file directly? Or is this change automatically generated? The configuration reference should be updated in docs/sources/configure/index.template.
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 did so directly.. thanks for pointing this out!
28c3e53
to
e64f09e
Compare
pkg/storage/chunk/client/openstack/swift_thanos_object_client.go
Outdated
Show resolved
Hide resolved
747401d
to
c2f588f
Compare
c2f588f
to
32f92fe
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.
lgtm! thank you @JoaoBraveCoding
What this PR does / why we need it:
thanos-io/objstore
to use the latest versionWhich issue(s) this PR fixes:
Fixes LOG-4819, LOG-5063
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guide (required)CHANGELOG.md
updatedadd-to-release-notes
labeldocs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR