mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Upgrade to etcd 3.3.17
This commit is contained in:
		
							
								
								
									
										23
									
								
								vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -16,7 +16,9 @@
 | 
			
		||||
package endpoint
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
@@ -228,13 +230,18 @@ func ParseTarget(target string) (string, string, error) {
 | 
			
		||||
	return parts[0], parts[1], nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ParseHostPort splits a "<host>:<port>" string into the host and port parts.
 | 
			
		||||
// The port part is optional.
 | 
			
		||||
func ParseHostPort(hostPort string) (host string, port string) {
 | 
			
		||||
	parts := strings.SplitN(hostPort, ":", 2)
 | 
			
		||||
	host = parts[0]
 | 
			
		||||
	if len(parts) > 1 {
 | 
			
		||||
		port = parts[1]
 | 
			
		||||
// Dialer dials a endpoint using net.Dialer.
 | 
			
		||||
// Context cancelation and timeout are supported.
 | 
			
		||||
func Dialer(ctx context.Context, dialEp string) (net.Conn, error) {
 | 
			
		||||
	proto, host, _ := ParseEndpoint(dialEp)
 | 
			
		||||
	select {
 | 
			
		||||
	case <-ctx.Done():
 | 
			
		||||
		return nil, ctx.Err()
 | 
			
		||||
	default:
 | 
			
		||||
	}
 | 
			
		||||
	return host, port
 | 
			
		||||
	dialer := &net.Dialer{}
 | 
			
		||||
	if deadline, ok := ctx.Deadline(); ok {
 | 
			
		||||
		dialer.Deadline = deadline
 | 
			
		||||
	}
 | 
			
		||||
	return dialer.DialContext(ctx, proto, host)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										47
									
								
								vendor/github.com/coreos/etcd/clientv3/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								vendor/github.com/coreos/etcd/clientv3/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -25,13 +25,13 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/google/uuid"
 | 
			
		||||
	"github.com/coreos/etcd/clientv3/balancer"
 | 
			
		||||
	"github.com/coreos/etcd/clientv3/balancer/picker"
 | 
			
		||||
	"github.com/coreos/etcd/clientv3/balancer/resolver/endpoint"
 | 
			
		||||
	"github.com/coreos/etcd/clientv3/credentials"
 | 
			
		||||
	"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
 | 
			
		||||
	"github.com/coreos/etcd/pkg/logutil"
 | 
			
		||||
	"github.com/google/uuid"
 | 
			
		||||
	"go.uber.org/zap"
 | 
			
		||||
	"google.golang.org/grpc"
 | 
			
		||||
	"google.golang.org/grpc/codes"
 | 
			
		||||
@@ -226,24 +226,17 @@ func (c *Client) dialSetupOpts(creds grpccredentials.TransportCredentials, dopts
 | 
			
		||||
	}
 | 
			
		||||
	opts = append(opts, dopts...)
 | 
			
		||||
 | 
			
		||||
	// Provide a net dialer that supports cancelation and timeout.
 | 
			
		||||
	f := func(dialEp string, t time.Duration) (net.Conn, error) {
 | 
			
		||||
		proto, host, _ := endpoint.ParseEndpoint(dialEp)
 | 
			
		||||
		select {
 | 
			
		||||
		case <-c.ctx.Done():
 | 
			
		||||
			return nil, c.ctx.Err()
 | 
			
		||||
		default:
 | 
			
		||||
		}
 | 
			
		||||
		dialer := &net.Dialer{Timeout: t}
 | 
			
		||||
		return dialer.DialContext(c.ctx, proto, host)
 | 
			
		||||
	}
 | 
			
		||||
	opts = append(opts, grpc.WithDialer(f))
 | 
			
		||||
 | 
			
		||||
	dialer := endpoint.Dialer
 | 
			
		||||
	if creds != nil {
 | 
			
		||||
		opts = append(opts, grpc.WithTransportCredentials(creds))
 | 
			
		||||
		// gRPC load balancer workaround. See credentials.transportCredential for details.
 | 
			
		||||
		if credsDialer, ok := creds.(TransportCredentialsWithDialer); ok {
 | 
			
		||||
			dialer = credsDialer.Dialer
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		opts = append(opts, grpc.WithInsecure())
 | 
			
		||||
	}
 | 
			
		||||
	opts = append(opts, grpc.WithContextDialer(dialer))
 | 
			
		||||
 | 
			
		||||
	// Interceptor retry and backoff.
 | 
			
		||||
	// TODO: Replace all of clientv3/retry.go with interceptor based retry, or with
 | 
			
		||||
@@ -262,7 +255,10 @@ func (c *Client) dialSetupOpts(creds grpccredentials.TransportCredentials, dopts
 | 
			
		||||
 | 
			
		||||
// Dial connects to a single endpoint using the client's config.
 | 
			
		||||
func (c *Client) Dial(ep string) (*grpc.ClientConn, error) {
 | 
			
		||||
	creds := c.directDialCreds(ep)
 | 
			
		||||
	creds, err := c.directDialCreds(ep)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	// Use the grpc passthrough resolver to directly dial a single endpoint.
 | 
			
		||||
	// This resolver passes through the 'unix' and 'unixs' endpoints schemes used
 | 
			
		||||
	// by etcd without modification, allowing us to directly dial endpoints and
 | 
			
		||||
@@ -365,8 +361,8 @@ func (c *Client) dial(target string, creds grpccredentials.TransportCredentials,
 | 
			
		||||
	return conn, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *Client) directDialCreds(ep string) grpccredentials.TransportCredentials {
 | 
			
		||||
	_, hostPort, scheme := endpoint.ParseEndpoint(ep)
 | 
			
		||||
func (c *Client) directDialCreds(ep string) (grpccredentials.TransportCredentials, error) {
 | 
			
		||||
	_, host, scheme := endpoint.ParseEndpoint(ep)
 | 
			
		||||
	creds := c.creds
 | 
			
		||||
	if len(scheme) != 0 {
 | 
			
		||||
		creds = c.processCreds(scheme)
 | 
			
		||||
@@ -375,12 +371,17 @@ func (c *Client) directDialCreds(ep string) grpccredentials.TransportCredentials
 | 
			
		||||
			// Set the server name must to the endpoint hostname without port since grpc
 | 
			
		||||
			// otherwise attempts to check if x509 cert is valid for the full endpoint
 | 
			
		||||
			// including the scheme and port, which fails.
 | 
			
		||||
			host, _ := endpoint.ParseHostPort(hostPort)
 | 
			
		||||
			clone.OverrideServerName(host)
 | 
			
		||||
			overrideServerName, _, err := net.SplitHostPort(host)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				// Either the host didn't have a port or the host could not be parsed. Either way, continue with the
 | 
			
		||||
				// original host string.
 | 
			
		||||
				overrideServerName = host
 | 
			
		||||
			}
 | 
			
		||||
			clone.OverrideServerName(overrideServerName)
 | 
			
		||||
			creds = clone
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return creds
 | 
			
		||||
	return creds, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *Client) dialWithBalancerCreds(ep string) grpccredentials.TransportCredentials {
 | 
			
		||||
@@ -659,3 +660,9 @@ func IsConnCanceled(err error) bool {
 | 
			
		||||
	// <= gRPC v1.7.x returns 'errors.New("grpc: the client connection is closing")'
 | 
			
		||||
	return strings.Contains(err.Error(), "grpc: the client connection is closing")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TransportCredentialsWithDialer is for a gRPC load balancer workaround. See credentials.transportCredential for details.
 | 
			
		||||
type TransportCredentialsWithDialer interface {
 | 
			
		||||
	grpccredentials.TransportCredentials
 | 
			
		||||
	Dialer(ctx context.Context, dialEp string) (net.Conn, error)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/coreos/etcd/clientv3/credentials/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/coreos/etcd/clientv3/credentials/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -7,6 +7,7 @@ go_library(
 | 
			
		||||
    importpath = "github.com/coreos/etcd/clientv3/credentials",
 | 
			
		||||
    visibility = ["//visibility:public"],
 | 
			
		||||
    deps = [
 | 
			
		||||
        "//vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint:go_default_library",
 | 
			
		||||
        "//vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes:go_default_library",
 | 
			
		||||
        "//vendor/google.golang.org/grpc/credentials:go_default_library",
 | 
			
		||||
    ],
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								vendor/github.com/coreos/etcd/clientv3/credentials/credentials.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										64
									
								
								vendor/github.com/coreos/etcd/clientv3/credentials/credentials.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -22,6 +22,7 @@ import (
 | 
			
		||||
	"net"
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"github.com/coreos/etcd/clientv3/balancer/resolver/endpoint"
 | 
			
		||||
	"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
 | 
			
		||||
	grpccredentials "google.golang.org/grpc/credentials"
 | 
			
		||||
)
 | 
			
		||||
@@ -65,38 +66,37 @@ func (b *bundle) NewWithMode(mode string) (grpccredentials.Bundle, error) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// transportCredential implements "grpccredentials.TransportCredentials" interface.
 | 
			
		||||
// transportCredential wraps TransportCredentials to track which
 | 
			
		||||
// addresses are dialed for which endpoints, and then sets the authority when checking the endpoint's cert to the
 | 
			
		||||
// hostname or IP of the dialed endpoint.
 | 
			
		||||
// This is a workaround of a gRPC load balancer issue. gRPC uses the dialed target's service name as the authority when
 | 
			
		||||
// checking all endpoint certs, which does not work for etcd servers using their hostname or IP as the Subject Alternative Name
 | 
			
		||||
// in their TLS certs.
 | 
			
		||||
// To enable, include both WithTransportCredentials(creds) and WithContextDialer(creds.Dialer)
 | 
			
		||||
// when dialing.
 | 
			
		||||
type transportCredential struct {
 | 
			
		||||
	gtc grpccredentials.TransportCredentials
 | 
			
		||||
	mu  sync.Mutex
 | 
			
		||||
	// addrToEndpoint maps from the connection addresses that are dialed to the hostname or IP of the
 | 
			
		||||
	// endpoint provided to the dialer when dialing
 | 
			
		||||
	addrToEndpoint map[string]string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newTransportCredential(cfg *tls.Config) *transportCredential {
 | 
			
		||||
	return &transportCredential{
 | 
			
		||||
		gtc: grpccredentials.NewTLS(cfg),
 | 
			
		||||
		gtc:            grpccredentials.NewTLS(cfg),
 | 
			
		||||
		addrToEndpoint: map[string]string{},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (tc *transportCredential) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (net.Conn, grpccredentials.AuthInfo, error) {
 | 
			
		||||
	// Only overwrite when authority is an IP address!
 | 
			
		||||
	// Let's say, a server runs SRV records on "etcd.local" that resolves
 | 
			
		||||
	// to "m1.etcd.local", and its SAN field also includes "m1.etcd.local".
 | 
			
		||||
	// But what if SAN does not include its resolved IP address (e.g. 127.0.0.1)?
 | 
			
		||||
	// Then, the server should only authenticate using its DNS hostname "m1.etcd.local",
 | 
			
		||||
	// instead of overwriting it with its IP address.
 | 
			
		||||
	// And we do not overwrite "localhost" either. Only overwrite IP addresses!
 | 
			
		||||
	if isIP(authority) {
 | 
			
		||||
		target := rawConn.RemoteAddr().String()
 | 
			
		||||
		if authority != target {
 | 
			
		||||
			// When user dials with "grpc.WithDialer", "grpc.DialContext" "cc.parsedTarget"
 | 
			
		||||
			// update only happens once. This is problematic, because when TLS is enabled,
 | 
			
		||||
			// retries happen through "grpc.WithDialer" with static "cc.parsedTarget" from
 | 
			
		||||
			// the initial dial call.
 | 
			
		||||
			// If the server authenticates by IP addresses, we want to set a new endpoint as
 | 
			
		||||
			// a new authority. Otherwise
 | 
			
		||||
			// "transport: authentication handshake failed: x509: certificate is valid for 127.0.0.1, 192.168.121.180, not 192.168.223.156"
 | 
			
		||||
			// when the new dial target is "192.168.121.180" whose certificate host name is also "192.168.121.180"
 | 
			
		||||
			// but client tries to authenticate with previously set "cc.parsedTarget" field "192.168.223.156"
 | 
			
		||||
			authority = target
 | 
			
		||||
		}
 | 
			
		||||
	// Set the authority when checking the endpoint's cert to the hostname or IP of the dialed endpoint
 | 
			
		||||
	tc.mu.Lock()
 | 
			
		||||
	dialEp, ok := tc.addrToEndpoint[rawConn.RemoteAddr().String()]
 | 
			
		||||
	tc.mu.Unlock()
 | 
			
		||||
	if ok {
 | 
			
		||||
		_, host, _ := endpoint.ParseEndpoint(dialEp)
 | 
			
		||||
		authority = host
 | 
			
		||||
	}
 | 
			
		||||
	return tc.gtc.ClientHandshake(ctx, authority, rawConn)
 | 
			
		||||
}
 | 
			
		||||
@@ -115,8 +115,15 @@ func (tc *transportCredential) Info() grpccredentials.ProtocolInfo {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (tc *transportCredential) Clone() grpccredentials.TransportCredentials {
 | 
			
		||||
	copy := map[string]string{}
 | 
			
		||||
	tc.mu.Lock()
 | 
			
		||||
	for k, v := range tc.addrToEndpoint {
 | 
			
		||||
		copy[k] = v
 | 
			
		||||
	}
 | 
			
		||||
	tc.mu.Unlock()
 | 
			
		||||
	return &transportCredential{
 | 
			
		||||
		gtc: tc.gtc.Clone(),
 | 
			
		||||
		gtc:            tc.gtc.Clone(),
 | 
			
		||||
		addrToEndpoint: copy,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -124,6 +131,17 @@ func (tc *transportCredential) OverrideServerName(serverNameOverride string) err
 | 
			
		||||
	return tc.gtc.OverrideServerName(serverNameOverride)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (tc *transportCredential) Dialer(ctx context.Context, dialEp string) (net.Conn, error) {
 | 
			
		||||
	// Keep track of which addresses are dialed for which endpoints
 | 
			
		||||
	conn, err := endpoint.Dialer(ctx, dialEp)
 | 
			
		||||
	if conn != nil {
 | 
			
		||||
		tc.mu.Lock()
 | 
			
		||||
		tc.addrToEndpoint[conn.RemoteAddr().String()] = dialEp
 | 
			
		||||
		tc.mu.Unlock()
 | 
			
		||||
	}
 | 
			
		||||
	return conn, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// perRPCCredential implements "grpccredentials.PerRPCCredentials" interface.
 | 
			
		||||
type perRPCCredential struct {
 | 
			
		||||
	authToken   string
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								vendor/github.com/coreos/etcd/embed/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/coreos/etcd/embed/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -273,17 +273,17 @@ func NewConfig() *Config {
 | 
			
		||||
		TickMs:                     100,
 | 
			
		||||
		ElectionMs:                 1000,
 | 
			
		||||
		InitialElectionTickAdvance: true,
 | 
			
		||||
		LPUrls:              []url.URL{*lpurl},
 | 
			
		||||
		LCUrls:              []url.URL{*lcurl},
 | 
			
		||||
		APUrls:              []url.URL{*apurl},
 | 
			
		||||
		ACUrls:              []url.URL{*acurl},
 | 
			
		||||
		ClusterState:        ClusterStateFlagNew,
 | 
			
		||||
		InitialClusterToken: "etcd-cluster",
 | 
			
		||||
		StrictReconfigCheck: DefaultStrictReconfigCheck,
 | 
			
		||||
		LogOutput:           DefaultLogOutput,
 | 
			
		||||
		Metrics:             "basic",
 | 
			
		||||
		EnableV2:            DefaultEnableV2,
 | 
			
		||||
		AuthToken:           "simple",
 | 
			
		||||
		LPUrls:                     []url.URL{*lpurl},
 | 
			
		||||
		LCUrls:                     []url.URL{*lcurl},
 | 
			
		||||
		APUrls:                     []url.URL{*apurl},
 | 
			
		||||
		ACUrls:                     []url.URL{*acurl},
 | 
			
		||||
		ClusterState:               ClusterStateFlagNew,
 | 
			
		||||
		InitialClusterToken:        "etcd-cluster",
 | 
			
		||||
		StrictReconfigCheck:        DefaultStrictReconfigCheck,
 | 
			
		||||
		LogOutput:                  DefaultLogOutput,
 | 
			
		||||
		Metrics:                    "basic",
 | 
			
		||||
		EnableV2:                   DefaultEnableV2,
 | 
			
		||||
		AuthToken:                  "simple",
 | 
			
		||||
	}
 | 
			
		||||
	cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
 | 
			
		||||
	return cfg
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/coreos/etcd/etcdserver/api/v2http/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/coreos/etcd/etcdserver/api/v2http/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -73,11 +73,11 @@ func handleV2(mux *http.ServeMux, server etcdserver.ServerV2, timeout time.Durat
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	mh := &membersHandler{
 | 
			
		||||
		sec:     sec,
 | 
			
		||||
		server:  server,
 | 
			
		||||
		cluster: server.Cluster(),
 | 
			
		||||
		timeout: timeout,
 | 
			
		||||
		clock:   clockwork.NewRealClock(),
 | 
			
		||||
		sec:                   sec,
 | 
			
		||||
		server:                server,
 | 
			
		||||
		cluster:               server.Cluster(),
 | 
			
		||||
		timeout:               timeout,
 | 
			
		||||
		clock:                 clockwork.NewRealClock(),
 | 
			
		||||
		clientCertAuthEnabled: server.ClientCertAuthEnabled(),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/coreos/etcd/mvcc/backend/backend.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/coreos/etcd/mvcc/backend/backend.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -292,7 +292,7 @@ func (b *backend) Defrag() error {
 | 
			
		||||
 | 
			
		||||
func (b *backend) defrag() error {
 | 
			
		||||
	now := time.Now()
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	// TODO: make this non-blocking?
 | 
			
		||||
	// lock batchTx to ensure nobody is using previous tx, and then
 | 
			
		||||
	// close previous ongoing tx.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								vendor/github.com/coreos/etcd/mvcc/kvstore.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								vendor/github.com/coreos/etcd/mvcc/kvstore.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -309,14 +309,7 @@ func (s *store) Restore(b backend.Backend) error {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *store) restore() error {
 | 
			
		||||
	b := s.b
 | 
			
		||||
 | 
			
		||||
	reportDbTotalSizeInBytesMu.Lock()
 | 
			
		||||
	reportDbTotalSizeInBytes = func() float64 { return float64(b.Size()) }
 | 
			
		||||
	reportDbTotalSizeInBytesMu.Unlock()
 | 
			
		||||
	reportDbTotalSizeInUseInBytesMu.Lock()
 | 
			
		||||
	reportDbTotalSizeInUseInBytes = func() float64 { return float64(b.SizeInUse()) }
 | 
			
		||||
	reportDbTotalSizeInUseInBytesMu.Unlock()
 | 
			
		||||
	s.setupMetricsReporter()
 | 
			
		||||
 | 
			
		||||
	min, max := newRevBytes(), newRevBytes()
 | 
			
		||||
	revToBytes(revision{main: 1}, min)
 | 
			
		||||
@@ -496,6 +489,30 @@ func (s *store) ConsistentIndex() uint64 {
 | 
			
		||||
	return v
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *store) setupMetricsReporter() {
 | 
			
		||||
	b := s.b
 | 
			
		||||
	reportDbTotalSizeInBytesMu.Lock()
 | 
			
		||||
	reportDbTotalSizeInBytes = func() float64 { return float64(b.Size()) }
 | 
			
		||||
	reportDbTotalSizeInBytesMu.Unlock()
 | 
			
		||||
	reportDbTotalSizeInUseInBytesMu.Lock()
 | 
			
		||||
	reportDbTotalSizeInUseInBytes = func() float64 { return float64(b.SizeInUse()) }
 | 
			
		||||
	reportDbTotalSizeInUseInBytesMu.Unlock()
 | 
			
		||||
	reportCurrentRevMu.Lock()
 | 
			
		||||
	reportCurrentRev = func() float64 {
 | 
			
		||||
		s.revMu.RLock()
 | 
			
		||||
		defer s.revMu.RUnlock()
 | 
			
		||||
		return float64(s.currentRev)
 | 
			
		||||
	}
 | 
			
		||||
	reportCurrentRevMu.Unlock()
 | 
			
		||||
	reportCompactRevMu.Lock()
 | 
			
		||||
	reportCompactRev = func() float64 {
 | 
			
		||||
		s.revMu.RLock()
 | 
			
		||||
		defer s.revMu.RUnlock()
 | 
			
		||||
		return float64(s.compactMainRev)
 | 
			
		||||
	}
 | 
			
		||||
	reportCompactRevMu.Unlock()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// appendMarkTombstone appends tombstone mark to normal revision bytes.
 | 
			
		||||
func appendMarkTombstone(b []byte) []byte {
 | 
			
		||||
	if len(b) != revBytesLen {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								vendor/github.com/coreos/etcd/mvcc/metrics.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								vendor/github.com/coreos/etcd/mvcc/metrics.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -206,6 +206,38 @@ var (
 | 
			
		||||
		// highest bucket start of 0.01 sec * 2^14 == 163.84 sec
 | 
			
		||||
		Buckets: prometheus.ExponentialBuckets(.01, 2, 15),
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	currentRev = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
 | 
			
		||||
		Namespace: "etcd_debugging",
 | 
			
		||||
		Subsystem: "mvcc",
 | 
			
		||||
		Name:      "current_revision",
 | 
			
		||||
		Help:      "The current revision of store.",
 | 
			
		||||
	},
 | 
			
		||||
		func() float64 {
 | 
			
		||||
			reportCurrentRevMu.RLock()
 | 
			
		||||
			defer reportCurrentRevMu.RUnlock()
 | 
			
		||||
			return reportCurrentRev()
 | 
			
		||||
		},
 | 
			
		||||
	)
 | 
			
		||||
	// overridden by mvcc initialization
 | 
			
		||||
	reportCurrentRevMu sync.RWMutex
 | 
			
		||||
	reportCurrentRev   = func() float64 { return 0 }
 | 
			
		||||
 | 
			
		||||
	compactRev = prometheus.NewGaugeFunc(prometheus.GaugeOpts{
 | 
			
		||||
		Namespace: "etcd_debugging",
 | 
			
		||||
		Subsystem: "mvcc",
 | 
			
		||||
		Name:      "compact_revision",
 | 
			
		||||
		Help:      "The revision of the last compaction in store.",
 | 
			
		||||
	},
 | 
			
		||||
		func() float64 {
 | 
			
		||||
			reportCompactRevMu.RLock()
 | 
			
		||||
			defer reportCompactRevMu.RUnlock()
 | 
			
		||||
			return reportCompactRev()
 | 
			
		||||
		},
 | 
			
		||||
	)
 | 
			
		||||
	// overridden by mvcc initialization
 | 
			
		||||
	reportCompactRevMu sync.RWMutex
 | 
			
		||||
	reportCompactRev   = func() float64 { return 0 }
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
@@ -228,6 +260,8 @@ func init() {
 | 
			
		||||
	prometheus.MustRegister(dbTotalSizeInUse)
 | 
			
		||||
	prometheus.MustRegister(hashDurations)
 | 
			
		||||
	prometheus.MustRegister(hashRevDurations)
 | 
			
		||||
	prometheus.MustRegister(currentRev)
 | 
			
		||||
	prometheus.MustRegister(compactRev)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ReportEventReceived reports that an event is received.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/github.com/coreos/etcd/pkg/testutil/leak.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/coreos/etcd/pkg/testutil/leak.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -70,13 +70,13 @@ func CheckAfterTest(d time.Duration) error {
 | 
			
		||||
	}
 | 
			
		||||
	var bad string
 | 
			
		||||
	badSubstring := map[string]string{
 | 
			
		||||
		").writeLoop(":                                 "a Transport",
 | 
			
		||||
		").writeLoop(": "a Transport",
 | 
			
		||||
		"created by net/http/httptest.(*Server).Start": "an httptest.Server",
 | 
			
		||||
		"timeoutHandler":                               "a TimeoutHandler",
 | 
			
		||||
		"net.(*netFD).connect(":                        "a timing out dial",
 | 
			
		||||
		").noteClientGone(":                            "a closenotifier sender",
 | 
			
		||||
		").readLoop(":                                  "a Transport",
 | 
			
		||||
		".grpc":                                        "a gRPC resource",
 | 
			
		||||
		"timeoutHandler":        "a TimeoutHandler",
 | 
			
		||||
		"net.(*netFD).connect(": "a timing out dial",
 | 
			
		||||
		").noteClientGone(":     "a closenotifier sender",
 | 
			
		||||
		").readLoop(":           "a Transport",
 | 
			
		||||
		".grpc":                 "a gRPC resource",
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var stacks string
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/github.com/coreos/etcd/pkg/transport/listener.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/coreos/etcd/pkg/transport/listener.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -53,6 +53,9 @@ func wrapTLS(addr, scheme string, tlsinfo *TLSInfo, l net.Listener) (net.Listene
 | 
			
		||||
	if scheme != "https" && scheme != "unixs" {
 | 
			
		||||
		return l, nil
 | 
			
		||||
	}
 | 
			
		||||
	if tlsinfo != nil && tlsinfo.SkipClientSANVerify {
 | 
			
		||||
		return NewTLSListener(l, tlsinfo)
 | 
			
		||||
	}
 | 
			
		||||
	return newTLSListener(l, tlsinfo, checkSAN)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -65,6 +68,8 @@ type TLSInfo struct {
 | 
			
		||||
	CRLFile            string
 | 
			
		||||
	InsecureSkipVerify bool
 | 
			
		||||
 | 
			
		||||
	SkipClientSANVerify bool
 | 
			
		||||
 | 
			
		||||
	// ServerName ensures the cert matches the given host in case of discovery / virtual hosting
 | 
			
		||||
	ServerName string
 | 
			
		||||
 | 
			
		||||
@@ -95,7 +100,7 @@ func (info TLSInfo) Empty() bool {
 | 
			
		||||
	return info.CertFile == "" && info.KeyFile == ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func SelfCert(dirpath string, hosts []string) (info TLSInfo, err error) {
 | 
			
		||||
func SelfCert(dirpath string, hosts []string, additionalUsages ...x509.ExtKeyUsage) (info TLSInfo, err error) {
 | 
			
		||||
	if err = os.MkdirAll(dirpath, 0700); err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -124,7 +129,7 @@ func SelfCert(dirpath string, hosts []string) (info TLSInfo, err error) {
 | 
			
		||||
		NotAfter:     time.Now().Add(365 * (24 * time.Hour)),
 | 
			
		||||
 | 
			
		||||
		KeyUsage:              x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
 | 
			
		||||
		ExtKeyUsage:           []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
 | 
			
		||||
		ExtKeyUsage:           append([]x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, additionalUsages...),
 | 
			
		||||
		BasicConstraintsValid: true,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/coreos/etcd/version/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/coreos/etcd/version/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -26,7 +26,7 @@ import (
 | 
			
		||||
var (
 | 
			
		||||
	// MinClusterVersion is the min cluster version this etcd binary is compatible with.
 | 
			
		||||
	MinClusterVersion = "3.0.0"
 | 
			
		||||
	Version           = "3.3.15"
 | 
			
		||||
	Version           = "3.3.17"
 | 
			
		||||
	APIVersion        = "unknown"
 | 
			
		||||
 | 
			
		||||
	// Git SHA Value will be set during build
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user