Commit Graph

535 Commits (39b4d147e18713dd0c8b2445b17474984b7d0c9d)

Author SHA1 Message Date
Gyuho Lee 4baaf322fa pkg/netutil: create doc.go
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-27 11:41:50 -07:00
Gyuho Lee e8ba8feaed pkg/netutil: use structured logging for TCP resolve
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-27 11:40:13 -07:00
Gyuho Lee 2271db7552 pkg/logutil: add godoc on zap encoder field names
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-26 11:54:00 -07:00
Gyuho Lee 624f421d21
Merge pull request #9642 from lorneli/idutil-dev
pkg/idutil: use count field as atomic variable
2018-04-26 11:48:23 -07:00
lorneli 54827d47ee pkg/idutil: use count field as atomic variable
Use atomic.AddUint64 instead of mutex lock to inc count field.

Bench result:
benchmark           old ns/op     new ns/op     delta
BenchmarkNext-4     163           26.3          -83.87%
2018-04-27 00:44:45 +08:00
Gyuho Lee 9cd9ae284f pkg/logutil: do not build journald logger on windows
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-25 13:52:30 -07:00
Gyuho Lee a34dd272b0 pkg/logutil: change "NewRaftLogger" function signature
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-25 10:11:35 -07:00
Gyuho Lee 6df3179c06 pkg/logutil: add "NewRaftLoggerFromZapCore"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-25 10:05:12 -07:00
Gyuho Lee 1fa80bf520 pkg/logutil: add "NewGRPCLoggerV2FromZapCore"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-25 10:05:12 -07:00
Gyuho Lee fcbb30364a pkg/logutil: add "NewJournaldWriter"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-25 10:05:12 -07:00
Gyuho Lee 0411b89d69 pkg/proxy: fix fmt
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-20 11:26:38 -07:00
Gyuho Lee 8006d3305e pkg/proxy: strip host on local listener
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-20 10:35:01 -07:00
Gyuho Lee d0847f4f25 *: clean up/fix server structured logs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-18 12:54:43 -07:00
Gyuho Lee 2bd88e378c pkg/transport: check nil logger
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-16 17:36:00 -07:00
Gyuho Lee 0dad8abb6f pkg: support structured logger
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-16 17:36:00 -07:00
Gyuho Lee 82e84a09e1 pkg/logutil: add "NewGRPCLoggerV2FromZap", "NewRaftLogger"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-16 17:36:00 -07:00
Gyuho Lee ff6ff9d6e6
Merge pull request #9570 from gyuho/tls
*: fix TLS reload when cert includes only IPs (no domain names in SAN field)
2018-04-16 08:02:18 -07:00
Gyuho Lee 00b529e810 pkg/proxy: fix typos in field names
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-14 12:00:41 -07:00
Gyuho Lee 5db4df762b pkg/proxy: make/simplify interface more extensible
Extend proxy for more advanced corrupt and packet drop testing.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-14 07:32:26 -07:00
Gyuho Lee 3f8d1738de pkg/transport: document how TLS reload works with IP only certs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-13 14:19:37 -07:00
rob boll 88c078d4bd pkg/transport: don't set certificates on tls config 2018-04-13 13:17:27 -07:00
Gyuho Lee b8bf42cc5a pkg/fileutil: test "Exist" on directory
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-08 14:26:30 -07:00
Gyuho Lee f53c153fa9 pkg/stringutil: add tests
For later "runner" cleanup

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-08 14:18:09 -07:00
Gyuho Lee 72ba5572a2 pkg/proxy: godoc package
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-05 12:57:44 -07:00
Gyuho Lee 7f812ca8e1 pkg/proxy: move from "pkg/transport"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-05 11:06:30 -07:00
Gyuho Lee 322437f47d pkg/transport: log tlsutil.NewCert errors
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-02 13:42:09 -07:00
Gyuho Lee d44332daa9 proxy: clean up logging
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-30 11:25:23 -07:00
Gyuho Lee 089e8ffecb pkg/flags: fix "Set"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-27 06:25:44 -07:00
Gyuho Lee 7195bb7ced pkg/cors: remove
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-27 06:25:44 -07:00
Gyuho Lee b426217907 pkg/flags: add "UniqueURLs", "UniqueStrings"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>

