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

Introduce http config settings in Azure storage #4581

Merged
merged 3 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [ENHANCEMENT] Upgraded Docker base images to `alpine:3.14`. #4514
* [ENHANCEMENT] Updated Prometheus to latest. Includes changes from prometheus#9239, adding 15 new functions. Multiple TSDB bugfixes prometheus#9438 & prometheus#9381. #4524
* [ENHANCEMENT] Query Frontend: Add setting `-frontend.forward-headers-list` in frontend to configure the set of headers from the requests to be forwarded to downstream requests. #4486
* [ENHANCEMENT] Blocks storage: Add `-blocks-storage.azure.http.*`, `-alertmanager-storage.azure.http.*`, and `-ruler-storage.azure.http.*` to configure the Azure storage client. #4581
* [BUGFIX] AlertManager: remove stale template files. #4495

## 1.11.0 2021-11-25
Expand Down
42 changes: 40 additions & 2 deletions docs/blocks-storage/querier.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ blocks_storage:
# CLI flag: -blocks-storage.s3.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects to S3 via HTTPS and this option is enabled, the
# client will accept any certificate and hostname.
# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -blocks-storage.s3.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

Expand Down Expand Up @@ -340,6 +340,44 @@ blocks_storage:
# CLI flag: -blocks-storage.azure.max-retries
[max_retries: <int> | default = 20]

http:
# The time an idle connection will remain idle before closing.
# CLI flag: -blocks-storage.azure.http.idle-conn-timeout
[idle_conn_timeout: <duration> | default = 1m30s]

# The amount of time the client will wait for a servers response headers.
# CLI flag: -blocks-storage.azure.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -blocks-storage.azure.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

# Maximum time to wait for a TLS handshake. 0 means no limit.
# CLI flag: -blocks-storage.azure.tls-handshake-timeout
[tls_handshake_timeout: <duration> | default = 10s]

# The time to wait for a server's first response headers after fully
# writing the request headers if the request has an Expect header. 0 to
# send the request body immediately.
# CLI flag: -blocks-storage.azure.expect-continue-timeout
[expect_continue_timeout: <duration> | default = 1s]

# Maximum number of idle (keep-alive) connections across all hosts. 0
# means no limit.
# CLI flag: -blocks-storage.azure.max-idle-connections
[max_idle_connections: <int> | default = 100]

# Maximum number of idle (keep-alive) connections to keep per-host. If 0,
# a built-in default value is used.
# CLI flag: -blocks-storage.azure.max-idle-connections-per-host
[max_idle_connections_per_host: <int> | default = 100]

# Maximum number of connections per host. 0 means no limit.
# CLI flag: -blocks-storage.azure.max-connections-per-host
[max_connections_per_host: <int> | default = 0]

swift:
# OpenStack Swift authentication API version. 0 to autodetect.
# CLI flag: -blocks-storage.swift.auth-version
Expand Down
42 changes: 40 additions & 2 deletions docs/blocks-storage/store-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ blocks_storage:
# CLI flag: -blocks-storage.s3.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects to S3 via HTTPS and this option is enabled, the
# client will accept any certificate and hostname.
# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -blocks-storage.s3.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

Expand Down Expand Up @@ -404,6 +404,44 @@ blocks_storage:
# CLI flag: -blocks-storage.azure.max-retries
[max_retries: <int> | default = 20]

http:
# The time an idle connection will remain idle before closing.
# CLI flag: -blocks-storage.azure.http.idle-conn-timeout
[idle_conn_timeout: <duration> | default = 1m30s]

# The amount of time the client will wait for a servers response headers.
# CLI flag: -blocks-storage.azure.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -blocks-storage.azure.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

# Maximum time to wait for a TLS handshake. 0 means no limit.
# CLI flag: -blocks-storage.azure.tls-handshake-timeout
[tls_handshake_timeout: <duration> | default = 10s]

# The time to wait for a server's first response headers after fully
# writing the request headers if the request has an Expect header. 0 to
# send the request body immediately.
# CLI flag: -blocks-storage.azure.expect-continue-timeout
[expect_continue_timeout: <duration> | default = 1s]

# Maximum number of idle (keep-alive) connections across all hosts. 0
# means no limit.
# CLI flag: -blocks-storage.azure.max-idle-connections
[max_idle_connections: <int> | default = 100]

# Maximum number of idle (keep-alive) connections to keep per-host. If 0,
# a built-in default value is used.
# CLI flag: -blocks-storage.azure.max-idle-connections-per-host
[max_idle_connections_per_host: <int> | default = 100]

# Maximum number of connections per host. 0 means no limit.
# CLI flag: -blocks-storage.azure.max-connections-per-host
[max_connections_per_host: <int> | default = 0]

