Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Add support for Consul ACL token #510

Merged
merged 6 commits into from
May 21, 2018
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
4 changes: 3 additions & 1 deletion conf/orchestrator-sample.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,7 @@
"OSCIgnoreHostnameFilters": [],
"GraphiteAddr": "",
"GraphitePath": "",
"GraphiteConvertHostnameDotsToUnderscores": true
"GraphiteConvertHostnameDotsToUnderscores": true,
"ConsulAddress": "",
"ConsulAclToken": ""
}
2 changes: 2 additions & 0 deletions go/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ type Configuration struct {
MaxOutdatedKeysToShow int // Maximum number of keys to show in ContinuousDiscovery. If the number of polled hosts grows too far then showing the complete list is not ideal.
DiscoveryIgnoreReplicaHostnameFilters []string // Regexp filters to apply to prevent auto-discovering new replicas. Usage: unreachable servers due to firewalls, applications which trigger binlog dumps
ConsulAddress string // Address where Consul HTTP api is found. Example: 127.0.0.1:8500
ConsulAclToken string // ACL token used to write to Consul KV
ZkAddress string // UNSUPPERTED YET. Address where (single or multiple) ZooKeeper servers are found, in `srv1[:port1][,srv2[:port2]...]` format. Default port is 2181. Example: srv-a,srv-b:12181,srv-c
KVClusterMasterPrefix string // Prefix to use for clusters' masters entries in KV stores (internal, consul, ZK), default: "mysql/master"
}
Expand Down Expand Up @@ -411,6 +412,7 @@ func newConfiguration() *Configuration {
MaxOutdatedKeysToShow: 64,
DiscoveryIgnoreReplicaHostnameFilters: []string{},
ConsulAddress: "",
ConsulAclToken: "",
ZkAddress: "",
KVClusterMasterPrefix: "mysql/master",
}
Expand Down
2 changes: 2 additions & 0 deletions go/kv/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func NewConsulStore() KVStore {
if config.Config.ConsulAddress != "" {
consulConfig := consulapi.DefaultConfig()
consulConfig.Address = config.Config.ConsulAddress
// ConsulAclToken defaults to ""
consulConfig.Token = config.Config.ConsulAclToken
if client, err := consulapi.NewClient(consulConfig); err != nil {
log.Errore(err)
} else {
Expand Down