From 1d600ebcb5750c4c93356fae08e562d836ecee45 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Wed, 13 Jul 2016 19:09:07 -0700 Subject: [PATCH 1/3] Allow partial name match for `service ls --filter` This fix tries to address the issue raised in 24270 where it was not possible to have a partial name match when list services with name filter. This fix updates swarmkit and allows prefix search when name is provided as the filter for listing services. An additional integration test is added to cover the changes. This fix fixes 24270. Note: A separate pull request will be opened on swarmkit. Signed-off-by: Yong Tang --- daemon/cluster/filters.go | 6 ++-- integration-cli/docker_cli_swarm_test.go | 42 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/daemon/cluster/filters.go b/daemon/cluster/filters.go index 26fc65627e..70e7c34b14 100644 --- a/daemon/cluster/filters.go +++ b/daemon/cluster/filters.go @@ -55,9 +55,9 @@ func newListServicesFilters(filter filters.Args) (*swarmapi.ListServicesRequest_ return nil, err } return &swarmapi.ListServicesRequest_Filters{ - Names: filter.Get("name"), - IDPrefixes: filter.Get("id"), - Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")), + NamePrefixes: filter.Get("name"), + IDPrefixes: filter.Get("id"), + Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")), }, nil } diff --git a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go index dffa2f4834..335526376f 100644 --- a/integration-cli/docker_cli_swarm_test.go +++ b/integration-cli/docker_cli_swarm_test.go @@ -169,3 +169,45 @@ func (s *DockerSwarmSuite) TestSwarmNodeListHostname(c *check.C) { c.Assert(err, checker.IsNil) c.Assert(strings.Split(out, "\n")[0], checker.Contains, "HOSTNAME") } + +// Test case for #24270 +func (s *DockerSwarmSuite) TestSwarmServiceListFilter(c *check.C) { + d := s.AddDaemon(c, true, true) + + name1 := "redis-cluster-md5" + name2 := "redis-cluster" + name3 := "other-cluster" + out, err := d.Cmd("service", "create", "--name", name1, "busybox", "top") + c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") + + out, err = d.Cmd("service", "create", "--name", name2, "busybox", "top") + c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") + + out, err = d.Cmd("service", "create", "--name", name3, "busybox", "top") + c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") + + filter1 := "name=redis-cluster-md5" + filter2 := "name=redis-cluster" + + // We search checker.Contains with `name+" "` to prevent prefix only. + out, err = d.Cmd("service", "ls", "--filter", filter1) + c.Assert(err, checker.IsNil) + c.Assert(out, checker.Contains, name1+" ") + c.Assert(out, checker.Not(checker.Contains), name2+" ") + c.Assert(out, checker.Not(checker.Contains), name3+" ") + + out, err = d.Cmd("service", "ls", "--filter", filter2) + c.Assert(err, checker.IsNil) + c.Assert(out, checker.Contains, name1+" ") + c.Assert(out, checker.Contains, name2+" ") + c.Assert(out, checker.Not(checker.Contains), name3+" ") + + out, err = d.Cmd("service", "ls") + c.Assert(err, checker.IsNil) + c.Assert(out, checker.Contains, name1+" ") + c.Assert(out, checker.Contains, name2+" ") + c.Assert(out, checker.Contains, name3+" ") +} From e734fa58eadb4dfaa33b4be275d6f8f29d899e78 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Sun, 17 Jul 2016 13:21:29 -0700 Subject: [PATCH 2/3] Allow partial name match for `node ls`, and `node tasks` This fix is an extension to last commit to expand the partial filter to node and task searches. Additional integration tests have been added to cover the changes. This fix fixes 24270. This fix fixes 24112. Note: A separate pull request will be opened on swarmkit. Signed-off-by: Yong Tang --- daemon/cluster/filters.go | 16 ++++----- integration-cli/docker_cli_swarm_test.go | 42 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/daemon/cluster/filters.go b/daemon/cluster/filters.go index 70e7c34b14..c49ea7b39b 100644 --- a/daemon/cluster/filters.go +++ b/daemon/cluster/filters.go @@ -21,9 +21,9 @@ func newListNodesFilters(filter filters.Args) (*swarmapi.ListNodesRequest_Filter return nil, err } f := &swarmapi.ListNodesRequest_Filters{ - Names: filter.Get("name"), - IDPrefixes: filter.Get("id"), - Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")), + NamePrefixes: filter.Get("name"), + IDPrefixes: filter.Get("id"), + Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")), } for _, r := range filter.Get("role") { @@ -79,11 +79,11 @@ func newListTasksFilters(filter filters.Args, transformFunc func(filters.Args) e } } f := &swarmapi.ListTasksRequest_Filters{ - Names: filter.Get("name"), - IDPrefixes: filter.Get("id"), - Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")), - ServiceIDs: filter.Get("service"), - NodeIDs: filter.Get("node"), + NamePrefixes: filter.Get("name"), + IDPrefixes: filter.Get("id"), + Labels: runconfigopts.ConvertKVStringsToMap(filter.Get("label")), + ServiceIDs: filter.Get("service"), + NodeIDs: filter.Get("node"), } for _, s := range filter.Get("desired-state") { diff --git a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go index 335526376f..8f6ee9d54d 100644 --- a/integration-cli/docker_cli_swarm_test.go +++ b/integration-cli/docker_cli_swarm_test.go @@ -211,3 +211,45 @@ func (s *DockerSwarmSuite) TestSwarmServiceListFilter(c *check.C) { c.Assert(out, checker.Contains, name2+" ") c.Assert(out, checker.Contains, name3+" ") } + +func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *check.C) { + d := s.AddDaemon(c, true, true) + + out, err := d.Cmd("node", "inspect", "--format", "{{ .Description.Hostname }}", "self") + c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") + name := strings.TrimSpace(out) + + filter := "name=" + name[:4] + + out, err = d.Cmd("node", "ls", "--filter", filter) + c.Assert(err, checker.IsNil) + c.Assert(out, checker.Contains, name) + + out, err = d.Cmd("node", "ls", "--filter", "name=none") + c.Assert(err, checker.IsNil) + c.Assert(out, checker.Not(checker.Contains), name) +} + +func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *check.C) { + d := s.AddDaemon(c, true, true) + + name := "redis-cluster-md5" + out, err := d.Cmd("service", "create", "--name", name, "--replicas=3", "busybox", "top") + c.Assert(err, checker.IsNil) + c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") + + filter := "name=redis-cluster" + + out, err = d.Cmd("node", "tasks", "--filter", filter, "self") + c.Assert(err, checker.IsNil) + c.Assert(out, checker.Contains, name+".1") + c.Assert(out, checker.Contains, name+".2") + c.Assert(out, checker.Contains, name+".3") + + out, err = d.Cmd("node", "tasks", "--filter", "name=none", "self") + c.Assert(err, checker.IsNil) + c.Assert(out, checker.Not(checker.Contains), name+".1") + c.Assert(out, checker.Not(checker.Contains), name+".2") + c.Assert(out, checker.Not(checker.Contains), name+".3") +} From 467107cd401ce9d3678e4f7ec1abfb65a0e46018 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Wed, 20 Jul 2016 08:16:54 -0700 Subject: [PATCH 3/3] Vendor swarmkit to 9ee5fc3b8db5de8c8593a57bc45fc178f74ceee1 This commit update swarmkit to 9ee5fc3b8db5de8c8593a57bc45fc178f74ceee1. This is part of step to fix #24270. Signed-off-by: Yong Tang --- hack/vendor.sh | 2 +- .../github.com/docker/swarmkit/agent/node.go | 208 ++++---- .../docker/swarmkit/api/control.pb.go | 492 ++++++++++++++---- .../docker/swarmkit/api/control.proto | 10 + .../swarmkit/manager/allocator/network.go | 62 +-- .../networkallocator/networkallocator.go | 52 +- .../swarmkit/manager/controlapi/cluster.go | 5 + .../swarmkit/manager/controlapi/network.go | 5 + .../swarmkit/manager/controlapi/node.go | 31 +- .../swarmkit/manager/controlapi/service.go | 5 + .../swarmkit/manager/controlapi/task.go | 5 + .../docker/swarmkit/manager/manager.go | 18 +- .../manager/state/raft/membership/cluster.go | 13 +- .../swarmkit/manager/state/raft/raft.go | 18 +- .../docker/swarmkit/manager/state/store/by.go | 10 + .../swarmkit/manager/state/store/clusters.go | 6 +- .../swarmkit/manager/state/store/memory.go | 6 + .../swarmkit/manager/state/store/networks.go | 6 +- .../swarmkit/manager/state/store/nodes.go | 6 +- .../swarmkit/manager/state/store/services.go | 6 +- .../swarmkit/manager/state/store/tasks.go | 6 +- 21 files changed, 724 insertions(+), 248 deletions(-) diff --git a/hack/vendor.sh b/hack/vendor.sh index d5f00ce36d..98753439b6 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -139,7 +139,7 @@ clone git github.com/docker/docker-credential-helpers v0.3.0 clone git github.com/docker/containerd 1b3a81545ca79456086dc2aa424357be98b962ee # cluster -clone git github.com/docker/swarmkit 6478bc19cf4bc1d7ba2d6f04ccaacf099508f4a0 +clone git github.com/docker/swarmkit 9ee5fc3b8db5de8c8593a57bc45fc178f74ceee1 clone git github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9 clone git github.com/gogo/protobuf 43a2e0b1c32252bfbbdf81f7faa7a88fb3fa4028 clone git github.com/cloudflare/cfssl b895b0549c0ff676f92cf09ba971ae02bb41367b diff --git a/vendor/src/github.com/docker/swarmkit/agent/node.go b/vendor/src/github.com/docker/swarmkit/agent/node.go index 5d637abe1e..d073fd9847 100644 --- a/vendor/src/github.com/docker/swarmkit/agent/node.go +++ b/vendor/src/github.com/docker/swarmkit/agent/node.go @@ -85,6 +85,7 @@ type Node struct { config *NodeConfig remotes *persistentRemotes role string + roleCond *sync.Cond conn *grpc.ClientConn connCond *sync.Cond nodeID string @@ -98,7 +99,6 @@ type Node struct { agent *Agent manager *manager.Manager roleChangeReq chan api.NodeRole // used to send role updates from the dispatcher api on promotion/demotion - managerRoleCh chan struct{} } // NewNode returns new Node instance. @@ -128,8 +128,8 @@ func NewNode(c *NodeConfig) (*Node, error) { ready: make(chan struct{}), certificateRequested: make(chan struct{}), roleChangeReq: make(chan api.NodeRole, 1), - managerRoleCh: make(chan struct{}, 32), // 32 just for the case } + n.roleCond = sync.NewCond(n.RLocker()) n.connCond = sync.NewCond(n.RLocker()) if err := n.loadCertificates(); err != nil { return nil, err @@ -240,28 +240,34 @@ func (n *Node) run(ctx context.Context) (err error) { return err } - if n.role == ca.ManagerRole { - n.managerRoleCh <- struct{}{} - } - forceCertRenewal := make(chan struct{}) go func() { - n.RLock() - lastRole := n.role - n.RUnlock() for { select { case <-ctx.Done(): return case apirole := <-n.roleChangeReq: + n.Lock() + lastRole := n.role role := ca.AgentRole if apirole == api.NodeRoleManager { role = ca.ManagerRole } - if lastRole != role { - forceCertRenewal <- struct{}{} + if lastRole == role { + n.Unlock() + continue + } + // switch role to agent immediately to shutdown manager early + if role == ca.AgentRole { + n.role = role + n.roleCond.Broadcast() + } + n.Unlock() + select { + case forceCertRenewal <- struct{}{}: + case <-ctx.Done(): + return } - lastRole = role } } }() @@ -271,18 +277,13 @@ func (n *Node) run(ctx context.Context) (err error) { for { select { case certUpdate := <-updates: - if ctx.Err() != nil { - return - } if certUpdate.Err != nil { logrus.Warnf("error renewing TLS certificate: %v", certUpdate.Err) continue } n.Lock() n.role = certUpdate.Role - if n.role == ca.ManagerRole { - n.managerRoleCh <- struct{}{} - } + n.roleCond.Broadcast() n.Unlock() case <-ctx.Done(): return @@ -535,6 +536,7 @@ func (n *Node) loadCertificates() error { n.role = clientTLSCreds.Role() n.nodeID = clientTLSCreds.NodeID() n.nodeMembership = api.NodeMembershipAccepted + n.roleCond.Broadcast() n.Unlock() return nil @@ -571,8 +573,8 @@ func (n *Node) initManagerConnection(ctx context.Context, ready chan<- struct{}) n.setControlSocket(conn) if ready != nil { close(ready) + ready = nil } - ready = nil } else if state == grpc.Shutdown { n.setControlSocket(nil) } @@ -580,85 +582,101 @@ func (n *Node) initManagerConnection(ctx context.Context, ready chan<- struct{}) } } +func (n *Node) waitRole(ctx context.Context, role string) error { + n.roleCond.L.Lock() + if role == n.role { + n.roleCond.L.Unlock() + return nil + } + finishCh := make(chan struct{}) + defer close(finishCh) + go func() { + select { + case <-finishCh: + case <-ctx.Done(): + // call broadcast to shutdown this function + n.roleCond.Broadcast() + } + }() + defer n.roleCond.L.Unlock() + for role != n.role { + n.roleCond.Wait() + if ctx.Err() != nil { + return ctx.Err() + } + } + return nil +} + func (n *Node) runManager(ctx context.Context, securityConfig *ca.SecurityConfig, ready chan struct{}) error { for { - select { - case <-ctx.Done(): - return ctx.Err() - case <-n.managerRoleCh: - if ctx.Err() != nil { - return ctx.Err() - } - n.Lock() - // in case if we missed some notifications - if n.role != ca.ManagerRole { - n.Unlock() - continue - } - n.Unlock() - remoteAddr, _ := n.remotes.Select(n.nodeID) - m, err := manager.New(&manager.Config{ - ForceNewCluster: n.config.ForceNewCluster, - ProtoAddr: map[string]string{ - "tcp": n.config.ListenRemoteAPI, - "unix": n.config.ListenControlAPI, - }, - SecurityConfig: securityConfig, - ExternalCAs: n.config.ExternalCAs, - JoinRaft: remoteAddr.Addr, - StateDir: n.config.StateDir, - HeartbeatTick: n.config.HeartbeatTick, - ElectionTick: n.config.ElectionTick, - }) - if err != nil { - return err - } - done := make(chan struct{}) - go func() { - m.Run(context.Background()) // todo: store error - close(done) - }() - - n.Lock() - n.manager = m - n.Unlock() - - connCtx, connCancel := context.WithCancel(ctx) - go n.initManagerConnection(connCtx, ready) - - // this happens only on initial start - if ready != nil { - go func(ready chan struct{}) { - select { - case <-ready: - n.remotes.Observe(api.Peer{NodeID: n.nodeID, Addr: n.config.ListenRemoteAPI}, 5) - case <-connCtx.Done(): - } - }(ready) - } - - ready = nil - - select { - case <-ctx.Done(): - m.Stop(context.Background()) // todo: this should be sync like other components - <-done - // in case of demotion manager will stop itself - case <-done: - } - connCancel() - - n.Lock() - n.manager = nil - if n.conn != nil { - n.conn.Close() - } - n.Unlock() - - if ctx.Err() != nil { - return err - } + if err := n.waitRole(ctx, ca.ManagerRole); err != nil { + return err } + if ctx.Err() != nil { + return ctx.Err() + } + remoteAddr, _ := n.remotes.Select(n.nodeID) + m, err := manager.New(&manager.Config{ + ForceNewCluster: n.config.ForceNewCluster, + ProtoAddr: map[string]string{ + "tcp": n.config.ListenRemoteAPI, + "unix": n.config.ListenControlAPI, + }, + SecurityConfig: securityConfig, + ExternalCAs: n.config.ExternalCAs, + JoinRaft: remoteAddr.Addr, + StateDir: n.config.StateDir, + HeartbeatTick: n.config.HeartbeatTick, + ElectionTick: n.config.ElectionTick, + }) + if err != nil { + return err + } + done := make(chan struct{}) + go func() { + m.Run(context.Background()) // todo: store error + close(done) + }() + + n.Lock() + n.manager = m + n.Unlock() + + connCtx, connCancel := context.WithCancel(ctx) + go n.initManagerConnection(connCtx, ready) + + // this happens only on initial start + if ready != nil { + go func(ready chan struct{}) { + select { + case <-ready: + n.remotes.Observe(api.Peer{NodeID: n.nodeID, Addr: n.config.ListenRemoteAPI}, 5) + case <-connCtx.Done(): + } + }(ready) + ready = nil + } + + if err := n.waitRole(ctx, ca.AgentRole); err != nil { + m.Stop(context.Background()) + } + + select { + case <-done: + case <-ctx.Done(): + m.Stop(context.Background()) + return ctx.Err() + } + + connCancel() + + n.Lock() + n.manager = nil + if n.conn != nil { + n.conn.Close() + } + n.Unlock() } } diff --git a/vendor/src/github.com/docker/swarmkit/api/control.pb.go b/vendor/src/github.com/docker/swarmkit/api/control.pb.go index dc3050cbe0..08dfb8521e 100644 --- a/vendor/src/github.com/docker/swarmkit/api/control.pb.go +++ b/vendor/src/github.com/docker/swarmkit/api/control.pb.go @@ -64,6 +64,8 @@ type ListNodesRequest_Filters struct { Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Memberships []NodeSpec_Membership `protobuf:"varint,4,rep,name=memberships,enum=docker.swarmkit.v1.NodeSpec_Membership" json:"memberships,omitempty"` Roles []NodeRole `protobuf:"varint,5,rep,name=roles,enum=docker.swarmkit.v1.NodeRole" json:"roles,omitempty"` + // NamePrefixes matches all objects with the given prefixes + NamePrefixes []string `protobuf:"bytes,6,rep,name=name_prefixes,json=namePrefixes" json:"name_prefixes,omitempty"` } func (m *ListNodesRequest_Filters) Reset() { *m = ListNodesRequest_Filters{} } @@ -163,6 +165,8 @@ type ListTasksRequest_Filters struct { ServiceIDs []string `protobuf:"bytes,4,rep,name=service_ids,json=serviceIds" json:"service_ids,omitempty"` NodeIDs []string `protobuf:"bytes,5,rep,name=node_ids,json=nodeIds" json:"node_ids,omitempty"` DesiredStates []TaskState `protobuf:"varint,6,rep,name=desired_states,json=desiredStates,enum=docker.swarmkit.v1.TaskState" json:"desired_states,omitempty"` + // NamePrefixes matches all objects with the given prefixes + NamePrefixes []string `protobuf:"bytes,7,rep,name=name_prefixes,json=namePrefixes" json:"name_prefixes,omitempty"` } func (m *ListTasksRequest_Filters) Reset() { *m = ListTasksRequest_Filters{} } @@ -256,6 +260,8 @@ type ListServicesRequest_Filters struct { Names []string `protobuf:"bytes,1,rep,name=names" json:"names,omitempty"` IDPrefixes []string `protobuf:"bytes,2,rep,name=id_prefixes,json=idPrefixes" json:"id_prefixes,omitempty"` Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // NamePrefixes matches all objects with the given prefixes + NamePrefixes []string `protobuf:"bytes,4,rep,name=name_prefixes,json=namePrefixes" json:"name_prefixes,omitempty"` } func (m *ListServicesRequest_Filters) Reset() { *m = ListServicesRequest_Filters{} } @@ -333,6 +339,8 @@ type ListNetworksRequest_Filters struct { Names []string `protobuf:"bytes,1,rep,name=names" json:"names,omitempty"` IDPrefixes []string `protobuf:"bytes,2,rep,name=id_prefixes,json=idPrefixes" json:"id_prefixes,omitempty"` Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // NamePrefixes matches all objects with the given prefixes + NamePrefixes []string `protobuf:"bytes,4,rep,name=name_prefixes,json=namePrefixes" json:"name_prefixes,omitempty"` } func (m *ListNetworksRequest_Filters) Reset() { *m = ListNetworksRequest_Filters{} } @@ -377,6 +385,8 @@ type ListClustersRequest_Filters struct { Names []string `protobuf:"bytes,1,rep,name=names" json:"names,omitempty"` IDPrefixes []string `protobuf:"bytes,2,rep,name=id_prefixes,json=idPrefixes" json:"id_prefixes,omitempty"` Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // NamePrefixes matches all objects with the given prefixes + NamePrefixes []string `protobuf:"bytes,4,rep,name=name_prefixes,json=namePrefixes" json:"name_prefixes,omitempty"` } func (m *ListClustersRequest_Filters) Reset() { *m = ListClustersRequest_Filters{} } @@ -702,6 +712,13 @@ func (m *ListNodesRequest_Filters) Copy() *ListNodesRequest_Filters { } } + if m.NamePrefixes != nil { + o.NamePrefixes = make([]string, 0, len(m.NamePrefixes)) + for _, v := range m.NamePrefixes { + o.NamePrefixes = append(o.NamePrefixes, v) + } + } + return o } @@ -877,6 +894,13 @@ func (m *ListTasksRequest_Filters) Copy() *ListTasksRequest_Filters { } } + if m.NamePrefixes != nil { + o.NamePrefixes = make([]string, 0, len(m.NamePrefixes)) + for _, v := range m.NamePrefixes { + o.NamePrefixes = append(o.NamePrefixes, v) + } + } + return o } @@ -1033,6 +1057,13 @@ func (m *ListServicesRequest_Filters) Copy() *ListServicesRequest_Filters { } } + if m.NamePrefixes != nil { + o.NamePrefixes = make([]string, 0, len(m.NamePrefixes)) + for _, v := range m.NamePrefixes { + o.NamePrefixes = append(o.NamePrefixes, v) + } + } + return o } @@ -1165,6 +1196,13 @@ func (m *ListNetworksRequest_Filters) Copy() *ListNetworksRequest_Filters { } } + if m.NamePrefixes != nil { + o.NamePrefixes = make([]string, 0, len(m.NamePrefixes)) + for _, v := range m.NamePrefixes { + o.NamePrefixes = append(o.NamePrefixes, v) + } + } + return o } @@ -1249,6 +1287,13 @@ func (m *ListClustersRequest_Filters) Copy() *ListClustersRequest_Filters { } } + if m.NamePrefixes != nil { + o.NamePrefixes = make([]string, 0, len(m.NamePrefixes)) + for _, v := range m.NamePrefixes { + o.NamePrefixes = append(o.NamePrefixes, v) + } + } + return o } @@ -1333,7 +1378,7 @@ func (this *ListNodesRequest_Filters) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 9) + s := make([]string, 0, 10) s = append(s, "&api.ListNodesRequest_Filters{") s = append(s, "Names: "+fmt.Sprintf("%#v", this.Names)+",\n") s = append(s, "IDPrefixes: "+fmt.Sprintf("%#v", this.IDPrefixes)+",\n") @@ -1352,6 +1397,7 @@ func (this *ListNodesRequest_Filters) GoString() string { } s = append(s, "Memberships: "+fmt.Sprintf("%#v", this.Memberships)+",\n") s = append(s, "Roles: "+fmt.Sprintf("%#v", this.Roles)+",\n") + s = append(s, "NamePrefixes: "+fmt.Sprintf("%#v", this.NamePrefixes)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -1471,7 +1517,7 @@ func (this *ListTasksRequest_Filters) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 10) + s := make([]string, 0, 11) s = append(s, "&api.ListTasksRequest_Filters{") s = append(s, "Names: "+fmt.Sprintf("%#v", this.Names)+",\n") s = append(s, "IDPrefixes: "+fmt.Sprintf("%#v", this.IDPrefixes)+",\n") @@ -1491,6 +1537,7 @@ func (this *ListTasksRequest_Filters) GoString() string { s = append(s, "ServiceIDs: "+fmt.Sprintf("%#v", this.ServiceIDs)+",\n") s = append(s, "NodeIDs: "+fmt.Sprintf("%#v", this.NodeIDs)+",\n") s = append(s, "DesiredStates: "+fmt.Sprintf("%#v", this.DesiredStates)+",\n") + s = append(s, "NamePrefixes: "+fmt.Sprintf("%#v", this.NamePrefixes)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -1615,7 +1662,7 @@ func (this *ListServicesRequest_Filters) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 7) + s := make([]string, 0, 8) s = append(s, "&api.ListServicesRequest_Filters{") s = append(s, "Names: "+fmt.Sprintf("%#v", this.Names)+",\n") s = append(s, "IDPrefixes: "+fmt.Sprintf("%#v", this.IDPrefixes)+",\n") @@ -1632,6 +1679,7 @@ func (this *ListServicesRequest_Filters) GoString() string { if this.Labels != nil { s = append(s, "Labels: "+mapStringForLabels+",\n") } + s = append(s, "NamePrefixes: "+fmt.Sprintf("%#v", this.NamePrefixes)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -1730,7 +1778,7 @@ func (this *ListNetworksRequest_Filters) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 7) + s := make([]string, 0, 8) s = append(s, "&api.ListNetworksRequest_Filters{") s = append(s, "Names: "+fmt.Sprintf("%#v", this.Names)+",\n") s = append(s, "IDPrefixes: "+fmt.Sprintf("%#v", this.IDPrefixes)+",\n") @@ -1747,6 +1795,7 @@ func (this *ListNetworksRequest_Filters) GoString() string { if this.Labels != nil { s = append(s, "Labels: "+mapStringForLabels+",\n") } + s = append(s, "NamePrefixes: "+fmt.Sprintf("%#v", this.NamePrefixes)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -1800,7 +1849,7 @@ func (this *ListClustersRequest_Filters) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 7) + s := make([]string, 0, 8) s = append(s, "&api.ListClustersRequest_Filters{") s = append(s, "Names: "+fmt.Sprintf("%#v", this.Names)+",\n") s = append(s, "IDPrefixes: "+fmt.Sprintf("%#v", this.IDPrefixes)+",\n") @@ -1817,6 +1866,7 @@ func (this *ListClustersRequest_Filters) GoString() string { if this.Labels != nil { s = append(s, "Labels: "+mapStringForLabels+",\n") } + s = append(s, "NamePrefixes: "+fmt.Sprintf("%#v", this.NamePrefixes)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -2707,6 +2757,21 @@ func (m *ListNodesRequest_Filters) MarshalTo(data []byte) (int, error) { i = encodeVarintControl(data, i, uint64(num)) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + data[i] = 0x32 + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } return i, nil } @@ -3075,6 +3140,21 @@ func (m *ListTasksRequest_Filters) MarshalTo(data []byte) (int, error) { i = encodeVarintControl(data, i, uint64(num)) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + data[i] = 0x3a + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } return i, nil } @@ -3420,6 +3500,21 @@ func (m *ListServicesRequest_Filters) MarshalTo(data []byte) (int, error) { i += copy(data[i:], v) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + data[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } return i, nil } @@ -3705,6 +3800,21 @@ func (m *ListNetworksRequest_Filters) MarshalTo(data []byte) (int, error) { i += copy(data[i:], v) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + data[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } return i, nil } @@ -3880,6 +3990,21 @@ func (m *ListClustersRequest_Filters) MarshalTo(data []byte) (int, error) { i += copy(data[i:], v) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + data[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } return i, nil } @@ -4425,6 +4550,12 @@ func (m *ListNodesRequest_Filters) Size() (n int) { n += 1 + sovControl(uint64(e)) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + l = len(s) + n += 1 + l + sovControl(uint64(l)) + } + } return n } @@ -4570,6 +4701,12 @@ func (m *ListTasksRequest_Filters) Size() (n int) { n += 1 + sovControl(uint64(e)) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + l = len(s) + n += 1 + l + sovControl(uint64(l)) + } + } return n } @@ -4702,6 +4839,12 @@ func (m *ListServicesRequest_Filters) Size() (n int) { n += mapEntrySize + 1 + sovControl(uint64(mapEntrySize)) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + l = len(s) + n += 1 + l + sovControl(uint64(l)) + } + } return n } @@ -4814,6 +4957,12 @@ func (m *ListNetworksRequest_Filters) Size() (n int) { n += mapEntrySize + 1 + sovControl(uint64(mapEntrySize)) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + l = len(s) + n += 1 + l + sovControl(uint64(l)) + } + } return n } @@ -4882,6 +5031,12 @@ func (m *ListClustersRequest_Filters) Size() (n int) { n += mapEntrySize + 1 + sovControl(uint64(mapEntrySize)) } } + if len(m.NamePrefixes) > 0 { + for _, s := range m.NamePrefixes { + l = len(s) + n += 1 + l + sovControl(uint64(l)) + } + } return n } @@ -4988,6 +5143,7 @@ func (this *ListNodesRequest_Filters) String() string { `Labels:` + mapStringForLabels + `,`, `Memberships:` + fmt.Sprintf("%v", this.Memberships) + `,`, `Roles:` + fmt.Sprintf("%v", this.Roles) + `,`, + `NamePrefixes:` + fmt.Sprintf("%v", this.NamePrefixes) + `,`, `}`, }, "") return s @@ -5113,6 +5269,7 @@ func (this *ListTasksRequest_Filters) String() string { `ServiceIDs:` + fmt.Sprintf("%v", this.ServiceIDs) + `,`, `NodeIDs:` + fmt.Sprintf("%v", this.NodeIDs) + `,`, `DesiredStates:` + fmt.Sprintf("%v", this.DesiredStates) + `,`, + `NamePrefixes:` + fmt.Sprintf("%v", this.NamePrefixes) + `,`, `}`, }, "") return s @@ -5236,6 +5393,7 @@ func (this *ListServicesRequest_Filters) String() string { `Names:` + fmt.Sprintf("%v", this.Names) + `,`, `IDPrefixes:` + fmt.Sprintf("%v", this.IDPrefixes) + `,`, `Labels:` + mapStringForLabels + `,`, + `NamePrefixes:` + fmt.Sprintf("%v", this.NamePrefixes) + `,`, `}`, }, "") return s @@ -5339,6 +5497,7 @@ func (this *ListNetworksRequest_Filters) String() string { `Names:` + fmt.Sprintf("%v", this.Names) + `,`, `IDPrefixes:` + fmt.Sprintf("%v", this.IDPrefixes) + `,`, `Labels:` + mapStringForLabels + `,`, + `NamePrefixes:` + fmt.Sprintf("%v", this.NamePrefixes) + `,`, `}`, }, "") return s @@ -5401,6 +5560,7 @@ func (this *ListClustersRequest_Filters) String() string { `Names:` + fmt.Sprintf("%v", this.Names) + `,`, `IDPrefixes:` + fmt.Sprintf("%v", this.IDPrefixes) + `,`, `Labels:` + mapStringForLabels + `,`, + `NamePrefixes:` + fmt.Sprintf("%v", this.NamePrefixes) + `,`, `}`, }, "") return s @@ -5928,6 +6088,35 @@ func (m *ListNodesRequest_Filters) Unmarshal(data []byte) error { } } m.Roles = append(m.Roles, v) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamePrefixes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NamePrefixes = append(m.NamePrefixes, string(data[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipControl(data[iNdEx:]) @@ -7037,6 +7226,35 @@ func (m *ListTasksRequest_Filters) Unmarshal(data []byte) error { } } m.DesiredStates = append(m.DesiredStates, v) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamePrefixes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NamePrefixes = append(m.NamePrefixes, string(data[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipControl(data[iNdEx:]) @@ -8105,6 +8323,35 @@ func (m *ListServicesRequest_Filters) Unmarshal(data []byte) error { } m.Labels[mapkey] = mapvalue iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamePrefixes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NamePrefixes = append(m.NamePrefixes, string(data[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipControl(data[iNdEx:]) @@ -9003,6 +9250,35 @@ func (m *ListNetworksRequest_Filters) Unmarshal(data []byte) error { } m.Labels[mapkey] = mapvalue iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamePrefixes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NamePrefixes = append(m.NamePrefixes, string(data[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipControl(data[iNdEx:]) @@ -9548,6 +9824,35 @@ func (m *ListClustersRequest_Filters) Unmarshal(data []byte) error { } m.Labels[mapkey] = mapvalue iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamePrefixes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NamePrefixes = append(m.NamePrefixes, string(data[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipControl(data[iNdEx:]) @@ -9984,92 +10289,93 @@ var ( ) var fileDescriptorControl = []byte{ - // 1384 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x59, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xff, 0xda, 0x69, 0xe2, 0xfa, 0xb9, 0x4e, 0x9a, 0xa9, 0xa3, 0x6f, 0xe4, 0x86, 0x14, 0x6d, - 0x21, 0x4d, 0xa4, 0xe0, 0x80, 0xa3, 0x8a, 0x00, 0x12, 0x88, 0x24, 0x14, 0x59, 0x94, 0x50, 0x6d, - 0x28, 0xe2, 0x16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 0x43, 0x4a, 0x00, 0x93, 0xdd, 0xc8, 0x2e, 0x54, 0x44, - 0xd7, 0x99, 0x28, 0x49, 0xff, 0x87, 0x05, 0x45, 0x0b, 0xb6, 0xaf, 0x9f, 0xf2, 0x70, 0x8d, 0x73, - 0x1c, 0xcf, 0xa3, 0x0e, 0xd6, 0x50, 0x3b, 0xd8, 0x46, 0x5a, 0x9f, 0x50, 0x24, 0x87, 0x9b, 0xd8, - 0x93, 0xdc, 0x85, 0x37, 0xb1, 0x7d, 0xa5, 0x89, 0xbd, 0x33, 0xa6, 0x73, 0xba, 0x3e, 0x36, 0x49, - 0xa3, 0xf8, 0x04, 0x2a, 0x83, 0xd6, 0x30, 0xe7, 0x6f, 0xc2, 0x65, 0xcc, 0x81, 0x6c, 0x17, 0xc6, - 0xa4, 0x47, 0xe0, 0xb8, 0x69, 0xec, 0xd1, 0xe0, 0xa1, 0xeb, 0x1d, 0x8f, 0xd1, 0x34, 0x50, 0x42, - 0xd7, 0x34, 0x22, 0x65, 0x31, 0x25, 0x7b, 0xe2, 0xc8, 0x44, 0x49, 0x29, 0x25, 0xb1, 0xd6, 0xfd, - 0xb0, 0x69, 0x28, 0x9e, 0x11, 0x36, 0x4d, 0xb0, 0x64, 0xe2, 0x7d, 0x85, 0xdf, 0x39, 0x47, 0x51, - 0x86, 0x73, 0x34, 0x1f, 0x73, 0x14, 0x65, 0x39, 0x47, 0x11, 0x10, 0x35, 0x92, 0x0b, 0xf2, 0xf1, - 0x73, 0x59, 0x36, 0x17, 0xee, 0x66, 0x54, 0x4a, 0x8a, 0xa7, 0x51, 0x29, 0xe1, 0xf9, 0x39, 0x4a, - 0x49, 0x91, 0x7c, 0xb1, 0x4a, 0x29, 0xc5, 0xb9, 0xe7, 0x54, 0x4a, 0xb1, 0xb5, 0xb8, 0x94, 0x30, - 0x07, 0xc6, 0x52, 0x92, 0x49, 0x89, 0xc0, 0xf8, 0x27, 0x6e, 0xa7, 0x73, 0xe2, 0x33, 0x77, 0x13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 0x67, 0x19, - 0xb0, 0xa1, 0x9e, 0x95, 0x98, 0xd7, 0x46, 0x40, 0x1a, 0x8d, 0x6f, 0x2f, 0x3d, 0x7e, 0xba, 0xfc, - 0xbf, 0xdf, 0xd8, 0xe7, 0xef, 0xa7, 0xcb, 0xb9, 0x6f, 0x9e, 0x2d, 0xe7, 0x1e, 0xb3, 0xcf, 0x2f, - 0xec, 0xf3, 0x84, 0x7d, 0x0e, 0x67, 0xc2, 0xff, 0x58, 0xda, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, - 0x35, 0x0f, 0xc7, 0x5a, 0xd1, 0x1a, 0x00, 0x00, + // 1406 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x59, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0xce, 0x1f, 0xd7, 0xcf, 0xb1, 0xd3, 0x4c, 0x1d, 0x11, 0xb9, 0x21, 0x45, 0x5b, 0x48, + 0x13, 0x29, 0x38, 0xe0, 0xa8, 0x22, 0x80, 0x04, 0x22, 0x09, 0x45, 0x16, 0x25, 0x54, 0x1b, 0x8a, + 0xb8, 0x45, 0x8e, 0x3d, 0x0d, 0x4b, 0x6c, 0xaf, 0xd9, 0xdd, 0xa4, 0x8d, 0xb8, 0xc0, 0x81, 0xef, + 0xc0, 0x95, 0x2b, 0x07, 0xbe, 0x02, 0xd7, 0x8a, 0x13, 0x17, 0x24, 0x4e, 0x15, 0xed, 0x89, 0x13, + 0xe2, 0x13, 0x20, 0x66, 0x76, 0xde, 0xec, 0xae, 0xc7, 0xb3, 0x63, 0x3b, 0x49, 0x95, 0x1e, 0xac, + 0xee, 0xce, 0xfc, 0xde, 0x9f, 0x99, 0xf7, 0x7b, 0x2f, 0xef, 0x6d, 0xa1, 0xd8, 0x74, 0xbb, 0x81, + 0xe7, 0xb6, 0xab, 0x3d, 0xcf, 0x0d, 0x5c, 0x42, 0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c, 0x5e, 0x6c, 0x35, 0xf9, 0x0c, 0xca, 0xfd, 0x2e, 0x21, 0x31, 0xde, 0x86, 0x2b, 0x18, 0x28, + 0x59, 0x53, 0x8c, 0xcc, 0x88, 0xc0, 0x71, 0x65, 0xd9, 0xa5, 0xc1, 0x43, 0xd7, 0x3b, 0x1a, 0xa3, + 0xb2, 0xa0, 0x84, 0xae, 0xb2, 0x44, 0xca, 0x62, 0xde, 0x76, 0xc5, 0x92, 0x89, 0xb7, 0x52, 0x4a, + 0x62, 0xad, 0xfb, 0x61, 0x65, 0x51, 0x3c, 0x23, 0xac, 0x2f, 0x61, 0xb7, 0x89, 0xf7, 0x15, 0x3e, + 0x73, 0x22, 0xa3, 0x0c, 0x27, 0x72, 0x36, 0x26, 0x32, 0xca, 0x72, 0x22, 0x23, 0x20, 0xaa, 0x36, + 0x17, 0xe4, 0xe3, 0x97, 0x32, 0xb7, 0x2e, 0xdc, 0xcd, 0x28, 0xdf, 0x14, 0x4f, 0xa3, 0x7c, 0xc3, + 0xf5, 0x33, 0xe4, 0x9b, 0x22, 0xf9, 0x62, 0xe5, 0x5b, 0x8a, 0x73, 0x97, 0x99, 0x6f, 0xb1, 0x4b, + 0x71, 0xbe, 0x61, 0xa0, 0x8c, 0xf9, 0x26, 0x23, 0x17, 0x81, 0xf1, 0x8f, 0xe5, 0x76, 0xfb, 0xd8, + 0x67, 0x67, 0x4a, 0xd4, 0xe1, 0xa6, 0x58, 0x51, 0xea, 0x30, 0xe2, 0x38, 0x2f, 0x10, 0x10, 0xd1, + 0x37, 0x52, 0x11, 0xd3, 0x17, 0x21, 0x26, 0xfa, 0x4a, 0x29, 0x89, 0x8d, 0xb8, 0x84, 0x1b, 0x67, + 0xe0, 0x92, 0x22, 0xf9, 0x62, 0x71, 0x29, 0xc5, 0xb9, 0xcb, 0xe4, 0x52, 0xec, 0x52, 0xcc, 0x25, + 0x8c, 0x86, 0x91, 0x4b, 0x32, 0x74, 0x11, 0x38, 0xd1, 0xe8,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0xff, 0x53, 0x9c, 0xb7, 0x2f, 0x8a, 0x1b, 0x00, 0x00, } diff --git a/vendor/src/github.com/docker/swarmkit/api/control.proto b/vendor/src/github.com/docker/swarmkit/api/control.proto index b5bc83961b..63c55d4825 100644 --- a/vendor/src/github.com/docker/swarmkit/api/control.proto +++ b/vendor/src/github.com/docker/swarmkit/api/control.proto @@ -88,6 +88,8 @@ message ListNodesRequest { map labels = 3; repeated NodeSpec.Membership memberships = 4; repeated NodeRole roles = 5; + // NamePrefixes matches all objects with the given prefixes + repeated string name_prefixes = 6; } Filters filters = 1; @@ -141,6 +143,8 @@ message ListTasksRequest { repeated string service_ids = 4 [(gogoproto.customname) = "ServiceIDs"]; repeated string node_ids = 5 [(gogoproto.customname) = "NodeIDs"]; repeated docker.swarmkit.v1.TaskState desired_states = 6; + // NamePrefixes matches all objects with the given prefixes + repeated string name_prefixes = 7; } Filters filters = 1; @@ -188,6 +192,8 @@ message ListServicesRequest { repeated string names = 1; repeated string id_prefixes = 2 [(gogoproto.customname) = "IDPrefixes"]; map labels = 3; + // NamePrefixes matches all objects with the given prefixes + repeated string name_prefixes = 4; } Filters filters = 1; @@ -226,6 +232,8 @@ message ListNetworksRequest { repeated string names = 1; repeated string id_prefixes = 2 [(gogoproto.customname) = "IDPrefixes"]; map labels = 3; + // NamePrefixes matches all objects with the given prefixes + repeated string name_prefixes = 4; } Filters filters = 1; @@ -248,6 +256,8 @@ message ListClustersRequest { repeated string names = 1; repeated string id_prefixes = 2 [(gogoproto.customname) = "IDPrefixes"]; map labels = 3; + // NamePrefixes matches all objects with the given prefixes + repeated string name_prefixes = 4; } Filters filters = 1; diff --git a/vendor/src/github.com/docker/swarmkit/manager/allocator/network.go b/vendor/src/github.com/docker/swarmkit/manager/allocator/network.go index 46b90505fa..8d0b938591 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/allocator/network.go +++ b/vendor/src/github.com/docker/swarmkit/manager/allocator/network.go @@ -23,28 +23,31 @@ const ( ingressSubnet = "10.255.0.0/16" ) -var ingressNetwork = &api.Network{ - Spec: api.NetworkSpec{ - Annotations: api.Annotations{ - Name: ingressNetworkName, - Labels: map[string]string{ - "com.docker.swarm.internal": "true", +func newIngressNetwork() *api.Network { + return &api.Network{ + Spec: api.NetworkSpec{ + Annotations: api.Annotations{ + Name: ingressNetworkName, + Labels: map[string]string{ + "com.docker.swarm.internal": "true", + }, }, - }, - DriverConfig: &api.Driver{}, - IPAM: &api.IPAMOptions{ - Driver: &api.Driver{}, - Configs: []*api.IPAMConfig{ - { - Subnet: ingressSubnet, + DriverConfig: &api.Driver{}, + IPAM: &api.IPAMOptions{ + Driver: &api.Driver{}, + Configs: []*api.IPAMConfig{ + { + Subnet: ingressSubnet, + }, }, }, }, - }, + } } // Network context information which is used throughout the network allocation code. type networkContext struct { + ingressNetwork *api.Network // Instance of the low-level network allocator which performs // the actual network allocation. nwkAllocator *networkallocator.NetworkAllocator @@ -75,6 +78,7 @@ func (a *Allocator) doNetworkInit(ctx context.Context) error { unallocatedTasks: make(map[string]*api.Task), unallocatedServices: make(map[string]*api.Service), unallocatedNetworks: make(map[string]*api.Network), + ingressNetwork: newIngressNetwork(), } // Check if we have the ingress network. If not found create @@ -83,7 +87,7 @@ func (a *Allocator) doNetworkInit(ctx context.Context) error { a.store.View(func(tx store.ReadTx) { networks, err = store.FindNetworks(tx, store.ByName(ingressNetworkName)) if len(networks) > 0 { - ingressNetwork = networks[0] + nc.ingressNetwork = networks[0] } }) if err != nil { @@ -94,8 +98,8 @@ func (a *Allocator) doNetworkInit(ctx context.Context) error { // using the predefined template. if len(networks) == 0 { if err := a.store.Update(func(tx store.Tx) error { - ingressNetwork.ID = identity.NewID() - if err := store.CreateNetwork(tx, ingressNetwork); err != nil { + nc.ingressNetwork.ID = identity.NewID() + if err := store.CreateNetwork(tx, nc.ingressNetwork); err != nil { return err } @@ -107,7 +111,7 @@ func (a *Allocator) doNetworkInit(ctx context.Context) error { a.store.View(func(tx store.ReadTx) { networks, err = store.FindNetworks(tx, store.ByName(ingressNetworkName)) if len(networks) > 0 { - ingressNetwork = networks[0] + nc.ingressNetwork = networks[0] } }) if err != nil { @@ -119,14 +123,14 @@ func (a *Allocator) doNetworkInit(ctx context.Context) error { // Try to complete ingress network allocation before anything else so // that the we can get the preferred subnet for ingress // network. - if !na.IsAllocated(ingressNetwork) { - if err := a.allocateNetwork(ctx, nc, ingressNetwork); err != nil { + if !na.IsAllocated(nc.ingressNetwork) { + if err := a.allocateNetwork(ctx, nc, nc.ingressNetwork); err != nil { log.G(ctx).Errorf("failed allocating ingress network during init: %v", err) } // Update store after allocation if err := a.store.Update(func(tx store.Tx) error { - if err := store.UpdateNetwork(tx, ingressNetwork); err != nil { + if err := store.UpdateNetwork(tx, nc.ingressNetwork); err != nil { return err } @@ -173,7 +177,7 @@ func (a *Allocator) doNetworkInit(ctx context.Context) error { node.Attachment = &api.NetworkAttachment{} } - node.Attachment.Network = ingressNetwork.Copy() + node.Attachment.Network = nc.ingressNetwork.Copy() if err := a.allocateNode(ctx, nc, node); err != nil { log.G(ctx).Errorf("Failed to allocate network resources for node %s during init: %v", node.ID, err) } @@ -189,11 +193,7 @@ func (a *Allocator) doNetworkInit(ctx context.Context) error { } for _, s := range services { - if s.Spec.Endpoint == nil { - continue - } - - if na.IsServiceAllocated(s) { + if !serviceAllocationNeeded(s, nc) { continue } @@ -375,7 +375,7 @@ func (a *Allocator) doNodeAlloc(ctx context.Context, nc *networkContext, ev even node.Attachment = &api.NetworkAttachment{} } - node.Attachment.Network = ingressNetwork.Copy() + node.Attachment.Network = nc.ingressNetwork.Copy() if err := a.allocateNode(ctx, nc, node); err != nil { log.G(ctx).Errorf("Fauled to allocate network resources for node %s: %v", node.ID, err) } @@ -449,7 +449,7 @@ func (a *Allocator) taskCreateNetworkAttachments(t *api.Task, s *api.Service) { // ports to the external world. Automatically attach the task // to the ingress network. if s.Spec.Endpoint != nil && len(s.Spec.Endpoint.Ports) != 0 { - networks = append(networks, &api.NetworkAttachment{Network: ingressNetwork}) + networks = append(networks, &api.NetworkAttachment{Network: a.netCtx.ingressNetwork}) } a.store.View(func(tx store.ReadTx) { @@ -581,7 +581,7 @@ func (a *Allocator) allocateService(ctx context.Context, nc *networkContext, s * if len(s.Spec.Endpoint.Ports) != 0 { var found bool for _, vip := range s.Endpoint.VirtualIPs { - if vip.NetworkID == ingressNetwork.ID { + if vip.NetworkID == nc.ingressNetwork.ID { found = true break } @@ -589,7 +589,7 @@ func (a *Allocator) allocateService(ctx context.Context, nc *networkContext, s * if !found { s.Endpoint.VirtualIPs = append(s.Endpoint.VirtualIPs, - &api.Endpoint_VirtualIP{NetworkID: ingressNetwork.ID}) + &api.Endpoint_VirtualIP{NetworkID: nc.ingressNetwork.ID}) } } } diff --git a/vendor/src/github.com/docker/swarmkit/manager/allocator/networkallocator/networkallocator.go b/vendor/src/github.com/docker/swarmkit/manager/allocator/networkallocator/networkallocator.go index 8bf181cd07..71cd8b72a6 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/allocator/networkallocator/networkallocator.go +++ b/vendor/src/github.com/docker/swarmkit/manager/allocator/networkallocator/networkallocator.go @@ -43,6 +43,14 @@ type NetworkAllocator struct { // Allocator state to indicate if allocation has been // successfully completed for this service. services map[string]struct{} + + // Allocator state to indicate if allocation has been + // successfully completed for this task. + tasks map[string]struct{} + + // Allocator state to indicate if allocation has been + // successfully completed for this node. + nodes map[string]struct{} } // Local in-memory state related to netwok that need to be tracked by NetworkAllocator @@ -64,6 +72,8 @@ func New() (*NetworkAllocator, error) { na := &NetworkAllocator{ networks: make(map[string]*network), services: make(map[string]struct{}), + tasks: make(map[string]struct{}), + nodes: make(map[string]struct{}), } // There are no driver configurations and notification @@ -188,6 +198,7 @@ outer: s.Endpoint.VirtualIPs = append(s.Endpoint.VirtualIPs, vip) } + s.Endpoint.Spec = s.Spec.Endpoint.Copy() na.services[s.ID] = struct{}{} return @@ -223,6 +234,12 @@ func (na *NetworkAllocator) IsAllocated(n *api.Network) bool { // IsTaskAllocated returns if the passed task has it's network resources allocated or not. func (na *NetworkAllocator) IsTaskAllocated(t *api.Task) bool { + // If the task is not found in the allocated set, then it is + // not allocated. + if _, ok := na.tasks[t.ID]; !ok { + return false + } + // If Networks is empty there is no way this Task is allocated. if len(t.Networks) == 0 { return false @@ -267,6 +284,12 @@ func (na *NetworkAllocator) IsServiceAllocated(s *api.Service) bool { // IsNodeAllocated returns if the passed node has its network resources allocated or not. func (na *NetworkAllocator) IsNodeAllocated(node *api.Node) bool { + // If the node is not found in the allocated set, then it is + // not allocated. + if _, ok := na.nodes[node.ID]; !ok { + return false + } + // If no attachment, not allocated. if node.Attachment == nil { return false @@ -294,12 +317,18 @@ func (na *NetworkAllocator) IsNodeAllocated(node *api.Node) bool { // AllocateNode allocates the IP addresses for the network to which // the node is attached. func (na *NetworkAllocator) AllocateNode(node *api.Node) error { - return na.allocateNetworkIPs(node.Attachment) + if err := na.allocateNetworkIPs(node.Attachment); err != nil { + return err + } + + na.nodes[node.ID] = struct{}{} + return nil } // DeallocateNode deallocates the IP addresses for the network to // which the node is attached. func (na *NetworkAllocator) DeallocateNode(node *api.Node) error { + delete(na.nodes, node.ID) return na.releaseEndpoints([]*api.NetworkAttachment{node.Attachment}) } @@ -315,12 +344,15 @@ func (na *NetworkAllocator) AllocateTask(t *api.Task) error { } } + na.tasks[t.ID] = struct{}{} + return nil } // DeallocateTask releases all the endpoint resources for all the // networks that a task is attached to. func (na *NetworkAllocator) DeallocateTask(t *api.Task) error { + delete(na.tasks, t.ID) return na.releaseEndpoints(t.Networks) } @@ -371,13 +403,29 @@ func (na *NetworkAllocator) allocateVIP(vip *api.Endpoint_VirtualIP) error { return fmt.Errorf("networkallocator: could not find local network state") } + // If this IP is already allocated in memory we don't need to + // do anything. + if _, ok := localNet.endpoints[vip.Addr]; ok { + return nil + } + ipam, _, err := na.resolveIPAM(localNet.nw) if err != nil { return fmt.Errorf("failed to resolve IPAM while allocating : %v", err) } + var addr net.IP + if vip.Addr != "" { + var err error + + addr, _, err = net.ParseCIDR(vip.Addr) + if err != nil { + return err + } + } + for _, poolID := range localNet.pools { - ip, _, err := ipam.RequestAddress(poolID, nil, nil) + ip, _, err := ipam.RequestAddress(poolID, addr, nil) if err != nil && err != ipamapi.ErrNoAvailableIPs && err != ipamapi.ErrIPOutOfRange { return fmt.Errorf("could not allocate VIP from IPAM: %v", err) } diff --git a/vendor/src/github.com/docker/swarmkit/manager/controlapi/cluster.go b/vendor/src/github.com/docker/swarmkit/manager/controlapi/cluster.go index b52679f719..3e5064dfa6 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/controlapi/cluster.go +++ b/vendor/src/github.com/docker/swarmkit/manager/controlapi/cluster.go @@ -143,6 +143,8 @@ func (s *Server) ListClusters(ctx context.Context, request *api.ListClustersRequ switch { case request.Filters != nil && len(request.Filters.Names) > 0: clusters, err = store.FindClusters(tx, buildFilters(store.ByName, request.Filters.Names)) + case request.Filters != nil && len(request.Filters.NamePrefixes) > 0: + clusters, err = store.FindClusters(tx, buildFilters(store.ByNamePrefix, request.Filters.NamePrefixes)) case request.Filters != nil && len(request.Filters.IDPrefixes) > 0: clusters, err = store.FindClusters(tx, buildFilters(store.ByIDPrefix, request.Filters.IDPrefixes)) default: @@ -158,6 +160,9 @@ func (s *Server) ListClusters(ctx context.Context, request *api.ListClustersRequ func(e *api.Cluster) bool { return filterContains(e.Spec.Annotations.Name, request.Filters.Names) }, + func(e *api.Cluster) bool { + return filterContainsPrefix(e.Spec.Annotations.Name, request.Filters.NamePrefixes) + }, func(e *api.Cluster) bool { return filterContainsPrefix(e.ID, request.Filters.IDPrefixes) }, diff --git a/vendor/src/github.com/docker/swarmkit/manager/controlapi/network.go b/vendor/src/github.com/docker/swarmkit/manager/controlapi/network.go index bdda1e6e02..ec5cfd82e0 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/controlapi/network.go +++ b/vendor/src/github.com/docker/swarmkit/manager/controlapi/network.go @@ -224,6 +224,8 @@ func (s *Server) ListNetworks(ctx context.Context, request *api.ListNetworksRequ switch { case request.Filters != nil && len(request.Filters.Names) > 0: networks, err = store.FindNetworks(tx, buildFilters(store.ByName, request.Filters.Names)) + case request.Filters != nil && len(request.Filters.NamePrefixes) > 0: + networks, err = store.FindNetworks(tx, buildFilters(store.ByNamePrefix, request.Filters.NamePrefixes)) case request.Filters != nil && len(request.Filters.IDPrefixes) > 0: networks, err = store.FindNetworks(tx, buildFilters(store.ByIDPrefix, request.Filters.IDPrefixes)) default: @@ -239,6 +241,9 @@ func (s *Server) ListNetworks(ctx context.Context, request *api.ListNetworksRequ func(e *api.Network) bool { return filterContains(e.Spec.Annotations.Name, request.Filters.Names) }, + func(e *api.Network) bool { + return filterContainsPrefix(e.Spec.Annotations.Name, request.Filters.NamePrefixes) + }, func(e *api.Network) bool { return filterContainsPrefix(e.ID, request.Filters.IDPrefixes) }, diff --git a/vendor/src/github.com/docker/swarmkit/manager/controlapi/node.go b/vendor/src/github.com/docker/swarmkit/manager/controlapi/node.go index b730224fb6..46b1189720 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/controlapi/node.go +++ b/vendor/src/github.com/docker/swarmkit/manager/controlapi/node.go @@ -81,6 +81,8 @@ func (s *Server) ListNodes(ctx context.Context, request *api.ListNodesRequest) ( switch { case request.Filters != nil && len(request.Filters.Names) > 0: nodes, err = store.FindNodes(tx, buildFilters(store.ByName, request.Filters.Names)) + case request.Filters != nil && len(request.Filters.NamePrefixes) > 0: + nodes, err = store.FindNodes(tx, buildFilters(store.ByNamePrefix, request.Filters.NamePrefixes)) case request.Filters != nil && len(request.Filters.IDPrefixes) > 0: nodes, err = store.FindNodes(tx, buildFilters(store.ByIDPrefix, request.Filters.IDPrefixes)) case request.Filters != nil && len(request.Filters.Roles) > 0: @@ -114,6 +116,15 @@ func (s *Server) ListNodes(ctx context.Context, request *api.ListNodesRequest) ( } return filterContains(e.Description.Hostname, request.Filters.Names) }, + func(e *api.Node) bool { + if len(request.Filters.NamePrefixes) == 0 { + return true + } + if e.Description == nil { + return false + } + return filterContainsPrefix(e.Description.Hostname, request.Filters.NamePrefixes) + }, func(e *api.Node) bool { return filterContainsPrefix(e.ID, request.Filters.IDPrefixes) }, @@ -249,24 +260,15 @@ func (s *Server) UpdateNode(ctx context.Context, request *api.UpdateNodeRequest) }, nil } -// RemoveNode updates a Node referenced by NodeID with the given NodeSpec. +// RemoveNode removes a Node referenced by NodeID with the given NodeSpec. // - Returns NotFound if the Node is not found. -// - Returns FailedPrecondition if the Node has manager role or not shut down. +// - Returns FailedPrecondition if the Node has manager role (and is part of the memberlist) or is not shut down. // - Returns InvalidArgument if NodeID or NodeVersion is not valid. // - Returns an error if the delete fails. func (s *Server) RemoveNode(ctx context.Context, request *api.RemoveNodeRequest) (*api.RemoveNodeResponse, error) { if request.NodeID == "" { return nil, grpc.Errorf(codes.InvalidArgument, errInvalidArgument.Error()) } - if s.raft != nil { - memberlist := s.raft.GetMemberlist() - - for _, member := range memberlist { - if member.NodeID == request.NodeID { - return nil, grpc.Errorf(codes.FailedPrecondition, "node %s is a cluster manager and is part of the quorum. It must be demoted to worker before removal", request.NodeID) - } - } - } err := s.store.Update(func(tx store.Tx) error { node := store.GetNode(tx, request.NodeID) @@ -274,7 +276,12 @@ func (s *Server) RemoveNode(ctx context.Context, request *api.RemoveNodeRequest) return grpc.Errorf(codes.NotFound, "node %s not found", request.NodeID) } if node.Spec.Role == api.NodeRoleManager { - return grpc.Errorf(codes.FailedPrecondition, "node %s role is set to manager. It should be demoted to worker for safe removal", request.NodeID) + if s.raft == nil { + return grpc.Errorf(codes.FailedPrecondition, "node %s is a manager but cannot access node information from the raft memberlist", request.NodeID) + } + if member := s.raft.GetMemberByNodeID(request.NodeID); member != nil { + return grpc.Errorf(codes.FailedPrecondition, "node %s is a cluster manager and is a member of the raft cluster. It must be demoted to worker before removal", request.NodeID) + } } if node.Status.State == api.NodeStatus_READY { return grpc.Errorf(codes.FailedPrecondition, "node %s is not down and can't be removed", request.NodeID) diff --git a/vendor/src/github.com/docker/swarmkit/manager/controlapi/service.go b/vendor/src/github.com/docker/swarmkit/manager/controlapi/service.go index 20a8468777..610847d6b4 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/controlapi/service.go +++ b/vendor/src/github.com/docker/swarmkit/manager/controlapi/service.go @@ -321,6 +321,8 @@ func (s *Server) ListServices(ctx context.Context, request *api.ListServicesRequ switch { case request.Filters != nil && len(request.Filters.Names) > 0: services, err = store.FindServices(tx, buildFilters(store.ByName, request.Filters.Names)) + case request.Filters != nil && len(request.Filters.NamePrefixes) > 0: + services, err = store.FindServices(tx, buildFilters(store.ByNamePrefix, request.Filters.NamePrefixes)) case request.Filters != nil && len(request.Filters.IDPrefixes) > 0: services, err = store.FindServices(tx, buildFilters(store.ByIDPrefix, request.Filters.IDPrefixes)) default: @@ -336,6 +338,9 @@ func (s *Server) ListServices(ctx context.Context, request *api.ListServicesRequ func(e *api.Service) bool { return filterContains(e.Spec.Annotations.Name, request.Filters.Names) }, + func(e *api.Service) bool { + return filterContainsPrefix(e.Spec.Annotations.Name, request.Filters.NamePrefixes) + }, func(e *api.Service) bool { return filterContainsPrefix(e.ID, request.Filters.IDPrefixes) }, diff --git a/vendor/src/github.com/docker/swarmkit/manager/controlapi/task.go b/vendor/src/github.com/docker/swarmkit/manager/controlapi/task.go index 5cca4e39b3..4d8be66b99 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/controlapi/task.go +++ b/vendor/src/github.com/docker/swarmkit/manager/controlapi/task.go @@ -79,6 +79,8 @@ func (s *Server) ListTasks(ctx context.Context, request *api.ListTasksRequest) ( switch { case request.Filters != nil && len(request.Filters.Names) > 0: tasks, err = store.FindTasks(tx, buildFilters(store.ByName, request.Filters.Names)) + case request.Filters != nil && len(request.Filters.NamePrefixes) > 0: + tasks, err = store.FindTasks(tx, buildFilters(store.ByNamePrefix, request.Filters.NamePrefixes)) case request.Filters != nil && len(request.Filters.IDPrefixes) > 0: tasks, err = store.FindTasks(tx, buildFilters(store.ByIDPrefix, request.Filters.IDPrefixes)) case request.Filters != nil && len(request.Filters.ServiceIDs) > 0: @@ -104,6 +106,9 @@ func (s *Server) ListTasks(ctx context.Context, request *api.ListTasksRequest) ( func(e *api.Task) bool { return filterContains(e.ServiceAnnotations.Name, request.Filters.Names) }, + func(e *api.Task) bool { + return filterContainsPrefix(e.ServiceAnnotations.Name, request.Filters.NamePrefixes) + }, func(e *api.Task) bool { return filterContainsPrefix(e.ID, request.Filters.IDPrefixes) }, diff --git a/vendor/src/github.com/docker/swarmkit/manager/manager.go b/vendor/src/github.com/docker/swarmkit/manager/manager.go index 179ed1d93f..332c1a8249 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/manager.go +++ b/vendor/src/github.com/docker/swarmkit/manager/manager.go @@ -93,6 +93,19 @@ type Manager struct { stopped chan struct{} } +type closeOnceListener struct { + once sync.Once + net.Listener +} + +func (l *closeOnceListener) Close() error { + var err error + l.once.Do(func() { + err = l.Listener.Close() + }) + return err +} + // New creates a Manager which has not started to accept requests yet. func New(config *Config) (*Manager, error) { dispatcherConfig := dispatcher.DefaultConfig() @@ -481,7 +494,10 @@ func (m *Manager) Run(parent context.Context) error { "addr": lis.Addr().String()})) if proto == "unix" { log.G(ctx).Info("Listening for local connections") - errServe <- m.localserver.Serve(lis) + // we need to disallow double closes because UnixListener.Close + // can delete unix-socket file of newer listener. grpc calls + // Close twice indeed: in Serve and in Stop. + errServe <- m.localserver.Serve(&closeOnceListener{Listener: lis}) } else { log.G(ctx).Info("Listening for connections") errServe <- m.server.Serve(lis) diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/raft/membership/cluster.go b/vendor/src/github.com/docker/swarmkit/manager/state/raft/membership/cluster.go index ec9d8bfac4..d3ac5f8da5 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/raft/membership/cluster.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/raft/membership/cluster.go @@ -187,9 +187,13 @@ func (c *Cluster) ValidateConfigurationChange(cc raftpb.ConfChange) error { // that might block or harm the Cluster on Member recovery func (c *Cluster) CanRemoveMember(from uint64, id uint64) bool { members := c.Members() - nreachable := 0 + nreachable := 0 // reachable managers after removal for _, m := range members { + if m.RaftID == id { + continue + } + // Local node from where the remove is issued if m.RaftID == from { nreachable++ @@ -202,12 +206,7 @@ func (c *Cluster) CanRemoveMember(from uint64, id uint64) bool { } } - // Special case of 2 managers - if nreachable == 1 && len(members) <= 2 { - return false - } - - nquorum := (len(members)+1)/2 + 1 + nquorum := (len(members)-1)/2 + 1 if nreachable < nquorum { return false } diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/raft/raft.go b/vendor/src/github.com/docker/swarmkit/manager/state/raft/raft.go index be66b9da42..28a481de45 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/raft/raft.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/raft/raft.go @@ -1206,12 +1206,28 @@ func (n *Node) applyRemoveNode(cc raftpb.ConfChange) (err error) { // If the node from where the remove is issued is // a follower and the leader steps down, Campaign // to be the leader. - if cc.NodeID == n.Leader() { + + if cc.NodeID == n.Leader() && !n.IsLeader() { if err = n.Campaign(n.Ctx); err != nil { return err } } + if cc.NodeID == n.Config.ID { + // wait the commit ack to be sent before closing connection + n.asyncTasks.Wait() + + // if there are only 2 nodes in the cluster, and leader is leaving + // before closing the connection, leader has to ensure that follower gets + // noticed about this raft conf change commit. Otherwise, follower would + // assume there are still 2 nodes in the cluster and won't get elected + // into the leader by acquiring the majority (2 nodes) + + // while n.asyncTasks.Wait() could be helpful in this case + // it's the best-effort strategy, because this send could be fail due to some errors (such as time limit exceeds) + // TODO(Runshen Zhu): use leadership transfer to solve this case, after vendoring raft 3.0+ + } + return n.cluster.RemoveMember(cc.NodeID) } diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/store/by.go b/vendor/src/github.com/docker/swarmkit/manager/state/store/by.go index e4bb335229..f23242002c 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/store/by.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/store/by.go @@ -19,6 +19,16 @@ func (a byAll) isBy() { // set. var All byAll +type byNamePrefix string + +func (b byNamePrefix) isBy() { +} + +// ByNamePrefix creates an object to pass to Find to select by query. +func ByNamePrefix(namePrefix string) By { + return byNamePrefix(namePrefix) +} + type byIDPrefix string func (b byIDPrefix) isBy() { diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/store/clusters.go b/vendor/src/github.com/docker/swarmkit/manager/state/store/clusters.go index f37d58dc2a..eac5dd917a 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/store/clusters.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/store/clusters.go @@ -173,7 +173,7 @@ func GetCluster(tx ReadTx, id string) *api.Cluster { func FindClusters(tx ReadTx, by By) ([]*api.Cluster, error) { checkType := func(by By) error { switch by.(type) { - case byName, byIDPrefix: + case byName, byNamePrefix, byIDPrefix: return nil default: return ErrInvalidFindBy @@ -225,3 +225,7 @@ func (ci clusterIndexerByName) FromObject(obj interface{}) (bool, []byte, error) // Add the null character as a terminator return true, []byte(strings.ToLower(c.Spec.Annotations.Name) + "\x00"), nil } + +func (ci clusterIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { + return prefixFromArgs(args...) +} diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/store/memory.go b/vendor/src/github.com/docker/swarmkit/manager/state/store/memory.go index 35d47682a2..116cfad359 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/store/memory.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/store/memory.go @@ -577,6 +577,12 @@ func (tx readTx) findIterators(table string, by By, checkType func(By) error) ([ return nil, err } return []memdb.ResultIterator{it}, nil + case byNamePrefix: + it, err := tx.memDBTx.Get(table, indexName+prefix, strings.ToLower(string(v))) + if err != nil { + return nil, err + } + return []memdb.ResultIterator{it}, nil case byNode: it, err := tx.memDBTx.Get(table, indexNodeID, string(v)) if err != nil { diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/store/networks.go b/vendor/src/github.com/docker/swarmkit/manager/state/store/networks.go index 4afea236e1..74d65c4e07 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/store/networks.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/store/networks.go @@ -167,7 +167,7 @@ func GetNetwork(tx ReadTx, id string) *api.Network { func FindNetworks(tx ReadTx, by By) ([]*api.Network, error) { checkType := func(by By) error { switch by.(type) { - case byName, byIDPrefix: + case byName, byNamePrefix, byIDPrefix: return nil default: return ErrInvalidFindBy @@ -219,3 +219,7 @@ func (ni networkIndexerByName) FromObject(obj interface{}) (bool, []byte, error) // Add the null character as a terminator return true, []byte(strings.ToLower(n.Spec.Annotations.Name) + "\x00"), nil } + +func (ni networkIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { + return prefixFromArgs(args...) +} diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/store/nodes.go b/vendor/src/github.com/docker/swarmkit/manager/state/store/nodes.go index 9b571def13..04985fc5a2 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/store/nodes.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/store/nodes.go @@ -165,7 +165,7 @@ func GetNode(tx ReadTx, id string) *api.Node { func FindNodes(tx ReadTx, by By) ([]*api.Node, error) { checkType := func(by By) error { switch by.(type) { - case byName, byIDPrefix, byRole, byMembership: + case byName, byNamePrefix, byIDPrefix, byRole, byMembership: return nil default: return ErrInvalidFindBy @@ -221,6 +221,10 @@ func (ni nodeIndexerByHostname) FromObject(obj interface{}) (bool, []byte, error return true, []byte(strings.ToLower(n.Description.Hostname) + "\x00"), nil } +func (ni nodeIndexerByHostname) PrefixFromArgs(args ...interface{}) ([]byte, error) { + return prefixFromArgs(args...) +} + type nodeIndexerByRole struct{} func (ni nodeIndexerByRole) FromArgs(args ...interface{}) ([]byte, error) { diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/store/services.go b/vendor/src/github.com/docker/swarmkit/manager/state/store/services.go index 2933253a22..d033b01a5c 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/store/services.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/store/services.go @@ -167,7 +167,7 @@ func GetService(tx ReadTx, id string) *api.Service { func FindServices(tx ReadTx, by By) ([]*api.Service, error) { checkType := func(by By) error { switch by.(type) { - case byName, byIDPrefix: + case byName, byNamePrefix, byIDPrefix: return nil default: return ErrInvalidFindBy @@ -219,3 +219,7 @@ func (si serviceIndexerByName) FromObject(obj interface{}) (bool, []byte, error) // Add the null character as a terminator return true, []byte(strings.ToLower(s.Spec.Annotations.Name) + "\x00"), nil } + +func (si serviceIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { + return prefixFromArgs(args...) +} diff --git a/vendor/src/github.com/docker/swarmkit/manager/state/store/tasks.go b/vendor/src/github.com/docker/swarmkit/manager/state/store/tasks.go index c8f3ea336c..5ca7e2ac72 100644 --- a/vendor/src/github.com/docker/swarmkit/manager/state/store/tasks.go +++ b/vendor/src/github.com/docker/swarmkit/manager/state/store/tasks.go @@ -175,7 +175,7 @@ func GetTask(tx ReadTx, id string) *api.Task { func FindTasks(tx ReadTx, by By) ([]*api.Task, error) { checkType := func(by By) error { switch by.(type) { - case byName, byIDPrefix, byDesiredState, byNode, byService, bySlot: + case byName, byNamePrefix, byIDPrefix, byDesiredState, byNode, byService, bySlot: return nil default: return ErrInvalidFindBy @@ -228,6 +228,10 @@ func (ti taskIndexerByName) FromObject(obj interface{}) (bool, []byte, error) { return true, []byte(strings.ToLower(t.ServiceAnnotations.Name) + "\x00"), nil } +func (ti taskIndexerByName) PrefixFromArgs(args ...interface{}) ([]byte, error) { + return prefixFromArgs(args...) +} + type taskIndexerByServiceID struct{} func (ti taskIndexerByServiceID) FromArgs(args ...interface{}) ([]byte, error) {