swift:
# OpenStack Swift authentication API version. 0 to autodetect.
# CLI flag: -blocks-storage.swift.auth-version
Expand Down
126 changes: 120 additions & 6 deletions docs/configuration/config-file-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1714,8 +1714,8 @@ s3:
# CLI flag: -ruler-storage.s3.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects to S3 via HTTPS and this option is enabled, the
# client will accept any certificate and hostname.
# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -ruler-storage.s3.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

Expand Down Expand Up @@ -1776,6 +1776,44 @@ azure:
# CLI flag: -ruler-storage.azure.max-retries
[max_retries: <int> | default = 20]

http:
# The time an idle connection will remain idle before closing.
# CLI flag: -ruler-storage.azure.http.idle-conn-timeout
[idle_conn_timeout: <duration> | default = 1m30s]

# The amount of time the client will wait for a servers response headers.
# CLI flag: -ruler-storage.azure.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -ruler-storage.azure.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

# Maximum time to wait for a TLS handshake. 0 means no limit.
# CLI flag: -ruler-storage.azure.tls-handshake-timeout
[tls_handshake_timeout: <duration> | default = 10s]

# The time to wait for a server's first response headers after fully writing
# the request headers if the request has an Expect header. 0 to send the
# request body immediately.
# CLI flag: -ruler-storage.azure.expect-continue-timeout
[expect_continue_timeout: <duration> | default = 1s]

# Maximum number of idle (keep-alive) connections across all hosts. 0 means
# no limit.
# CLI flag: -ruler-storage.azure.max-idle-connections
[max_idle_connections: <int> | default = 100]

# Maximum number of idle (keep-alive) connections to keep per-host. If 0, a
# built-in default value is used.
# CLI flag: -ruler-storage.azure.max-idle-connections-per-host
[max_idle_connections_per_host: <int> | default = 100]

# Maximum number of connections per host. 0 means no limit.
# CLI flag: -ruler-storage.azure.max-connections-per-host
[max_connections_per_host: <int> | default = 0]

swift:
# OpenStack Swift authentication API version. 0 to autodetect.
# CLI flag: -ruler-storage.swift.auth-version
Expand Down Expand Up @@ -2258,8 +2296,8 @@ s3:
# CLI flag: -alertmanager-storage.s3.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects to S3 via HTTPS and this option is enabled, the
# client will accept any certificate and hostname.
# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -alertmanager-storage.s3.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

Expand Down Expand Up @@ -2320,6 +2358,44 @@ azure:
# CLI flag: -alertmanager-storage.azure.max-retries
[max_retries: <int> | default = 20]

http:
# The time an idle connection will remain idle before closing.
# CLI flag: -alertmanager-storage.azure.http.idle-conn-timeout
[idle_conn_timeout: <duration> | default = 1m30s]

# The amount of time the client will wait for a servers response headers.
# CLI flag: -alertmanager-storage.azure.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -alertmanager-storage.azure.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

# Maximum time to wait for a TLS handshake. 0 means no limit.
# CLI flag: -alertmanager-storage.azure.tls-handshake-timeout
[tls_handshake_timeout: <duration> | default = 10s]

# The time to wait for a server's first response headers after fully writing
# the request headers if the request has an Expect header. 0 to send the
# request body immediately.
# CLI flag: -alertmanager-storage.azure.expect-continue-timeout
[expect_continue_timeout: <duration> | default = 1s]

# Maximum number of idle (keep-alive) connections across all hosts. 0 means
# no limit.
# CLI flag: -alertmanager-storage.azure.max-idle-connections
[max_idle_connections: <int> | default = 100]

# Maximum number of idle (keep-alive) connections to keep per-host. If 0, a
# built-in default value is used.
# CLI flag: -alertmanager-storage.azure.max-idle-connections-per-host
[max_idle_connections_per_host: <int> | default = 100]

# Maximum number of connections per host. 0 means no limit.
# CLI flag: -alertmanager-storage.azure.max-connections-per-host
[max_connections_per_host: <int> | default = 0]

swift:
# OpenStack Swift authentication API version. 0 to autodetect.
# CLI flag: -alertmanager-storage.swift.auth-version
Expand Down Expand Up @@ -4565,8 +4641,8 @@ s3:
# CLI flag: -blocks-storage.s3.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects to S3 via HTTPS and this option is enabled, the
# client will accept any certificate and hostname.
# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -blocks-storage.s3.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

Expand Down Expand Up @@ -4627,6 +4703,44 @@ azure:
# CLI flag: -blocks-storage.azure.max-retries
[max_retries: <int> | default = 20]

http:
# The time an idle connection will remain idle before closing.
# CLI flag: -blocks-storage.azure.http.idle-conn-timeout
[idle_conn_timeout: <duration> | default = 1m30s]

