Skip to content

Commit

Permalink
Vendor new swarmkit and etcd/raft.
Browse files Browse the repository at this point in the history
This brings in a much newer version of etcd/raft.

An unrelated change in swarmkit should fix some problems with
integration tests on ARM.

Signed-off-by: Aaron Lehmann <[email protected]>
  • Loading branch information
aaronlehmann committed Aug 12, 2016
1 parent 5947bf4 commit be48cfc
Show file tree
Hide file tree
Showing 118 changed files with 5,942 additions and 752 deletions.
7 changes: 3 additions & 4 deletions hack/vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ clone git github.com/vishvananda/netlink e73bad418fd727ed3a02830b1af1ad0283a1de6
clone git github.com/BurntSushi/toml f706d00e3de6abe700c994cdd545a1a4915af060
clone git github.com/samuel/go-zookeeper d0e0d8e11f318e000a8cc434616d69e329edc374
clone git github.com/deckarep/golang-set ef32fa3046d9f249d399f98ebaf9be944430fd1d
clone git github.com/coreos/etcd v2.3.2
fix_rewritten_imports github.com/coreos/etcd
clone git github.com/coreos/etcd 06e2338108fdc694349aed923f4a7e45cf0cec1f
clone git github.com/ugorji/go f1f1a805ed361a0e078bb537e4ea78cd37dcf065
clone git github.com/hashicorp/consul v0.5.2
clone git github.com/boltdb/bolt v1.2.1
Expand Down Expand Up @@ -140,7 +139,7 @@ clone git github.com/docker/docker-credential-helpers v0.3.0
clone git github.com/docker/containerd 0ac3cd1be170d180b2baed755e8f0da547ceb267

# cluster
clone git github.com/docker/swarmkit cb6d81316727941665594f153434e5ce2e425c9b
clone git github.com/docker/swarmkit d5f249ec9a52ea48e875b5335a3a0c50f60db550
clone git github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
clone git github.com/gogo/protobuf 43a2e0b1c32252bfbbdf81f7faa7a88fb3fa4028
clone git github.com/cloudflare/cfssl b895b0549c0ff676f92cf09ba971ae02bb41367b
Expand All @@ -150,7 +149,7 @@ clone git github.com/mreiferson/go-httpclient 63fe23f7434723dc904c901043af07931f
clone git github.com/hashicorp/go-memdb 98f52f52d7a476958fa9da671354d270c50661a7
clone git github.com/hashicorp/go-immutable-radix 8e8ed81f8f0bf1bdd829593fdd5c29922c1ea990
clone git github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4
clone git github.com/coreos/pkg 2c77715c4df99b5420ffcae14ead08f52104065d
clone git github.com/coreos/pkg fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8
clone git github.com/pivotal-golang/clock 3fd3c1944c59d9742e1cd333672181cd1a6f9fa0
clone git github.com/prometheus/client_golang e51041b3fa41cece0dca035740ba6411905be473
clone git github.com/beorn7/perks b965b613227fddccbfffe13eae360ed3fa822f8d
Expand Down
9 changes: 8 additions & 1 deletion vendor/src/github.com/coreos/etcd/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ etcd/client is the Go client library for etcd.