iii

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-27 06:25:44 -07:00
Gyuho Lee 759fcb6e70 pkg/transport: deprecate "CAFile" field
Has been deprecated since v2.1...

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-20 15:38:05 -07:00
Gyuho Lee 1640cdb044 pkg/flags: clean up, add "SelectiveStringsValue"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-19 02:23:06 -07:00
Gyuho Lee 1e94968ffa pkg/flags: support empty URLs string in NewURLsValue
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-15 01:18:57 -04:00
Gyuho Lee 5e9d4652e0 pkg/flags: add "StringSliceFromFlag"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-14 21:32:24 -04:00
Gyuho Lee 9e7ef79c26 pkg/flags: add "StringSlice"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-14 21:27:17 -04:00
Gyuho Lee ab4d888e1f pkg/logutil: fix example
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-07 13:11:34 -08:00
Gyuho Lee 82ee796aa4 pkg/logutil: move "pkg/logger" to "logutil"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-07 10:45:29 -08:00
Gyuho Lee 748ab8c398 pkg/flags: fatal on conflicting environment variable
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-02 10:36:59 -08:00
Gyuho Lee 418bb92963 pkg/httputil: add "GetHostname"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-28 17:27:40 -08:00
Gyuho Lee 811566f2f2 *: fix "v2store" imports
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 0e12e888e0 *: move "internal/store" to "etcdserver/v2store"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Gyuho Lee 8bf0c43b73
Merge pull request #9267 from gyuho/member-add-test
snapshot: fix "TestSnapshotV3RestoreMultiMemberAdd"
2018-02-26 10:08:49 -08:00
Gyuho Lee 3bd0114c50
Merge pull request #9081 from gyuho/network-fault-test-with-proxy
*: run network fault tests with proxy
2018-02-06 09:51:34 -08:00
Gyuho Lee aba719e4c2 pkg/logger: add "Lvl" to "Logger"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-05 13:40:51 -08:00
Gyuho Lee 71824474df snapshot: fix "TestSnapshotV3RestoreMultiMemberAdd"
Membership reconfiguration may not be applied
when the new member joins. Also pass all endpoints
to check restore data in case of leader election or
network faults.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-05 13:08:24 -08:00
Gyuho Lee 880835c02c *: move "store" to "internal/store"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 11:06:22 -08:00
Gyuho Lee e1de74913d pkg/netutil: return error from "URLStringsEqual"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-25 11:22:07 -08:00
Gyuho Lee ab486e5348 pkg/transport: implement "Proxy"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-24 17:37:09 -08:00
Gyuho Lee 114a7779c9 pkg/transport: add "fixtures" for TLS tests
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-24 17:37:09 -08:00
Tavish Armstrong b664b9176c pkg/srv, embed, etcdmain: Support multiple clusters in the same DNS discovery region. 2018-01-24 20:15:48 +00:00
Gyuho Lee 7eb0523bd2 pkg/testutil: define "RequestTimeout"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-23 13:13:00 -08:00
Gyuho Lee 0e43d84f14 pkg/logger: type-assert in global-scope
Rather than asserting inside functions.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-22 14:50:46 -08:00
Gyuho Lee cb0290e782 pkg/logger: initial commit
Later to be used with "snapshot" and "clientv3" packages.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-22 13:52:06 -08:00
Gyuho Lee b2a15ec327 pkg/expect: fix deadlock in mac OS
bufio.NewReader.ReadString blocks even
when the process received syscall.SIGKILL.
Remove ptyMu mutex and make ReadString return
when *os.File is closed.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-01 17:34:59 -08:00
Gyu-Ho Lee 962976f2df pkg/fileutil: fix preallocate under OS X kernel
ftruncate changes st_blocks, and following fallocate
syscalls would return EINVAL when allocated block size
is already greater than requested block size
(e.g. st_blocks==8, requested blocks are 2).

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-12-14 10:36:57 -08:00
Gyu-Ho Lee 965d9806d5 pkg/flags: fix "SetFlagsFromEnv" error masking
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-27 06:41:43 -08:00
Gyu-Ho Lee 75110dd839 *: fix naked returns
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 18:46:15 -08:00
Joe Betz a9996f8768 test: Deflake TestV3LeasePrmote integration test 2017-10-26 16:58:37 -07:00
Gyu-Ho Lee 1f2197b1f8 pkg/transport: add TODO to deprecate 'CAFile' field in v4
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-04 14:01:01 -07:00
Hitoshi Mitake 70018e9207 etcdmain, pkg: CN based auth for inter peer connection
This commit adds an authentication mechanism to inter peer connection
(rafthttp). If the cert based peer auth is enabled and a new option
`--peer-cert-allowed-cn` is passed, an etcd process denies a peer
connection whose CN doesn't match.
2017-10-02 15:59:17 +09:00
Anthony Romano 4fa1dd196c *: make receiver names consistent 2017-09-12 03:54:04 -07:00
Gyu-Ho Lee 6e39a39e3a Merge pull request #8511 from gyuho/ctx
*: deprecate 'golang.org/x/net/context'
2017-09-07 18:07:57 -07:00
Gyu-Ho Lee f65aee0759 *: replace 'golang.org/x/net/context' with 'context'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
lorneli 63aa64d240 lease: use monotime in time.Time for Go 1.9
The golang/time package tracks monotonic time in each time.Time
returned by time.Now function for Go 1.9.