# The amount of time the client will wait for a servers response headers.
# CLI flag: -blocks-storage.azure.http.response-header-timeout
[response_header_timeout: <duration> | default = 2m]

# If the client connects via HTTPS and this option is enabled, the client
# will accept any certificate and hostname.
# CLI flag: -blocks-storage.azure.http.insecure-skip-verify
[insecure_skip_verify: <boolean> | default = false]

# Maximum time to wait for a TLS handshake. 0 means no limit.
# CLI flag: -blocks-storage.azure.tls-handshake-timeout
[tls_handshake_timeout: <duration> | default = 10s]

# The time to wait for a server's first response headers after fully writing
# the request headers if the request has an Expect header. 0 to send the
# request body immediately.
# CLI flag: -blocks-storage.azure.expect-continue-timeout
[expect_continue_timeout: <duration> | default = 1s]

# Maximum number of idle (keep-alive) connections across all hosts. 0 means
# no limit.
# CLI flag: -blocks-storage.azure.max-idle-connections
[max_idle_connections: <int> | default = 100]

# Maximum number of idle (keep-alive) connections to keep per-host. If 0, a
# built-in default value is used.
# CLI flag: -blocks-storage.azure.max-idle-connections-per-host
[max_idle_connections_per_host: <int> | default = 100]

# Maximum number of connections per host. 0 means no limit.
# CLI flag: -blocks-storage.azure.max-connections-per-host
[max_connections_per_host: <int> | default = 0]

swift:
# OpenStack Swift authentication API version. 0 to autodetect.
# CLI flag: -blocks-storage.swift.auth-version
Expand Down
6 changes: 5 additions & 1 deletion docs/contributing/how-to-run-website-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ The following initial setup is required only once:
```
cd website && npm install && cd -
```
4. Run `make BUILD_IN_CONTAINER=false web-build`
4. Install [embedmd](https://github.com/campoy/embedmd) `v1.0.0`:
```
go install github.com/campoy/[email protected]
```
5. Run `make BUILD_IN_CONTAINER=false web-build`


## Run it
Expand Down
11 changes: 11 additions & 0 deletions pkg/storage/bucket/azure/bucket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package azure

import (
"github.com/go-kit/log"
"github.com/prometheus/common/model"
"github.com/thanos-io/thanos/pkg/objstore"
"github.com/thanos-io/thanos/pkg/objstore/azure"
yaml "gopkg.in/yaml.v2"
Expand All @@ -14,6 +15,16 @@ func NewBucketClient(cfg Config, name string, logger log.Logger) (objstore.Bucke
ContainerName: cfg.ContainerName,
Endpoint: cfg.Endpoint,
MaxRetries: cfg.MaxRetries,
HTTPConfig: azure.HTTPConfig{
IdleConnTimeout: model.Duration(cfg.IdleConnTimeout),
ResponseHeaderTimeout: model.Duration(cfg.ResponseHeaderTimeout),
InsecureSkipVerify: cfg.InsecureSkipVerify,
TLSHandshakeTimeout: model.Duration(cfg.TLSHandshakeTimeout),
ExpectContinueTimeout: model.Duration(cfg.ExpectContinueTimeout),
MaxIdleConns: cfg.MaxIdleConns,
MaxIdleConnsPerHost: cfg.MaxIdleConnsPerHost,
MaxConnsPerHost: cfg.MaxConnsPerHost,
},
}

// Thanos currently doesn't support passing the config as is, but expects a YAML,
Expand Down
5 changes: 5 additions & 0 deletions pkg/storage/bucket/azure/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"flag"

"github.com/grafana/dskit/flagext"

"github.com/cortexproject/cortex/pkg/storage/bucket/http"
)

// Config holds the config options for an Azure backend
Expand All @@ -13,6 +15,8 @@ type Config struct {
ContainerName string `yaml:"container_name"`
Endpoint string `yaml:"endpoint_suffix"`
MaxRetries int `yaml:"max_retries"`

http.Config `yaml:"http"`
}

// RegisterFlags registers the flags for Azure storage
Expand All @@ -27,4 +31,5 @@ func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
f.StringVar(&cfg.ContainerName, prefix+"azure.container-name", "", "Azure storage container name")
f.StringVar(&cfg.Endpoint, prefix+"azure.endpoint-suffix", "", "Azure storage endpoint suffix without schema. The account name will be prefixed to this value to create the FQDN")
f.IntVar(&cfg.MaxRetries, prefix+"azure.max-retries", 20, "Number of retries for recoverable errors")
cfg.Config.RegisterFlagsWithPrefix(prefix+"azure.", f)
}
Loading