Skip to content
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

Configuration: add a common config section for object storage #4473

Merged
merged 7 commits into from
Oct 21, 2021

Conversation

trevorwhitney
Copy link
Collaborator

@trevorwhitney trevorwhitney commented Oct 13, 2021

Signed-off-by: Trevor Whitney trevorjwhitney@gmail.com

What this PR does / why we need it:
This adds an object_storage section to the common config that will do the following things:

  • Automatically configure the object storage client used for the ruler, unless a specific ruler.storage config is provided in the config file
  • Automatically configure the object storage client used for loki chunk storage, unless a specific storage_config is provided in the config file
  • Automatically configure the compactor.shared_store unless a specific configuration is provided in the config file

The common config block only allows a single object storage configuration to be provided, and will error if multiple configurations are provided (ie. s3 and azure). This allows us to determine the correct value for ruler.storage.type and compactor.shared_store. Loki supports configuring multiple client types for chunk storage in the storage_config section, allowing different clients to be used for different schemas. If a user desires this behavior, they will need to provide the multiple different configurations in the storage_config section themselves.

Which issue(s) this PR fixes:
Fixes #4472

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated

@@ -125,6 +126,32 @@ func (cfg *S3Config) Validate() error {
return nil
}

func (cfg *S3Config) ToCortexS3Config() cortex_aws.S3Config {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These "translation" functions are unfortunate, and warrant a discussion around the best path for extracting/sharing object storage clients between various projects. Out of scope for this PR though I think.

@trevorwhitney trevorwhitney marked this pull request as ready for review October 14, 2021 19:56
@trevorwhitney trevorwhitney requested a review from a team as a code owner October 14, 2021 19:56
pkg/loki/config_wrapper.go Outdated Show resolved Hide resolved
pkg/loki/config_wrapper.go Outdated Show resolved Hide resolved
pkg/loki/config_wrapper.go Outdated Show resolved Hide resolved
pkg/storage/chunk/gcp/gcs_object_client.go Outdated Show resolved Hide resolved
pkg/loki/config_wrapper_test.go Outdated Show resolved Hide resolved
pkg/loki/common/common.go Outdated Show resolved Hide resolved
Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments, notably a test case change and a request for filesystem inclusion, but then LGTM. Great test cases by the way :)

S3 *aws.S3Config `yaml:"s3"`
GCS *gcp.GCSConfig `yaml:"gcs"`
Azure *azure.BlobStorageConfig `yaml:"azure"`
Swift *openstack.SwiftConfig `yaml:"swift"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on adding filesystem in here and calling the struct storage instead of object_storage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, I agree with that. done.

pkg/loki/config_wrapper.go Outdated Show resolved Hide resolved
pkg/loki/config_wrapper_test.go Outdated Show resolved Hide resolved
@trevorwhitney
Copy link
Collaborator Author

@owen-d and @DylanGuedes changes pushed if you want to take another look. thanks!

Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
@DylanGuedes
Copy link
Contributor

LGTM!

@owen-d owen-d merged commit 2427fab into main Oct 21, 2021
@owen-d owen-d deleted the common-object-store branch October 21, 2021 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config: add common config for object storage
3 participants