Use time.Time to measure whether a lease is expired and remove
previous pkg/monotime. Use zero time.Time to mean forever. No
expiration when expiry.IsZero() is true.
2017-09-07 14:18:19 +08:00
Anthony Romano 492bbc9659 netutil: test schemes for URLStringsEqual
add tests for http/https mismatch and unix scheme
2017-08-31 12:41:05 -07:00
Anthony Romano 7d4a8a6935 Merge pull request #8466 from heyitsanthony/tls-srv-mismatch
srv: if a host matches a peer, only use if url schemes match
2017-08-30 10:42:20 -07:00
Manjunath A Kumatagi cd772ea737 pkg/pbutil: Fix go vet errors 2017-08-30 20:07:14 +05:30
Anthony Romano a671703c08 srv: if a host matches a peer, only use if url schemes match
The https scheme for a peer advertise URL was ignored when resolving through
SRV records.
2017-08-29 23:29:56 -07:00
blueblue 9b92e1b2d0 flag: improve StringFlags by support set default value when init (#8447)
* flag: improve StringFlags by support set default value when init

when init flagSet, set default value should be moved to StringFlags init
func, which is more friendly

personal proposal

* flag: code improved for StringFlags
2017-08-28 00:02:11 -07:00
lorneli 54fcdb4b5c pkg/wait: change list's lock to RWMutex
Change list's lock from Mutex to RWMutex, which allows concurrent
access for list.IsRegistered function.
2017-08-27 18:23:18 +08:00
Anthony Romano 67d932154c testutil: don't panic on AssertNil on non-nil errors 2017-08-23 14:26:03 -07:00
Anthony Romano 6464574952 netutil: don't resolve unix socket URLs when comparing URLs
Was causing VerifyBootstrap() to hang on unix peers.
2017-08-17 19:58:24 -07:00
Gyu-Ho Lee 195744aea6 pkg/flags: warns on shadowed environment variable flags
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-09 15:58:48 -07:00
Anthony Romano e9a7f3551b Merge pull request #8281 from heyitsanthony/san-rdns
transport: use reverse lookup to match wildcard DNS SAN
2017-07-22 08:02:57 -07:00
Anthony Romano b1aa962233 transport: use reverse lookup to match wildcard DNS SAN
Fixes #8268
2017-07-21 16:43:25 -07:00
Anthony Romano 426ad25924 transport: include InsecureSkipVerify in TLSInfo
Some functions take a TLSInfo to generate a tls.Config and there was no
way to force the InsecureSkipVerify flag.
2017-07-21 11:00:22 -07:00
Anthony Romano bb42d2b40e testutil: whitelist os.(*file).close
Leak detector is catching goroutines trying to close files which appear
runtime related:

1 instances of:
syscall.Syscall(...)
	/usr/local/golang/1.8.3/go/src/syscall/asm_linux_386.s:20 +0x5
syscall.Close(...)
	/usr/local/golang/1.8.3/go/src/syscall/zsyscall_linux_386.go:296 +0x3d
os.(*file).close(...)
	/usr/local/golang/1.8.3/go/src/os/file_unix.go:140 +0x62

It's unlikely a user goroutine will leak on file close; whitelist it.
2017-07-19 13:28:15 -07:00
Anthony Romano 026e05518e testutil: whitelist WaitGroup.Done
Calling a WaitGroup.Done() in a defer will sometimes trigger the leak
detector since the WaitGroup.Wait() will unblock before the defer
block completes. If the leak detector runs before the Done() is
rescheduled, it will spuriously report the finishing Done() as a leak.
This happens enough in CI to be irritating; whitelist it and ignore.
2017-07-12 14:04:24 -07:00
Anthony Romano ab95eb0795 transport: accept connection if matched IP SAN but no DNS match
The IP SAN check would always do a DNS SAN check if DNS is given
and the connection's IP is verified. Instead, don't check DNS
entries if there's a matching iP.

Fixes #8206
2017-07-06 16:11:53 -07:00
Anthony Romano 5c7efaa288 adt: Union for interval trees 2017-06-21 14:33:15 -07:00
Anthony Romano 322976bedc transport: CRL checking 2017-06-19 15:23:41 -07:00
Anthony Romano a36d62a30c Merge pull request #8049 from heyitsanthony/flock-base-test
fileutil: test some fallback functionality
2017-06-07 16:12:38 -07:00
Anthony Romano c3fcf0f339 fileutil: test some fallback functionality
syscall.Flock fallback and preallocExtendTrunc
2017-06-07 11:22:40 -07:00
Anthony Romano 87a3c87e45 fileutil: return immediately if preallocating 0 bytes
fallocate will return EINVAL, causing zeroing to the end of a
0 byte file to fail.

Fixes #8045
2017-06-07 09:57:14 -07:00
Anthony Romano 88a3bb74b3 test, osutil: disable setting SIG_DFL on linux if built with cov tag
Was causing etcd to terminate before finishing writing its
coverage profile.
2017-06-05 21:09:35 -07:00
Gyu-Ho Lee d690634bd6 *: remove unused, fix typos
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-05-18 12:11:18 -07:00
Anthony Romano a6a1eb8378 Merge pull request #7949 from heyitsanthony/godocs
*: fill out missing package godocs
2017-05-18 10:23:26 -07:00
Anthony Romano 33c375dc44 *: fill out blank package godocs
Mostly one-liner short descriptions, but also includes some typo fixes
and some examples.
2017-05-18 09:41:13 -07:00
Anthony Romano c09f0ca9d4 report: add NewWeightedReport
Reports with weighted results.
2017-05-17 16:07:20 -07:00
Gyu-Ho Lee fba225cee5 pkg/osutil: fix missing 'syscall' import
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-05-15 14:11:54 -07:00
Anthony Romano 74fd7709ad Merge pull request #7904 from heyitsanthony/osutil-exit
osutil: force SIG_DFL before resending terminating signal
2017-05-15 12:14:37 -07:00
Anthony Romano 6ce9aed8c5 Merge pull request #7881 from heyitsanthony/testctl-logging
e2e: more debugging output for lock and elect tests
2017-05-12 12:01:08 -07:00
Anthony Romano 7a1739a3e8 osutil: force SIG_DFL before resending terminating signal
The go runtime won't always reinstall the default signal handler on the
SIGTERM path, so it's possible the signal won't terminate the process.
Instead, force SIG_DFL for the signal.
2017-05-12 11:56:27 -07:00
Anthony Romano 90893735cf Merge pull request #7917 from heyitsanthony/refactor-backend-paths
snap, etcdserver: tighten up snapshot path handling
2017-05-12 09:33:37 -07:00
Anthony Romano 71d7c85b6b expect: reload DEBUG_EXPECT for each process
Lets e2e test cases selectively turn on expect debugging to get
full application output written to stdout.
2017-05-11 16:09:31 -07:00
Anthony Romano f6cd4d4f5b snap, etcdserver: tighten up snapshot path handling
Computing the snapshot file path is error prone; snapshot recovery was
constructing file paths missing a path separator so the snapshot
would never be loaded. Instead, refactor the backend path handling
to use helper functions where possible.
2017-05-11 13:46:59 -07:00
Gyu-Ho Lee 3505c254e1 pkg/srv: fix error checks from resolveTCPAddr
So that 'terr' can be returned later.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-05-11 10:53:03 -07:00
Anthony Romano 07ad18178d pkg/srv: package for SRV utilities
Trying to decouple the v2 client from SRV code. Can't move
into discovery/ since that creates a circular dependency. So,
give up and move all the SRV code into a new package.
2017-05-05 09:27:59 -07:00
Gyu-Ho Lee 747993de08 Merge pull request #7829 from gyuho/certs
pkg/transport: reload TLS certificates for every client requests
2017-04-27 14:36:53 -07:00
Xiang Li d818ef2c76 pkg/wait: add comment and make List private 2017-04-27 13:25:02 -07:00