[![GoDoc](https://godoc.org/github.com/coreos/etcd/client?status.png)](https://godoc.org/github.com/coreos/etcd/client)

etcd uses `cmd/vendor` directory to store external dependencies, which are
to be compiled into etcd release binaries. `client` can be imported without
vendoring. For full compatibility, it is recommended to vendor builds using
etcd's vendored packages, using tools like godep, as in
[vendor directories](https://golang.org/cmd/go/#hdr-Vendor_Directories).
For more detail, please read [Go vendor design](https://golang.org/s/go15vendor).

## Install

```bash
Expand All @@ -19,7 +26,7 @@ import (
"log"
"time"

"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
"golang.org/x/net/context"
"github.com/coreos/etcd/client"
)

Expand Down
2 changes: 1 addition & 1 deletion vendor/src/github.com/coreos/etcd/client/auth_role.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
6 changes: 1 addition & 5 deletions vendor/src/github.com/coreos/etcd/client/auth_user.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,10 +47,6 @@ type UserRoles struct {
Roles []Role `json:"roles"`
}

type userName struct {
User string `json:"user"`
}

func v2AuthURL(ep url.URL, action string, name string) *url.URL {
if name != "" {
ep.Path = path.Join(ep.Path, defaultV2AuthPrefix, action, name)
Expand Down
2 changes: 0 additions & 2 deletions vendor/src/github.com/coreos/etcd/client/cancelreq.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

// borrowed from golang/net/context/ctxhttp/cancelreq.go

// +build go1.5

package client

import "net/http"
Expand Down
17 changes: 0 additions & 17 deletions vendor/src/github.com/coreos/etcd/client/cancelreq_go14.go

This file was deleted.

17 changes: 14 additions & 3 deletions vendor/src/github.com/coreos/etcd/client/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,6 +37,10 @@ var (
ErrClusterUnavailable = errors.New("client: etcd cluster is unavailable or misconfigured")
ErrNoLeaderEndpoint = errors.New("client: no leader endpoint available")
errTooManyRedirectChecks = errors.New("client: too many redirect checks")

// oneShotCtxValue is set on a context using WithValue(&oneShotValue) so
// that Do() will not retry a request
oneShotCtxValue interface{}
)

var DefaultRequestTimeout = 5 * time.Second
Expand Down Expand Up @@ -301,7 +305,7 @@ func (c *httpClusterClient) SetEndpoints(eps []string) error {
// If endpoints doesn't have the lu, just keep c.pinned = 0.
// Forwarding between follower and leader would be required but it works.
default:
return errors.New(fmt.Sprintf("invalid endpoint selection mode: %d", c.selectionMode))
return fmt.Errorf("invalid endpoint selection mode: %d", c.selectionMode)
}

return nil
Expand Down Expand Up @@ -335,6 +339,7 @@ func (c *httpClusterClient) Do(ctx context.Context, act httpAction) (*http.Respo
var body []byte
var err error
cerr := &ClusterError{}
isOneShot := ctx.Value(&oneShotCtxValue) != nil

for i := pinned; i < leps+pinned; i++ {
k := i % leps
Expand All @@ -348,6 +353,9 @@ func (c *httpClusterClient) Do(ctx context.Context, act httpAction) (*http.Respo
if err == context.Canceled || err == context.DeadlineExceeded {
return nil, nil, err
}
if isOneShot {
return nil, nil, err
}
continue
}
if resp.StatusCode/100 == 5 {
Expand All @@ -358,6 +366,9 @@ func (c *httpClusterClient) Do(ctx context.Context, act httpAction) (*http.Respo
default:
cerr.Errors = append(cerr.Errors, fmt.Errorf("client: etcd member %s returns server error [%s]", eps[k].String(), http.StatusText(resp.StatusCode)))
}
if isOneShot {
return nil, nil, cerr.Errors[0]
}
continue
}
if k != pinned {
Expand Down Expand Up @@ -393,7 +404,7 @@ func (c *httpClusterClient) Sync(ctx context.Context) error {
c.Lock()
defer c.Unlock()

eps := make([]string, 0)
var eps []string
for _, m := range ms {
eps = append(eps, m.ClientURLs...)
}
Expand Down
8 changes: 6 additions & 2 deletions vendor/src/github.com/coreos/etcd/client/cluster_error.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,11 @@ type ClusterError struct {
}

func (ce *ClusterError) Error() string {
return ErrClusterUnavailable.Error()
s := ErrClusterUnavailable.Error()
for i, e := range ce.Errors {
s += fmt.Sprintf("; error #%d: %s\n", i, e)
}
return s
}

func (ce *ClusterError) Detail() string {
Expand Down
2 changes: 1 addition & 1 deletion vendor/src/github.com/coreos/etcd/client/curl.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion vendor/src/github.com/coreos/etcd/client/discover.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 3 additions & 1 deletion vendor/src/github.com/coreos/etcd/client/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,6 +34,8 @@ Create a Config and exchange it for a Client:
// handle error
}
Clients are safe for concurrent use by multiple goroutines.
Create a KeysAPI using the Client, then use it to interact with etcd:
kAPI := client.NewKeysAPI(c)
Expand Down
13 changes: 9 additions & 4 deletions vendor/src/github.com/coreos/etcd/client/keys.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -26,9 +26,9 @@ import (
"strings"
"time"

"github.com/coreos/etcd/pkg/pathutil"
"github.com/ugorji/go/codec"
"golang.org/x/net/context"
"github.com/coreos/etcd/pkg/pathutil"
)

const (
Expand Down Expand Up @@ -337,7 +337,11 @@ func (k *httpKeysAPI) Set(ctx context.Context, key, val string, opts *SetOptions
act.Dir = opts.Dir
}

resp, body, err := k.client.Do(ctx, act)
doCtx := ctx
if act.PrevExist == PrevNoExist {
doCtx = context.WithValue(doCtx, &oneShotCtxValue, &oneShotCtxValue)
}
resp, body, err := k.client.Do(doCtx, act)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -385,7 +389,8 @@ func (k *httpKeysAPI) Delete(ctx context.Context, key string, opts *DeleteOption
act.Recursive = opts.Recursive
}

resp, body, err := k.client.Do(ctx, act)
doCtx := context.WithValue(ctx, &oneShotCtxValue, &oneShotCtxValue)
resp, body, err := k.client.Do(doCtx, act)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/src/github.com/coreos/etcd/client/members.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion vendor/src/github.com/coreos/etcd/client/srv.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015 CoreOS, Inc.
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
32 changes: 31 additions & 1 deletion vendor/src/github.com/coreos/etcd/client/util.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016 CoreOS, Inc.
// Copyright 2016 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,10 +14,40 @@

package client

import (
"regexp"
)

var (
roleNotFoundRegExp *regexp.Regexp
userNotFoundRegExp *regexp.Regexp
)

func init() {
roleNotFoundRegExp = regexp.MustCompile("auth: Role .* does not exist.")
userNotFoundRegExp = regexp.MustCompile("auth: User .* does not exist.")
}

// IsKeyNotFound returns true if the error code is ErrorCodeKeyNotFound.
func IsKeyNotFound(err error) bool {
if cErr, ok := err.(Error); ok {
return cErr.Code == ErrorCodeKeyNotFound
}
return false
}

// IsRoleNotFound returns true if the error means role not found of v2 API.
func IsRoleNotFound(err error) bool {
if ae, ok := err.(authError); ok {
return roleNotFoundRegExp.MatchString(ae.Message)
}
return false
}

// IsUserNotFound returns true if the error means user not found of v2 API.
func IsUserNotFound(err error) bool {
if ae, ok := err.(authError); ok {
return userNotFoundRegExp.MatchString(ae.Message)
}
return false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit be48cfc

Please sign in to comment.