From e64f09e39de4c777bc951dce40ab610e4240b8fe Mon Sep 17 00:00:00 2001 From: Joao Marcal Date: Wed, 30 Oct 2024 15:54:58 +0000 Subject: [PATCH] docs: fixed docs --- docs/sources/shared/configuration.md | 14 +++++++--- pkg/storage/bucket/http/config.go | 26 +++++++++++-------- pkg/storage/bucket/swift/config.go | 10 ++++--- .../client/openstack/swift_object_client.go | 4 +-- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/docs/sources/shared/configuration.md b/docs/sources/shared/configuration.md index a72b48e8e30ce..1657a91912977 100644 --- a/docs/sources/shared/configuration.md +++ b/docs/sources/shared/configuration.md @@ -5846,6 +5846,10 @@ The `swift_storage_config` block configures the connection to OpenStack Object S   ```yaml +# Set this to true to use the internal OpenStack Swift endpoint URL +# CLI flag: -.swift.internal +[internal: | default = false] + # OpenStack Swift authentication API version. 0 to autodetect. # CLI flag: -.swift.auth-version [auth_version: | default = 0] @@ -5854,10 +5858,6 @@ The `swift_storage_config` block configures the connection to OpenStack Object S # CLI flag: -.swift.auth-url [auth_url: | default = ""] -# Set this to true to use the internal OpenStack Swift endpoint URL -# CLI flag: -.swift.internal -[internal: | default = false] - # OpenStack Swift username. # CLI flag: -.swift.username [username: | default = ""] @@ -5925,6 +5925,12 @@ The `swift_storage_config` block configures the connection to OpenStack Object S # is received on a request. # CLI flag: -.swift.request-timeout [request_timeout: | default = 5s] + +http_config: + # Path to the CA certificates to validate server certificate against. If not + # set, the host's root CA certificates are used. + # CLI flag: -.swift.http.tls-ca-path + [tls_ca_path: | default = ""] ``` ### table_manager diff --git a/pkg/storage/bucket/http/config.go b/pkg/storage/bucket/http/config.go index 50f362dab01a9..02f69c1574d22 100644 --- a/pkg/storage/bucket/http/config.go +++ b/pkg/storage/bucket/http/config.go @@ -6,17 +6,21 @@ import ( "time" ) +// NOTE some of the fields are hidden in the documentation due to this struct +// being by the old Swift storage backend. The hidden fields can be unhidden +// when we deprecate the old clients. + // Config stores the http.Client configuration for the storage clients. type Config struct { - IdleConnTimeout time.Duration `yaml:"idle_conn_timeout"` - ResponseHeaderTimeout time.Duration `yaml:"response_header_timeout"` - InsecureSkipVerify bool `yaml:"insecure_skip_verify"` + IdleConnTimeout time.Duration `yaml:"idle_conn_timeout" doc:"hidden"` + ResponseHeaderTimeout time.Duration `yaml:"response_header_timeout" doc:"hidden"` + InsecureSkipVerify bool `yaml:"insecure_skip_verify" doc:"hidden"` - TLSHandshakeTimeout time.Duration `yaml:"tls_handshake_timeout"` - ExpectContinueTimeout time.Duration `yaml:"expect_continue_timeout"` - MaxIdleConns int `yaml:"max_idle_connections"` - MaxIdleConnsPerHost int `yaml:"max_idle_connections_per_host"` - MaxConnsPerHost int `yaml:"max_connections_per_host"` + TLSHandshakeTimeout time.Duration `yaml:"tls_handshake_timeout" doc:"hidden"` + ExpectContinueTimeout time.Duration `yaml:"expect_continue_timeout" doc:"hidden"` + MaxIdleConns int `yaml:"max_idle_connections" doc:"hidden"` + MaxIdleConnsPerHost int `yaml:"max_idle_connections_per_host" doc:"hidden"` + MaxConnsPerHost int `yaml:"max_connections_per_host" doc:"hidden"` // Allow upstream callers to inject a round tripper Transport http.RoundTripper `yaml:"-"` @@ -27,9 +31,9 @@ type Config struct { // TLSConfig configures the options for TLS connections. type TLSConfig struct { CAPath string `yaml:"tls_ca_path" category:"advanced"` - CertPath string `yaml:"tls_cert_path" category:"advanced"` - KeyPath string `yaml:"tls_key_path" category:"advanced"` - ServerName string `yaml:"tls_server_name" category:"advanced"` + CertPath string `yaml:"tls_cert_path" category:"advanced" doc:"hidden"` + KeyPath string `yaml:"tls_key_path" category:"advanced" doc:"hidden"` + ServerName string `yaml:"tls_server_name" category:"advanced" doc:"hidden"` } // RegisterFlags registers the flags for the storage HTTP client. diff --git a/pkg/storage/bucket/swift/config.go b/pkg/storage/bucket/swift/config.go index 161cf1ca9435e..17e3dd44f27a5 100644 --- a/pkg/storage/bucket/swift/config.go +++ b/pkg/storage/bucket/swift/config.go @@ -9,11 +9,15 @@ import ( "github.com/grafana/loki/v3/pkg/storage/bucket/http" ) +// NOTE some of the fields are hidden in the documentation due to this struct +// being by the old Swift storage backend. The hidden fields can be unhidden +// when we deprecate the old clients. + // Config holds the config options for Swift backend type Config struct { - ApplicationCredentialID string `yaml:"application_credential_id"` - ApplicationCredentialName string `yaml:"application_credential_name"` - ApplicationCredentialSecret flagext.Secret `yaml:"application_credential_secret"` + ApplicationCredentialID string `yaml:"application_credential_id" doc:"hidden"` + ApplicationCredentialName string `yaml:"application_credential_name" doc:"hidden"` + ApplicationCredentialSecret flagext.Secret `yaml:"application_credential_secret" doc:"hidden"` AuthVersion int `yaml:"auth_version"` AuthURL string `yaml:"auth_url"` Username string `yaml:"username"` diff --git a/pkg/storage/chunk/client/openstack/swift_object_client.go b/pkg/storage/chunk/client/openstack/swift_object_client.go index 1d6e59a05e502..d3e9d2f9ec5a4 100644 --- a/pkg/storage/chunk/client/openstack/swift_object_client.go +++ b/pkg/storage/chunk/client/openstack/swift_object_client.go @@ -44,8 +44,8 @@ func defaultTransport(config bucket_http.Config) (http.RoundTripper, error) { return &http.Transport{ Proxy: http.ProxyFromEnvironment, - MaxIdleConns: config.MaxIdleConns, - MaxIdleConnsPerHost: config.MaxIdleConnsPerHost, + MaxIdleConns: 200, + MaxIdleConnsPerHost: 200, ExpectContinueTimeout: 5 * time.Second, // Set this value so that the underlying transport round-tripper // doesn't try to auto decode the body of objects with