-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
etcd_docker 3: Incorporate docker based etcd integration package into… (
#4147) PR 3 for #4144 High level approach is as described in #4144 . This PR incorporates the new test package into our unittests. Usage is via the `etcdintegration` package, which makes it transparent to the test code; it simply gets an etcd server started via different means. One piece of weirdness to call out here: the package currently relies on autosync being *disabled* on the client side. This is because the advertise client URL (aka what etcd tells clients to connect to) isn't correct for the open port on the host. That is we have: - etcd: listen on container port 0.0.0.0:2379, advertise 0.0.0.0:2379 - docker: expose etcd port 2379 to 0.0.0.0:0 on host machine (random free port) - client: connect to etcd via host machine. We could probably make this better. commit-id:263fed13
- Loading branch information
1 parent
c674683
commit 780280f
Showing
27 changed files
with
255 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build integration | ||
//go:build integration | ||
|
||
// Copyright (c) 2020 Uber Technologies, Inc. | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
//go:build integration | ||
// +build integration | ||
|
||
// Copyright (c) 2018 Uber Technologies, Inc. | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,12 +35,22 @@ import ( | |
|
||
// ClusterConfig is the config for a zoned etcd cluster. | ||
type ClusterConfig struct { | ||
Zone string `yaml:"zone"` | ||
Endpoints []string `yaml:"endpoints"` | ||
KeepAlive *KeepAliveConfig `yaml:"keepAlive"` | ||
TLS *TLSConfig `yaml:"tls"` | ||
AutoSyncInterval time.Duration `yaml:"autoSyncInterval"` | ||
DialTimeout time.Duration `yaml:"dialTimeout"` | ||
Zone string `yaml:"zone"` | ||
Endpoints []string `yaml:"endpoints"` | ||
KeepAlive *KeepAliveConfig `yaml:"keepAlive"` | ||
TLS *TLSConfig `yaml:"tls"` | ||
// AutoSyncInterval configures the etcd client's AutoSyncInterval | ||
// (go.etcd.io/etcd/client/[email protected]/config.go:32). | ||
// By default, it is 1m. | ||
// | ||
// Advanced: | ||
// | ||
// One important difference from the etcd config: we have autosync *on* by default (unlike etcd), meaning that | ||
// the zero value here doesn't indicate autosync off. | ||
// Instead, users should pass in a negative value to indicate "disable autosync" | ||
// Only do this if you truly have a good reason for it! Most production use cases want autosync on. | ||
AutoSyncInterval time.Duration `yaml:"autoSyncInterval"` | ||
DialTimeout time.Duration `yaml:"dialTimeout"` | ||
|
||
DialOptions []grpc.DialOption `yaml:"-"` // nonserializable | ||
} | ||
|
@@ -59,7 +69,10 @@ func (c ClusterConfig) NewCluster() Cluster { | |
SetKeepAliveOptions(keepAliveOpts). | ||
SetTLSOptions(c.TLS.newOptions()) | ||
|
||
if c.AutoSyncInterval > 0 { | ||
// Autosync should *always* be on, unless the user very explicitly requests it to be off. They can do this via a | ||
// negative value (in which case we can assume they know what they're doing). | ||
// Therefore, only update if it's nonzero, on the assumption that zero is just the empty value. | ||
if c.AutoSyncInterval != 0 { | ||
cluster = cluster.SetAutoSyncInterval(c.AutoSyncInterval) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.