Skip to content

Commit 9d049ab

Browse files
ymhhhpracucci
andauthored
Added etcd username and userpassword from config (#4205)
* added Signed-off-by: Henry Huang <[email protected]> * added flags Signed-off-by: Henry Huang <[email protected]> * Fixed CHANGELOG entry Signed-off-by: Marco Pracucci <[email protected]> Co-authored-by: Marco Pracucci <[email protected]>
1 parent fbf0677 commit 9d049ab

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Note the prior addition of a new configuration option `-alertmanager.persist-interval`. This sets the interval between persisting the current alertmanager state (notification log and silences) to object storage. See the [configuration file reference](https://cortexmetrics.io/docs/configuration/configuration-file/#alertmanager_config) for more information.
2222
* [ENHANCEMENT] Alertmanager: Cleanup persisted state objects from remote storage when a tenant configuration is deleted. #4167
2323
* [ENHANCEMENT] Storage: Added the ability to disable Open Census within GCS client (e.g `-gcs.enable-opencensus=false`). #4219
24+
* [ENHANCEMENT] Etcd: Added username and password to etcd config. #4205
2425
* [ENHANCEMENT] Alertmanager: introduced new metrics to monitor operation when using `-alertmanager.sharding-enabled`: #4149
2526
* `cortex_alertmanager_state_fetch_replica_state_total`
2627
* `cortex_alertmanager_state_fetch_replica_state_failed_total`

docs/configuration/config-file-reference.md

+8
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,14 @@ The `etcd_config` configures the etcd client. The supported CLI flags `<prefix>`
36893689
# Skip validating server certificate.
36903690
# CLI flag: -<prefix>.etcd.tls-insecure-skip-verify
36913691
[tls_insecure_skip_verify: <boolean> | default = false]
3692+
3693+
# Etcd username.
3694+
# CLI flag: -<prefix>.etcd.username
3695+
[username: <string> | default = ""]
3696+
3697+
# Etcd password.
3698+
# CLI flag: -<prefix>.etcd.password
3699+
[password: <string> | default = ""]
36923700
```
36933701

36943702
### `consul_config`

pkg/ring/kv/etcd/etcd.go

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ type Config struct {
2626
MaxRetries int `yaml:"max_retries"`
2727
EnableTLS bool `yaml:"tls_enabled"`
2828
TLS cortex_tls.ClientConfig `yaml:",inline"`
29+
30+
UserName string `yaml:"username"`
31+
Password string `yaml:"password"`
2932
}
3033

3134
// Client implements ring.KVClient for etcd.
@@ -42,6 +45,8 @@ func (cfg *Config) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix string) {
4245
f.DurationVar(&cfg.DialTimeout, prefix+"etcd.dial-timeout", 10*time.Second, "The dial timeout for the etcd connection.")
4346
f.IntVar(&cfg.MaxRetries, prefix+"etcd.max-retries", 10, "The maximum number of retries to do for failed ops.")
4447
f.BoolVar(&cfg.EnableTLS, prefix+"etcd.tls-enabled", false, "Enable TLS.")
48+
f.StringVar(&cfg.UserName, prefix+"etcd.username", "", "Etcd username.")
49+
f.StringVar(&cfg.Password, prefix+"etcd.password", "", "Etcd password.")
4550
cfg.TLS.RegisterFlagsWithPrefix(prefix+"etcd", f)
4651
}
4752

@@ -87,6 +92,8 @@ func New(cfg Config, codec codec.Codec) (*Client, error) {
8792
DialKeepAliveTimeout: 2 * cfg.DialTimeout,
8893
PermitWithoutStream: true,
8994
TLS: tlsConfig,
95+
Username: cfg.UserName,
96+
Password: cfg.Password,
9097
})
9198
if err != nil {
9299
return nil, err

0 commit comments

Comments
 (0)