Merge pull request #28078 from jasons42/configure-etcdv3-client-max-request-size

Expose etcd client MaxCallSendMsgSize config
This commit is contained in:
James Bardin 2021-07-20 15:49:14 -04:00 committed by GitHub
commit 570b70b02f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -15,6 +15,7 @@ const (
usernameEnvVarName = "ETCDV3_USERNAME"
passwordKey = "password"
passwordEnvVarName = "ETCDV3_PASSWORD"
maxRequestBytesKey = "max_request_bytes"
prefixKey = "prefix"
lockKey = "lock"
cacertPathKey = "cacert_path"
@ -49,6 +50,13 @@ func New() backend.Backend {
DefaultFunc: schema.EnvDefaultFunc(passwordEnvVarName, ""),
},
maxRequestBytesKey: &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Description: "The max request size to send to etcd.",
Default: 0,
},
prefixKey: &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -128,6 +136,9 @@ func (b *Backend) rawClient() (*etcdv3.Client, error) {
if v, ok := b.data.GetOk(passwordKey); ok && v.(string) != "" {
config.Password = v.(string)
}
if v, ok := b.data.GetOk(maxRequestBytesKey); ok && v.(int) != 0 {
config.MaxCallSendMsgSize = v.(int)
}
if v, ok := b.data.GetOk(cacertPathKey); ok && v.(string) != "" {
tlsInfo.TrustedCAFile = v.(string)
}

View File

@ -10,7 +10,7 @@ description: |-
**Kind: Standard (with locking)**
Stores the state in the [etcd](https://coreos.com/etcd/) KV store with a given prefix.
Stores the state in the [etcd](https://etcd.io/) KV store with a given prefix.
This backend supports [state locking](/docs/language/state/locking.html).
@ -54,3 +54,4 @@ The following configuration options / environment variables are supported:
* `cacert_path` - (Optional) The path to a PEM-encoded CA bundle with which to verify certificates of TLS-enabled etcd servers.
* `cert_path` - (Optional) The path to a PEM-encoded certificate to provide to etcd for secure client identification.
* `key_path` - (Optional) The path to a PEM-encoded key to provide to etcd for secure client identification.
* `max_request_bytes` - (Optional) The max request size to send to etcd. This can be increased to enable storage of larger state. You must set the corresponding server-side flag [--max-request-bytes](https://etcd.io/docs/current/dev-guide/limit/#request-size-limit) as well and the value should be less than the client setting. Defaults to `2097152` (2.0 MiB). **Please Note:** Increasing etcd's request size limit may negatively impact overall latency.