Commit graph

628 commits

Author SHA1 Message Date
Sebastiaan van Stijn
853df8f32b Merge pull request #34990 from pradipd/update_field_name
Update field name
2017-09-27 20:00:18 +02:00
Vincent Demeester
a343cba40c Merge pull request #34985 from thaJeztah/remove-use-of-deprecated-filter-functions
Remove use of deprecated filter functions
2017-09-27 17:34:07 +02:00
Sebastiaan van Stijn
0b968f9195 Merge pull request #34881 from ityangchen/test-moby
"docker swarm init --force-new-cluster" use limit
2017-09-27 14:11:46 +02:00
Pradip Dhara
d00a07b1e6 Updating moby to correspond to naming convention used in https://github.com/docker/swarmkit/pull/2385
Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
2017-09-26 22:08:10 +00:00
Sebastiaan van Stijn
a4efe66cf2
Replace uses of filters.ToParam(), FromParam() with filters.ToJSON(), FromJSON()
`filters.ToParam()` and `filters.FromParam()` were deprecated in favor of
`filters.ToJSON()` and `filters.FromJSON()` in 065118390a,
but still used in various locations.

This patch replaces uses of `filters.ToParam()` and  `filters.FromParam()` with
`filters.ToJSON()` and `filters.FromJSON()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-26 13:59:45 +02:00
Sebastiaan van Stijn
97c5ae25c4
Replace uses of filters.Include() with filters.Contains()
The `filters.Include()` method was deprecated in favor of `filters.Contains()`
in 065118390a, but still used in various
locations.

This patch replaces uses of `filters.Include()` with `filters.Contains()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-09-26 13:39:56 +02:00
yangchenliang
12e947efdb "docker swarm init --force-new-cluster" use limit
Signed-off-by: yangchenliang <yangchenliang@huawei.com>

When worker executor `docker swarm init
--force-new-cluster`,docker would hang.So only manager can process it.

Signed-off-by: yangchenliang <yangchenliang@huawei.com>
2017-09-26 12:05:19 +08:00
Pradip Dhara
9bed0883e7 Enabling ILB/ELB on windows using per-node, per-network LB endpoint.
Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
2017-09-18 20:27:56 +00:00
Yong Tang
2ee8ef864f Merge pull request #34686 from mion00/templating-node-hostname-support
Add support for .Node.Hostname templating in swarm services
2017-09-13 21:06:11 -07:00
Daniel Nephin
f7f101d57e Add gosimple linter
Update gometalinter

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-09-12 12:09:59 -04:00
Carlo Mion
e2f09fa6dd Add support for .Node.Hostname templating in swarm services
Signed-off-by: Carlo Mion <mion00@gmail.com>
2017-09-02 10:06:16 +02:00
Daniel Nephin
2f5f0af3fd Add unconvert linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-24 15:08:31 -04:00
Brian Goff
ebcb7d6b40 Remove string checking in API error handling
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-15 16:01:11 -04:00
Victor Vieux
4930020210 hide swarm plugins behind experimental flag
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-08 18:33:25 -07:00
Derek McGowan
1009e6a40b
Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-31 13:16:46 -07:00
Brian Goff
9319a8a2dd Merge pull request #33440 from RenaudWasTaken/genericresource
Added support for Generic Resources
2017-07-25 15:32:25 -04:00
Renaud Gaubert
87e1464c43 Added support for Generic Resources
Signed-off-by: Renaud Gaubert <rgaubert@nvidia.com>
2017-07-24 17:49:56 -07:00
Aaron Lehmann
bd4f66c8f1 cluster: Avoid recursive RLock
GetTasks can call GetService and GetNode with the read lock held. These
methods try to aquire the read side of the same lock. According to the
sync package documentation, this is not safe:

> If a goroutine holds a RWMutex for reading, it must not expect this or
> any other goroutine to be able to also take the read lock until the
> first read lock is released. In particular, this prohibits recursive
> read locking. This is to ensure that the lock eventually becomes
> available; a blocked Lock call excludes new readers from acquiring the
> lock.

Fix GetTasks to use the lower-level getService and getNode methods
instead. Also, use lockedManagerAction to simplify GetTasks.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-07-24 10:52:44 -07:00
Aaron Lehmann
b642b3f21f Avoid using a map for log attributes
Having a map per log entry seemed heavier than necessary. These
attributes end up being sorted and serialized, so storing them in a map
doesn't add anything (there's no random access element). In SwarmKit,
they originate as a slice, so there's an unnecessary conversion to a map
and back.

This also fixes the sort comparator, which used to inefficiently split
the string on each comparison.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-07-18 19:01:20 -07:00
Liron Levin
7d45cafd57 pluggable secret backend
This commit extends SwarmKit secret management with pluggable secret
backends support.

Updating the work in
[swarmkit](docker/swarmkit@eebac27434) for
pluggable secret backend and adding the
driver parameter to `SecretSpec`.

Remaining work:
- [ ] CLI support (docker/cli)
- [ ] api in [plugin helpers](docker/go-plugins-helpers))
- [ ] Reference plugin
- [ ] Documenation (after cli work)

Signed-off-by: Liron Levin <liron@twistlock.com>
2017-07-15 16:50:02 +03:00
Yassine TIJANI
27c0131a43 renaming id() to state clearly that it's related to the networkAttachement container target
Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>
2017-07-12 15:58:31 +02:00
Sebastiaan van Stijn
c0e6da7637 Merge pull request #34061 from cyli/re-vendor-swarmkit
Re-vendor swarmkit.
2017-07-11 20:30:56 -07:00
Ying Li
4509a001df Re-vendor swarmkit. This includes the following fixes:
- https://github.com/docker/swarmkit/pull/2266 (support for templating Node.Hostname in docker executor)
- https://github.com/docker/swarmkit/pull/2281 (change restore action on objects to be update, not delete/create)
- https://github.com/docker/swarmkit/pull/2285 (extend watch queue with timeout and size limit)
- https://github.com/docker/swarmkit/pull/2253 (version-aware failure tracking in the scheduler)
- https://github.com/docker/swarmkit/pull/2275 (update containerd and port executor to container client library)
- https://github.com/docker/swarmkit/pull/2292 (rename some generic resources)
- https://github.com/docker/swarmkit/pull/2300 (limit the size of the external CA response)
- https://github.com/docker/swarmkit/pull/2301 (delete global tasks when the node running them is deleted)

Minor cleanups, dependency bumps, and vendoring:
- https://github.com/docker/swarmkit/pull/2271
- https://github.com/docker/swarmkit/pull/2279
- https://github.com/docker/swarmkit/pull/2283
- https://github.com/docker/swarmkit/pull/2282
- https://github.com/docker/swarmkit/pull/2274
- https://github.com/docker/swarmkit/pull/2296 (dependency bump of etcd, go-winio)

Signed-off-by: Ying Li <ying.li@docker.com>
2017-07-11 13:43:43 -07:00
allencloud
ed916a233c make engine support cluster config event
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-07-11 17:21:15 +08:00
Vincent Demeester
e56e78976e Merge pull request #33377 from yastij/33371-matchevent-filtering
matching events using ID and name
2017-07-10 16:11:14 +02:00
Yassine TIJANI
be9aa09246 removing TODO, and explain why we can't filter by id on the matchevent method.
Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>
2017-07-07 23:32:37 +02:00
Brian Goff
72c3bcf2a5 Make plugin emit strongly typed, consumable events
Enables other subsystems to watch actions for a plugin(s).

This will be used specifically for implementing plugins on swarm where a
swarm controller needs to watch the state of a plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-07-06 14:26:06 -04:00
Josh Soref
39bcaee47b
Spelling fixes
* additional
* ambiguous
* anonymous
* anything
* application
* because
* before
* building
* capabilities
* circumstances
* commit
* committer
* compresses
* concatenated
* config
* container
* container's
* current
* definition
* delimiter
* disassociates
* discovery
* distributed
* doesnotexist
* downloads
* duplicates
* either
* enhancing
* enumerate
* escapable
* exactly
* expect
* expectations
* expected
* explicitly
* false
* filesystem
* following
* forbidden
* git with
* healthcheck
* ignore
* independent
* inheritance
* investigating
* irrelevant
* it
* logging
* looking
* membership
* mimic
* minimum
* modify
* mountpoint
* multiline
* notifier
* outputting
* outside
* overridden
* override
* parsable
* plugins
* precedence
* propagation
* provided
* provides
* registries
* repositories
* returning
* settings
* should
* signals
* someone
* something
* specifically
* successfully
* synchronize
* they've
* thinking
* uninitialized
* unintentionally
* unmarshaling
* unnamed
* unreferenced
* verify

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-03 13:13:09 -07:00
John Howard
4ec9766a27 LCOW: Fix nits from 33241
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-27 11:59:49 -07:00
John Howard
a1fe1dc791 LCOW: pull goes to correct stores
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-20 19:49:52 -07:00
John Howard
55f8828eec LCOW: Remove CommonContainer - just Container
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-06-20 08:55:46 -07:00
Ying Li
bdfbd22afb Redact the swarm's spec's signing CA cert when getting swarm info, because
otherwise if the user gets the info from the API, makes a non-CA related change,
then updates, swarm will interpret this as the user trying to remove the signing
key from the swarm.  We are redacting due to usability reasons, not because
the signing cert is secret.  The signing KEY is secret, hence it's redacted.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-06-15 18:26:01 -07:00
Kenfe-Mickaël Laventure
c86323c19d Merge pull request #33361 from aaronlehmann/no-join-address
cluster: Only pass a join address when in the process of joining a cluster
2017-06-14 14:08:37 -07:00
Madhu Venugopal
38c1553150 Service alias should not be copied to task alias
If a service alias is copied to task, then the DNS resolution on the
service name will resolve to service VIP and all of Task-IPs and that
will break the concept of vip based load-balancing resulting in all the
dns-rr caching issues.

This is a regression introduced in #33130

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2017-06-07 13:05:15 -07:00
Aaron Lehmann
24477e7004 cluster: Only pass a join address when in the process of joining a cluster
This code currently passes a random manager address when creating a new
Node. This doesn't really make sense - we should only pass a join
address on the initial join, or when retrying that join. An upcoming
change to swarmkit will pay attention to JoinAddr significant when a
node is already part of a cluster, so passing in the random value needs
to be avoided.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-23 15:03:56 -07:00
Aaron Lehmann
10df99f9ae Vendor swarmkit 7e096ced
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-23 15:01:35 -07:00
Ying Li
bf3e9293a6 Do not clear swarm directory at the begining of swarm init and swarm join now.
However, do clear the directory if init or join fails, because we don't
want to leave it in a half-finished state.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-22 17:45:20 -07:00
Evan Hazlett
8eeba75198
remove RuntimeData from cluster and types
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-05-19 17:10:32 -04:00
Brian Goff
39a604c0d4 Merge pull request #33286 from aboch/ingr
Properly identify ingress network created with older swarm
2017-05-19 10:04:29 -04:00
yupengzte
49bf533fe7 arg filt
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-05-19 13:47:32 +08:00
Alessandro Boch
93763f11ee Properly identify ingress network created with older swarm
- otherwise docker network prune will remove it

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-05-18 19:47:45 -07:00
Abhinandan Prativadi
fe11de0177 Adding network specific options to service create/update
The commit adds capability to accept csv parameters
for network option in service create/update commands.The change
includes name,alias driver options specific to the network.
With this the following will be supported

docker service create --name web --network name=docknet,alias=web1,driver-opt=field1=value1 nginx
docker service create --name web --network docknet nginx
docker service update web --network-add name=docknet,alias=web1,driver-opt=field1=value1
docker service update web --network-rm docknet

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2017-05-17 18:46:34 -07:00
Alessandro Boch
b34d3e730f Integrate local datascope network with swarm
Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-05-17 15:50:28 -07:00
Dong Chen
59d45c384a support cluster events
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2017-05-17 11:46:30 -07:00
Sebastiaan van Stijn
c053a2069e Merge pull request #32237 from jlhawn/update_container_wait
Update Container Wait
2017-05-17 02:39:52 +02:00
Tibor Vass
d6f4fe9e38 Merge pull request #32388 from nishanttotla/pin-by-digest-on-client-alternative
Moving docker service digest pinning to client side
2017-05-16 15:24:07 -07:00
Josh Hawn
4921171587 Update ContainerWait API
This patch adds the untilRemoved option to the ContainerWait API which
allows the client to wait until the container is not only exited but
also removed.

This patch also adds some more CLI integration tests for waiting for a
created container and waiting with the new --until-removed flag.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Handle detach sequence in CLI

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Update Container Wait Conditions

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Apply container wait changes to API 1.30

The set of changes to the containerWait API missed the cut for the
Docker 17.05 release (API version 1.29). This patch bumps the version
checks to use 1.30 instead.

This patch also makes a minor update to a testfile which was added to
the builder/dockerfile package.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Remove wait changes from CLI

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address minor nits on wait changes

- Changed the name of the tty Proxy wrapper to `escapeProxy`
- Removed the unnecessary Error() method on container.State
- Fixes a typo in comment (repeated word)

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Use router.WithCancel in the containerWait handler

This handler previously added this functionality manually but now uses
the existing wrapper which does it for us.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Add WaitCondition constants to api/types/container

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address more ContainerWait review comments

- Update ContainerWait backend interface to not return pointer values
  for container.StateStatus type.
- Updated container state's Wait() method comments to clarify that a
  context MUST be used for cancelling the request, setting timeouts,
  and to avoid goroutine leaks.
- Removed unnecessary buffering when making channels in the client's
  ContainerWait methods.
- Renamed result and error channels in client's ContainerWait methods
  to clarify that only a single result or error value would be sent
  on the channel.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Move container.WaitCondition type to separate file

... to avoid conflict with swagger-generated code for API response

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Address more ContainerWait review comments

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2017-05-16 15:11:39 -07:00
Josh Hawn
cfdf84d5d0 Update Container Wait Backend
This patch consolidates the two WaitStop and WaitWithContext methods
on the container.State type. Now there is a single method, Wait, which
takes a context and a bool specifying whether to wait for not just a
container exit but also removal.

The behavior has been changed slightly so that a wait call during a
Created state will not return immediately but instead wait for the
container to be started and then exited.

The interface has been changed to no longer block, but instead returns
a channel on which the caller can receive a *StateStatus value which
indicates the ExitCode or an error if there was one (like a context
timeout or state transition error).

These changes have been propagated through the rest of the deamon to
preserve all other existing behavior.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2017-05-16 15:09:14 -07:00
Nishant Totla
c0afd9c873
Disabling digest pinning for API versions < 1.30
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-05-15 16:42:43 -07:00
Nishant Totla
1efbe6e876
Adding Platforms field to TaskSpec
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-05-15 14:58:20 -07:00
Sebastiaan van Stijn
7fd8a9382c Merge pull request #32996 from dperny/service-logs-support-details
Fix Ambigious Logs Format and Add Support for Details in Service Logs
2017-05-15 13:57:44 +02:00
Drew Erny
68f21418ac Change log details encoding format and support details on service logs
URL query encode log details, so that characters like spaces don't make
log parsing ambiguous. Add a helper function to parse these details to a
map, if needed

Add support for details on service logs

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-05-12 10:53:44 -07:00
Aaron Lehmann
eb8abc9598 Merge pull request #32993 from cyli/root-rotation-cli
API changes to rotate swarm root CA
2017-05-12 10:12:32 -07:00
Aaron Lehmann
8fd55cd064 Merge pull request #31142 from dongluochen/network_converge_delay
add 2 seconds delay to allow gossip converge
2017-05-11 16:50:44 -07:00
Ying Li
a771c16834 Update the stream formatter to display custom unit numbers.
Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-11 11:13:11 -07:00
Ying Li
1847bb899a Propagate the desired CA certificate and CAConfig ForceRotate parameter
in the Docker REST APIs when viewing or updating the swarm spec info, and
also propagate the desired CA key in the Docker REST APIs when updating
swarm spec info only (it is not available for viewing).

Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-11 10:22:42 -07:00
Aaron Lehmann
9e9fc7b57c Add config support to executor backend
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-11 10:08:21 -07:00
Aaron Lehmann
7728557687 Add config APIs
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-11 10:08:21 -07:00
Flavio Crisciani
e2ec006797
Fix race condition between swarm and libnetwork
This commit in conjunction with a libnetwork side commit,
cleans up the libnetwork SetClusterProvider logic interaction.
The previous code was inducing libnetwork to spawn several go
routines that were racing between each other during the agent
init and close.

A test got added to verify that back to back swarm init and leave
are properly processed and not raise crashes

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-05-10 21:16:52 -07:00
Sebastiaan van Stijn
f02a5b50c4 Merge pull request #32875 from cyli/root-ca-info-in-api
Propagate TLS Info in swarm info and node info REST endpoints
2017-05-11 00:35:46 +02:00
Ying Li
64cccedbce Propagate the swarm cluster and node TLS info provided by the swarm
objects into the REST API responses.  In the CLI, display only
whether the nodes' TLS info matches the cluster's TLS info, or
whether the node needs cert rotation.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-05-10 11:29:17 -07:00
Nishant Totla
e842c653a0
Change GetRepository to take Named arguments
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-05-08 16:58:38 -07:00
Drew Erny
80c3ec027d Fix an issue with service logs hanging
Fixed an issue where service logs would hang if the container backing a
task was deleted by not waiting for containers to be ready if we're not
following logs.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-05-04 12:13:14 -07:00
Sebastiaan van Stijn
f0bb1d7a4a Merge pull request #32920 from fcrisciani/remote_addr
Change GetRemoteAddress to return an IP list
2017-04-28 15:42:21 -07:00
Flavio Crisciani
441e861095
Change GetRemoteAddr to return all managers
Respect the new provider interface

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-04-28 13:17:34 -07:00
Brian Goff
25058d9b0c Merge pull request #32828 from cyli/external-ca-cert
Add the `CACert` parameter to the `ExternalCA` object
2017-04-28 10:30:57 -04:00
Flavio Crisciani
8dc8cd4719
Inroduce SWARM --data-path-addr flag
This new flag will allow the configuration of an interface that
can be used for data path traffic to be isolated from control
plane traffic. This flag is simply percolated down to libnetwork
and will be used by all the global scope drivers (today overlay)

Negative test added for invalid flag arguments

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-04-26 15:33:15 -07:00
Ying Li
b0401a71f7 Add the CACert parameter to the ExternalCA object in order to match
swarmkit's API type.  Make sure this parameter gets propagated to
swarmkit, and also add an extra option to the CLI when providing
external CAs to parse the CA cert from a file.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-04-26 10:45:12 -07:00
Kenfe-Mickaël Laventure
e8abe0a69d Merge pull request #32540 from cpuguy83/add_logdrivers_to_info
Add logdrivers to /info
2017-04-25 23:25:30 -05:00
Evan Hazlett
bb30ab9b5f move service runtime filter to server
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-04-25 15:38:46 -04:00
Brian Goff
a709f79c1a Merge pull request #32654 from allencloud/use-make-slice-to-store-swarmkit-objects
use make slice to store cluster objects to improve efficiency
2017-04-22 12:02:34 -04:00
Aaron Lehmann
8a27758364 Hide zero-valued timestamps from service JSON
It was possible to see output like this:

        "UpdateStatus": {
            "State": "updating",
            "StartedAt": "2017-04-14T17:10:03.226607162Z",
            "CompletedAt": "1970-01-01T00:00:00Z",
            "Message": "update in progress"
        }

The timestamp fields were already changed to pointers, and left nil if
the timestamp value was zero. However the zero-value of a timestamp from
gRPC is different from the value Go considers to be zero. gRPC uses the
Unix epoch instead of Go's epoch. Therefore, check that the timestamp
does not match the Unix epoch.

Also, add " ago" to the timestamps as shown in "docker service inspect
--pretty", as they are shown as relative times.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-04-14 10:44:24 -07:00
allencloud
ac245e2845 use make slice to store objects to improve efficiency
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-04-14 11:02:28 +08:00
Tõnis Tiigi
01c80435c6 Merge pull request #32449 from aaronlehmann/cluster-locking
cluster: Allow reentrant calls to methods during shutdown
2017-04-12 18:58:12 -07:00
Brian Goff
17abacb894 Add logdrivers to /info
This is required for swarmkit to be able to filter based on log driver.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-04-11 18:07:15 -04:00
Evan Hazlett
dc762610ab add service convert tests
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-04-11 14:02:02 -04:00
Evan Hazlett
3a9be92927 return exec.Controller instead of nil
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-04-11 14:02:02 -04:00
Evan Hazlett
8c2c69d31e updates for review comments
- runtimeUrl -> type_url
- runtimes -> runtime

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-04-11 14:02:01 -04:00
Evan Hazlett
f71bdc67a2 filter services by runtime; default to container
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-04-11 14:02:01 -04:00
Evan Hazlett
e06e2ef107 add support for swarmkit generic runtime
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-04-11 14:02:01 -04:00
Brian Goff
b93db34363 Merge pull request #32503 from dongluochen/fix_startperiod
fix gRPC serialization for healthcheck start-period
2017-04-11 10:19:16 -04:00
Dong Chen
caab178509 fix gRPC serialization for healthcheck start-period
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2017-04-10 17:02:58 -07:00
Aaron Lehmann
1d274e9acf Change "service inspect" to show defaults in place of empty fields
This adds a new parameter insertDefaults to /services/{id}. When this is
set, an empty field (such as UpdateConfig) will be populated with
default values in the API response. Make "service inspect" use this, so
that empty fields do not result in missing information when inspecting a
service.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-04-10 13:41:16 -07:00
Aaron Lehmann
44ce809c95 cluster: Allow reentrant calls to methods during shutdown
The agent sometimes calls into libnetwork code that in turn calls
(*Cluster).IsAgent and (*Cluster).IsManager. These can cause the
node shutdown process to time out, since they wait for a lock that is
held by Cleanup.

It turns out c.mu doesn't need to be held while calling Stop. Holding
controlMutex is sufficient. Also, (*nodeRunner).Stop must release
nodeRunner's mu during the node shutdown process, otherwise the same
call into Cluster would be blocked on this lock instead.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-04-07 19:21:10 -07:00
Sebastiaan van Stijn
091b5e68ea Merge pull request #32339 from aluzzardi/selinux
services: Add support for Credential Spec and SELinux
2017-04-08 01:37:17 +02:00
Brian Goff
4a1a64c677 Merge pull request #32154 from dperny/refactor-logs
Refactor logs and support service logs with TTY
2017-04-07 18:06:50 -04:00
Andrea Luzzardi
89a995a9d7 services: Add support for Credential Spec and SELinux
- Defined "normalized" type for Credential Spec and SELinux
- Added --credential-spec to docker service create & update
- SELinux is API only at the time

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2017-04-07 11:30:54 -07:00
Vincent Demeester
87562af45b Merge pull request #32283 from aboch/clearingress
Daemon to take care of ingress cleanup on cluster leave and graceful shutdown
2017-04-07 20:09:27 +02:00
Drew Erny
1044093bb0 refactor logs and support service logs /w tty
Refactor container logs system to make communicating log messages
internally much simpler. Move responsibility for marshalling log
messages into the REST server. Support TTY logs. Pave the way for fixing
the ambiguous bytestream format. Pave the way for fixing details.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-04-06 17:54:11 -07:00
Aaron Lehmann
9b54994a8a Add support for update order
This parameter controls the order of operations when rolling out an
update task. Either the old task is stopped before starting the new one,
or the new task is started first, and the running tasks will briefly
overlap.

This commit adds Rollout to the API, and --update-order / --rollback-order
flags to the CLI.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-04-06 17:23:36 -07:00
Elias Faxö
e401f63735 Added start period option to health check.
Signed-off-by: Elias Faxö <elias.faxo@gmail.com>
2017-04-06 12:35:34 +02:00
Andrea Luzzardi
367b57d985 Re-vendor docker/swarmkit to d2e48a332063ccd4ea26b6262ee717de997de560
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2017-04-05 18:49:23 -07:00
Alessandro Boch
6f4bb796dd Daemon to take care of ingress cleanup on leave & shutdown
Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-04-05 16:31:43 -07:00
Victor Vieux
170be9c267 Merge pull request #32015 from dperny/service-logs-support-task-logs
Add Support for Service Task Logs
2017-04-04 00:15:13 -07:00
Drew Erny
d330dc3223 Add support for task and arbitrary combo logs
Refactored the API to more easily accept new endpoints. Added REST,
client, and CLI endpoints for getting logs from a specific task. All
that is needed after this commit to enable arbitrary service log
selectors is a REST endpoint and handler.

Task logs can be retrieved by putting in a task ID at the CLI instead of
a service ID.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-04-03 18:40:54 -07:00
Aaron Lehmann
91c86c7e26 Add support for UpToDate filter, for internal use
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-31 10:01:32 -07:00
Dong Chen
bcb53d3489 Call deactivateServiceBinding when necessary
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2017-03-29 11:48:34 -07:00
Dong Chen
4d23394333 add 2 seocnd delay to allow gossip converge
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2017-03-29 11:48:34 -07:00
Sebastiaan van Stijn
a1099010b0 Merge pull request #32085 from aboch/bd
Do not panic on redundant UpdateAttachment
2017-03-29 12:04:05 +02:00
Aaron Lehmann
3894254ddd api: Omit Cluster, Nodes, and Managers from swarm info when unavailable
Currently these fields are included in the response JSON with zero
values. It's better not to include them if the information is
unavailable (for example, on a worker node).

This turns Cluster into a pointer so that it can be left out.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-28 14:20:25 -07:00
Sebastiaan van Stijn
4df350b8c7 Merge pull request #30810 from allencloud/make-secret-ls-support-filter
make secret ls support filters in CLI
2017-03-28 13:43:19 +02:00
Alessandro Boch
3bf164e48d Do not panic on redundant UpdateAttachment
Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-03-27 08:52:03 -07:00
allencloud
3935074016 make secret ls support filters in CLI
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-03-27 10:16:45 +08:00
Alessandro Boch
d59d19c328 Allow user to modify ingress network
Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-03-26 15:46:18 -07:00
Aaron Lehmann
9b33edfa7e Merge pull request #31631 from aaronlehmann/swarm-failure-on-startup
cluster: Proceed with startup if cluster component can't be created
2017-03-22 16:40:49 -07:00
Vincent Demeester
0fe41cc4db Merge pull request #31820 from ehazlett/secrets-restrict
Restrict secret view to node level in controller
2017-03-17 14:25:32 +01:00
Yong Tang
43a1bd564b Support --filter mode=global|replicated for docker service ls
This fix tries to address the request in 31325 by adding
`--filter mode=global|replicated` to `docker service ls`.

As `docker service ls` has a `MODE` column by default, it is natural
to support `--filter mode=global|replicated` for `docker service ls`.

There are multiple ways to address the issue. One way is to pass
the filter of mode to SwarmKit, another way is to process the filter
of mode in the daemon.

This fix process the filter in the daemon.

Related docs has been updated.

An integration test has been added.

This fix fixes 31325.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-03-15 11:06:57 -07:00
Victor Vieux
08bbd434f5 Merge pull request #31586 from aaronlehmann/digest-pin-context
cluster: Renew the context after communicating with the registry
2017-03-14 09:46:15 -07:00
Evan Hazlett
8392123f30
restrict secret view to node level in controller
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-03-14 09:53:02 -04:00
Vincent Demeester
1d4608032d Merge pull request #31500 from dperny/fix-service-logs-cli
Add tail and since to service logs
2017-03-14 14:19:29 +01:00
Tõnis Tiigi
764e80e84c Merge pull request #31713 from nishanttotla/better-warnings
Improve warnings when image digest pinning fails
2017-03-13 17:57:06 -07:00
Nishant Totla
44855dff42
Improve warnings when image digest pinning fails
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-03-13 15:16:35 -07:00
Aaron Lehmann
47615d9871 Merge pull request #31674 from dperny/service-logs-err-on-tty
Error on attempting services logs on TTY container
2017-03-13 10:17:33 -07:00
Drew Erny
8dc437bd9b Add tail and since to service logs
This change adds the ability to do --tail and --since on docker service
logs. It wires up the API endpoints to each other and fixes some older
bugs. It adds integration tests for these new features.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-03-10 14:59:00 -08:00
Drew Erny
37ae1ef0ff Error on attempting service logs on TTY container
Right now getting logs from a service with an attached TTY does not
work. The behavior was undefined and caused the command to hang and
strange messages to occur in the daemon logs.

This returns errors, both deep in the swarmkit adapter (to guard against
undefined behavior, which is Bad) and in the daemon (to tell users that
the thing they're asking for is not possible).

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-03-10 14:48:56 -08:00
Aaron Lehmann
9d127f8de3 cluster: Fix shadowed resp variable
The response would never reach the client because it was being
redeclared in the current scope.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-09 17:58:12 -08:00
Vincent Demeester
d4a8c3b438 Merge pull request #30856 from allencloud/make-secret-update-support-name-and-id-prefix
make secret update support name and id prefix
2017-03-08 12:31:44 +01:00
Aaron Lehmann
f7d846094a cluster: Proceed with startup if cluster component can't be created
The current behavior is for dockerd to fail to start if the swarm
component can't be started for some reason. This can be difficult to
debug remotely because the daemon won't be running at all, so it's not
possible to hit endpoints like /info to see what's going on. It's also
very difficult to recover from the situation, since commands like
"docker swarm leave" are unavailable.

Change the behavior to allow startup to proceed.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-07 16:50:39 -08:00
Aaron Lehmann
497c4f05b9 Fix dropped field in task translation from GRPC to REST
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-07 14:55:15 -08:00
Brian Goff
fd5f9d7941 Merge pull request #31265 from cyli/remove_swarm_subdirs
Rather than remove the swarm directory and re-create, remove the subdirs
2017-03-07 14:30:34 -05:00
allencloud
9d30525a04 make secret update support name and id prefix
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-03-07 16:01:21 +08:00
Aaron Lehmann
f8273a216e cluster: Renew the context after communicating with the registry
When pinning by digest, the registry might be slow or unresponsive. This
could cause the context to already be expired by the time UpdateService
or CreateService is called. We want digest pinning to be a best-effort
operation, so it's problematic if a slow or misbehaving registry
prevents the service operation from completing. Replace the context
after communicating with the registry, so we have a fresh timeout for
the gRPC call.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-06 16:05:56 -08:00
Aaron Lehmann
f9bd8ec8b2 Implement server-side rollback, for daemon versions that support this
Server-side rollback can take advantage of the rollback-specific update
parameters, instead of being treated as a normal update that happens to
go back to a previous version of the spec.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-03 16:33:34 -08:00
Aaron Lehmann
3a88a24d23 Add support for rollback flags
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-03 16:33:34 -08:00
Aaron Lehmann
cc9d04647a Add support for the "rollback" failure action
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-03 16:33:34 -08:00
Sebastiaan van Stijn
57fd478169 Merge pull request #31083 from xulike666/fight-for-readability
fix some typos from module contrib to man
2017-03-03 15:13:01 +01:00
Sebastiaan van Stijn
3a5a1c3f3d Merge pull request #30725 from aaronlehmann/topology
Topology-aware scheduling
2017-03-03 15:01:12 +01:00
Ying Li
68506bd239 Rather than remove the swarm directory and re-create, remove the swarm subdirs
Signed-off-by: Ying Li <ying.li@docker.com>
2017-03-01 11:56:39 -08:00
Sebastiaan van Stijn
bb9f19503c Merge pull request #30754 from yongtang/25696-stop-signal
Add `--stop-signal` for `service create` and `service update`
2017-03-01 18:10:57 +01:00
Vincent Demeester
250e05e427
Add a lockedManagerAction method to Cluster…
… in order to remove duplication.
Each time we update a cluster object, we do some common
operations (lock, verify it's on a manager, get the request context,
and the update). This introduce a method and refactor few
update/remove method that allows to duplicate less code.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-28 11:12:11 +01:00
Vincent Demeester
a620c0172c
Refactor endpoint*FromGRPC to limit duplication
endpointSpecFromGRPC and endpointFromGRPC do the exact same thing for
endpoint{,Spec}.Ports, let's extract that to a method.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-28 10:51:55 +01:00
Vincent Demeester
3c5932086a
Remove daemon.VXSubnets duplicate code
Refactor daemon.V4Subnets and daemon.V6Subnets to limit duplication

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-28 10:51:40 +01:00
Aaron Lehmann
17288c611a Topology-aware scheduling
This adds support for placement preferences in Swarm services.

- Convert PlacementPreferences between GRPC API and HTTP API
- Add --placement-pref, --placement-pref-add and --placement-pref-rm to CLI
- Add support for placement preferences in service inspect --pretty
- Add integration test

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-02-27 13:29:54 -08:00
Drew Erny
f63c62ce70 Fix service logs API to be able to specify stream
Before this change, doing service logs was just tossing the stream
selectors and always using the default (both streams). This change adds
a check for which streams the user wants and only includes those.

Fixes #31306

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-02-23 15:09:09 -08:00
Aaron Lehmann
37b492ae1b Shutdown leaks an error when the container was never started
I found that sometimes tasks would end up in a rejected state when
trying to update them quickly. The problem was that Shutdown could fail
if called before the container was started. Instead of returning an
error in this case, Shutdown should succeed. This allows tasks to
progress to the "shutdown" state as expected.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-02-22 19:12:07 -08:00
Yong Tang
c2d49ec214 Add --stop-signal for service create and service update
This fix tries to address the issue raised in 25696 where
it was not possible to specify `--stop-signal` for `docker service create`
and `docker service update`, in order to use special signal to stop
the container.

This fix adds `--stop-signal` and update the `StopSignal` in `Config`
through `service create` and `service update`.

Related docs has been updated.

Integration test has been added.

This fix fixes 25696.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-21 15:19:45 -08:00
Aaron.L.Xu
e0577d5fe8 fix some typos from module contrib to man
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-02-18 10:08:55 +08:00
Alexander Morozov
0de867b315 Merge pull request #30967 from adshmh/24631-service-without-labels-returns-empty-map
Inspect output on service without labels is an empty map instead of null, fixes #24631
2017-02-17 08:49:32 -08:00
Alessandro Boch
91820b6941 Release the network attachment on allocation failure
- otherwise the attachment task will stay in store and
  consume IP addresses and there is no way to remove it.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-02-16 05:21:06 -08:00
Arash Deshmeh
1b347cfc79 Fixing #24631, inspect output on swarm object types without labels is empty object {}
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-02-15 01:25:55 -05:00
allencloud
75a315d43e create a new file swarm.go and move swarm part code from cluster.go into swarm.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-02-12 02:54:07 +08:00
allencloud
4f4151bba4 create a new file networks.go and move network part codes from cluster.go into networks.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-02-12 02:50:17 +08:00
allencloud
6be675c752 create a new file task.go and move task part codes from cluster.go into tasks.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-02-12 02:45:00 +08:00
allencloud
6ff14b48c7 create a new file services.go and move service part codes from cluster.go into services.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-02-12 02:43:23 +08:00
allencloud
7591e313a4 create a new file nodes.go and move node part codes from cluster.go into nodes.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-02-12 02:36:09 +08:00
allencloud
b6fb3a56dc refactor helper.go and move getSecret to helper.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-02-12 02:30:53 +08:00
Vincent Demeester
254fc83cba Merge pull request #30457 from dmcgowan/distribution-reference-update-2
reference: use distribution reference and remove fork
2017-02-07 22:01:25 +01:00
Derek McGowan
3a1279393f
Use distribution reference
Remove forked reference package. Use normalized named values
everywhere and familiar functions to convert back to familiar
strings for UX and storage compatibility.

Enforce that the source repository in the distribution metadata
is always a normalized string, ignore invalid values which are not.
Update distribution tests to use normalized values.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-07 11:08:37 -08:00
Vincent Demeester
09114fe9f0 Merge pull request #30197 from yongtang/30178-service-health-check-none
Fix issue where service healthcheck is `{}` in remote API
2017-02-07 17:17:26 +01:00
Stephen J Day
92899ffac8
cluster/executor: check mounts at start
While it is important to not create controllers for an invalid task,
certain properties should only be checked immediately before use. Early
host validation of mounts prevents resolution of the task Executor when
the mounts are not relevant to execution flow. In this case, we have a
check for the existence of a bind mount path in a creation function that
prevents a task controller from being resolved. Such early validation
prevents one from interacting directly with a controller and result in
unnecessary error reporting.

In accordance with the above, we move the validation of the existence of
host bind mount paths to the `Controller.Start` phase. We also call
these "checks", as they are valid mounts but reference non-existent
paths.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-02-06 13:09:53 -08:00
Vincent Demeester
829ea91bd1 Merge pull request #30633 from vdemeester/29809-fix-network-ipam-configuration-on-master
Follow-up of 29826 Use default driver for IPAM if none
2017-02-01 17:53:49 +01:00
Vincent Demeester
4c1b40b9d4 Merge pull request #28627 from yongtang/28624-docker-plugin-ls
Add `--filter enabled=true` for `docker plugin ls`
2017-02-01 16:52:00 +01:00
Vincent Demeester
c322064127
Use default driver for IPAM if none
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-01 15:54:56 +01:00
Yong Tang
499a0dd43e Add --read-only for service create and service update
This fix tries to address the issue raised in 29972 where
it was not possible to specify `--read-only` for `docker service create`
and `docker service update`, in order to have the container's root file
system to be read only.

This fix adds `--read-only` and update the `ReadonlyRootfs` in `HostConfig`
through `service create` and `service update`.

Related docs has been updated.

Integration test has been added.

This fix fixes 29972.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-30 12:47:26 -08:00
Yong Tang
8feb5c5a48 Fix issue where service healthcheck is {} in remote API
This fix tries to address the issue raised in 30178 where
service healthcheck is `{}` in remote API will result in
dns resolve failue.

The reason was that when service healthcheck is `{}`,
service binding was not done.

This fix fixes the issue.

An integration test has been added.

This fix fixes 30178.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-27 15:43:44 -08:00
Yong Tang
fa358a8757 Move secret name or ID prefix resolving from client to daemon
This fix is a follow up for comment:
https://github.com/docker/docker/pull/28896#issuecomment-265392703

Currently secret name or ID prefix resolving is done at the client
side, which means different behavior of API and CMD.

This fix moves the resolving from client to daemon, with exactly the
same rule:
- Full ID
- Full Name
- Partial ID (prefix)

All existing tests should pass.

This fix is related to #288896, #28884 and may be related to #29125.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-27 10:40:05 -08:00
Yong Tang
a66e0dc349 Add --filter enabled=true for docker plugin ls
This fix adds `--filter enabled=true` to `docker plugin ls`,
as was specified in 28624.

The related API and docs has been updated.

An integration test has been added.

This fix fixes 28624.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-26 13:16:11 -08:00
Alessandro Boch
3cedca5d53 Remove attachable network on swarm leave
- When the node leaves the cluster, if any user run
  container(s) is connected to the swarm network,
  then daemon needs to detach the container(s) and
  remove the network.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-01-26 11:16:07 -08:00
Aaron Lehmann
3e987e1732 Vendor swarmkit, containerd, and related dependencies
Update swarmkit to 037b491.

As swarmkit switched to a newer gRPC version, this also involves
updating Docker's vendored gRPC, which in turn requires updating
containerd to a new version that has protobufs generated against this
gRPC version.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-01-23 17:51:14 -08:00
Tibor Vass
2b89356c07 Merge pull request #30145 from anusha-ragunathan/ps-swarm
Pass plugingetter as part of swarm node config.
2017-01-20 10:35:49 -08:00
Anusha Ragunathan
fa784951ba Pass plugingetter as part of swarm node config.
This is necessary for swarmkit to support cluster wide plugins, such as
globally scoped network plugins.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
2017-01-19 17:11:12 -08:00
Aaron Lehmann
a992ff9fec Merge pull request #29980 from allencloud/fix-29520-info-incorrectness
return error when listNode fails
2017-01-19 10:41:02 -08:00
allencloud
8e04e9902a return error when listNode fails
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-01-19 14:02:06 +08:00
Nishant Totla
8de8b1d520
Make Docker automatically update hostname for Swarm node
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-01-18 15:55:53 -08:00
Yong Tang
0f30c64444 Allow swarm init with --availability=drain
This fix adds a new flag `--availability` to `swarm join`.

Related documentation has been updated.

An integration test has been added.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-10 16:31:51 -08:00
Yong Tang
a8e7e37aa8 Allow swarm join with --availability=drain
This fix tries to address the issue raised in 24596 where it was not
possible to join as manager only (`--availability=drain`).

This fix adds a new flag `--availability` to `swarm join`.

Related documentation has been updated.

An integration test has been added.

NOTE: Additional pull request for swarmkit and engine-api will
be created separately.

This fix fixes 24596.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-10 16:31:51 -08:00
Stephen J Day
7a85579917
*: use opencontainers/go-digest package
The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-06 18:48:41 -08:00
yuexiao-wang
9788822421 Remove redundant return nil
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-01-06 22:18:10 +08:00
Yanqiang Miao
98c0369437 Remove the redundant 'if' statements
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-01-03 11:31:41 +08:00
Ke Li
514adcf458 Remove redundant format
Signed-off-by: Ke Li <kel@splunk.com>

Add missing changes

Signed-off-by: Ke Li <kel@splunk.com>

User errors.New to create error

Signed-off-by: Ke Li <kel@splunk.com>
2016-12-27 21:46:52 +08:00
Tonis Tiigi
3d86b0c79b Implement content addressability for plugins
Move plugins to shared distribution stack with images.

Create immutable plugin config that matches schema2 requirements.

Ensure data being pushed is same as pulled/created.

Store distribution artifacts in a blobstore.

Run init layer setup for every plugin start.

Fix breakouts from unsafe file accesses.

Add support for `docker plugin install --alias`

Uses normalized references for default names to avoid collisions when using default hosts/tags.

Some refactoring of the plugin manager to support the change, like removing the singleton manager and adding manager config struct.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2016-12-23 13:29:58 -08:00
liwenqi
128d07d349 modify some files
Signed-off-by: liwenqi <vikilwq@zju.edu.cn>

update some files in the folder of distribution/xfer

Signed-off-by: liwenqi <vikilwq@zju.edu.cn>

correct again

Signed-off-by: liwenqi <vikilwq@zju.edu.cn>
2016-12-22 08:38:37 +08:00
Sebastiaan van Stijn
a58b5830b1 Merge pull request #26576 from allencloud/change-cluster-response-status-code
update response status code for cluster request
2016-12-19 18:31:45 +01:00
Vincent Demeester
eb59c6d587 Merge pull request #29378 from aaronlehmann/swarm-plugins
Support v2 plugins in swarm mode
2016-12-19 11:07:06 +01:00
allencloud
29d4a7f512 update response status code for cluster request
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-19 10:21:10 +08:00
Akihiro Suda
edfbc3b876 api: allow creating a network of which name is the prefix of the ID of a swarm network
Previously, it doesn't allow creating such a network:

e.g.

    $ docker network inspect -f '{{.Id}}' ingress
    84xh9knigj6zyt00u31e26nj3
    $ docker network create 84
    Error response from daemon: network with name 84 already exists

Fix #27866

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-12-15 15:09:06 +00:00
Aaron Lehmann
2a97ea9a6e Publish installed v2 plugins to manager
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-12-14 17:02:56 -08:00
Aaron Lehmann
d4d6f8c0d0 cli: Pin image to digest using content trust
Implement notary-based digest lookup in the client when
DOCKER_CONTENT_TRUST=1.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-12-14 10:49:33 -08:00
allencloud
0270645c13 return not a swarm when unlock
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-13 10:38:45 +08:00
Yong Tang
4d958e99c1 Fix missing IPAM options in swarm network mode
This fix tries to fix the issue raised in 29044 where
the IPAM options is missing in swarm network mode
after the service is deployed. Before the service
is deployed, the IPAM options is available.

The reason for the issue is that, before service is
deployed, `network inspect` is querying the swarm and
obtained the correct information.
However, after service is deployed, swarm executor
does not pass the IPAM options to the backend (daemon).
Also after service is deployed, `network inspect` is
actually querying the local daemon for information.
At this time the network information with missing IPAM
options is returned.

This fix fixes the issue by updating the swarm network
allocator and swarm executor.

A separate PR for swarmkit will be opened.

An integration test has been added to cover the change.

This fix fixes 29044.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-10 09:29:50 -08:00
Sebastiaan van Stijn
e94a40cdda Merge pull request #29041 from aaronlehmann/hide-updatestatus
api: Hide UpdateStatus when it is not present
2016-12-08 13:55:13 +01:00
allencloud
7bdd1a4f9c not export errors and forbid leave when unlocked
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-07 13:25:34 +08:00
Tõnis Tiigi
eefbf1ddd3 Merge pull request #28907 from tonistiigi/cluster-refactor
Switch cluster locking strategy
2016-12-06 10:02:23 -08:00
Brian Goff
3cb310c210 Merge pull request #28988 from vdemeester/28985-dont-validate-hostname
Remove hostname validation as it seems to break users
2016-12-02 21:16:56 -05:00
Brian Goff
a5b3649bfa Fix issue where TmpfsOptions are not sent to swarm
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-12-02 11:43:47 -05:00
Aaron Lehmann
0e70d96a68 api: Hide UpdateStatus when it is not present
When UpdateStatus was not present, the empty values of the timestamps
would be present:

        "UpdateStatus": {
            "StartedAt": "0001-01-01T00:00:00Z",
            "CompletedAt": "0001-01-01T00:00:00Z"
        }

To fix this, make the timestamps pointers, so they can be set to nil
when they should not be shown.

Also make UpdateStatus itself a pointer, so an empty object does not
show up when there is no UpdateStatus.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-12-01 15:08:41 -08:00
Tonis Tiigi
b7ea1bdb02 Switch cluster locking strategy
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-11-30 14:59:12 -08:00
Vincent Demeester
ef39256dfb
Remove hostname validation as it seems to break users
Validation is still done by swarmkit on the service side.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-11-30 19:22:07 +01:00
Vincent Demeester
768f4ce02b Merge pull request #28899 from aaronlehmann/dont-pull-image-id
Don't resolve or pull images referenced by ID
2016-11-30 10:08:43 +01:00
Madhu Venugopal
4fae94f663 Merge pull request #28721 from dongluochen/attachable_network
Fix network attachable option
2016-11-29 11:04:49 -08:00
Sebastiaan van Stijn
492bc8eb45 Merge pull request #28905 from jlhawn/reject_unspecified_advertise_addr
Reject unspecified advertise addr on swarm init
2016-11-29 16:24:45 +01:00
Sebastiaan van Stijn
209c6a419a Merge pull request #28935 from likel/improve-style
Initialize field with name
2016-11-29 15:52:13 +01:00
Ke Li
da6944ec87 Initialize field with name
Signed-off-by: Ke Li <kel@splunk.com>
2016-11-29 19:36:56 +08:00
Aaron Lehmann
9dba9e3248 cluster: Refuse swarm spec not named "default"
If, using the API, a user submits an init request with a spec that has a
name other than "default", the engine will rename the "default" cluster
object. Some parts of swarmkit depend on having a cluster object named
"default". Reject any specs that use other names.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-11-28 17:19:29 -08:00
Dong Chen
abcb699ad1 Fix network attachable option.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2016-11-28 16:54:56 -08:00
Josh Hawn
eeac871946 Reject unspecified advertise addr on swarm init
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2016-11-28 15:44:06 -08:00
Aaron Lehmann
089842c4b4 Don't resolve or pull images referenced by ID
If a swarm service is created using an image ID, it's useless to try to
pull this reference or resolve it to a manifest digest. Avoid doing this
when a fully qualified image ID is given.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-11-28 13:53:52 -08:00
Ben Firshman
70acb89fa2
Improve error when connecting service to network
The error didn't hint at how to resolve it. Google auto-suggest
also implies that people have been Googling this error.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-24 14:43:24 +00:00
cyli
2c0613540a Do not display the digest or size of swarm secrets
Signed-off-by: cyli <cyli@twistedmatrix.com>
2016-11-22 18:13:27 -05:00
Sebastiaan van Stijn
0415525049 Merge pull request #26833 from cpuguy83/use_mounts_api_for_services
Use container Mounts API for Swarm containers.
2016-11-22 22:48:54 +01:00
Brian Goff
821aeb6a6f Use container Mounts API for Swarm containers.
Instead of converting nicely typed service mounts into untyped `Binds`
when creating containers, use the new `Mounts` API which is a 1-1
mapping between service mounts and container mounts.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-11-22 13:23:51 -05:00
Andrea Luzzardi
c2d435e4f0 service logs: Support no-follow mode
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2016-11-21 18:02:13 -08:00
Victor Vieux
6e4a3c4546 Merge pull request #28649 from allencloud/judge-locked-before-parsing-key
judge manager if locked before parsing key
2016-11-21 13:33:38 -08:00
Vincent Demeester
05963010ee Merge pull request #28556 from ehazlett/container-secret-store
Fix target reference secrets and container secret store
2016-11-21 21:40:01 +01:00
allencloud
89100c162b judge manager if locked before parsing key
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-11-21 16:39:09 +08:00
Victor Vieux
9c559e6d0b fix a few golint errors
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2016-11-18 18:32:02 -08:00
Aaron Lehmann
30d0c3899e Merge pull request #28421 from aaronlehmann/digest-pinning-warnings
Return warnings from service create/update when digest pinning fails
2016-11-18 11:33:17 -08:00
Evan Hazlett
eb036ea4db
lint fixes
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-18 13:04:08 -05:00
Aaron Lehmann
948e60691e Return warnings from service create and service update when digest pinning fails
Modify the service update and create APIs to return optional warning
messages as part of the response. Populate these messages with an
informative reason when digest resolution fails.

This is a small API change, but significantly improves the UX. The user
can now get immediate feedback when they've specified a nonexistent
image or unreachable registry.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-11-18 09:31:31 -08:00
allencloud
972a246c67 judge manager before unlocking
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-11-18 23:49:40 +08:00
Evan Hazlett
bebd472e40 do not force target type for secret references
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

use secret store interface instead of embedded secret data into container

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-17 15:49:02 -05:00
Alexander Morozov
8a6c5358af Merge pull request #28536 from allencloud/remove-unused-err-ErrPendingSwarmExists
remove unused error ErrPendingSwarmExists
2016-11-17 10:17:47 -08:00
yupeng
9551dd03cf Fix the typo
Signed-off-by: yupeng <yu.peng36@zte.com.cn>
2016-11-17 14:13:38 +08:00
allencloud
7777557a3a remove unused error ErrPendingSwarmExists
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-11-17 14:06:08 +08:00
Vincent Demeester
673c5ee559 Merge pull request #27631 from allencloud/get-node-brefore-update
allow node update API to receive node name and id prefix
2016-11-16 17:47:31 +01:00
Tõnis Tiigi
6697fa8a68 Merge pull request #28447 from nishanttotla/use-distribution-reference-pkg
Using distribution reference pkg (pin image by digest)
2016-11-15 20:05:26 -08:00
allencloud
d075b83dd6 allow node update api receive node name and id prefix
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-11-16 10:18:19 +08:00
Nishant Totla
dc1b6341b9
Refactoring code for pinning image by digest
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2016-11-15 13:54:47 -08:00
allencloud
729b49e9c5 move func getNetwork into helper.go to keep consistent
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-11-16 00:28:56 +08:00
allencloud
1addb4817b judge manager before getting secret
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-11-13 12:52:09 +08:00
Vincent Demeester
84450b72cd Add support for stdin_open in composefile v3
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-11-11 15:19:00 +01:00
Tõnis Tiigi
a5da9f5cc9 Merge pull request #27917 from mrjana/ports
Add support for host port PublishMode in services
2016-11-10 19:38:54 -08:00
Tõnis Tiigi
1229105582 Merge pull request #28265 from aaronlehmann/dont-repull-digest
executor: Don't repull image if pinned by digest
2016-11-10 19:19:31 -08:00
Jana Radhakrishnan
14ac9f60d0 Add support for host port PublishMode in services
Add api/cli support for adding host port PublishMode in services.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-11-10 18:07:55 -08:00
Victor Vieux
750d634d62 Merge pull request #27998 from dnephin/compose-on-swarm
Support `docker stack deploy` from a Compose file
2016-11-10 17:59:57 -08:00
Victor Vieux
bed96ce922 Merge pull request #28031 from yongtang/27902-extra-hosts
Add flag `--host` to `service create` and `--host-add/rm` to `service update`
2016-11-10 16:55:29 -08:00
John Howard
1e592349f1 Merge pull request #28228 from tonistiigi/swarm-cert-expired
Start daemon if certificates have been expired
2016-11-10 15:50:36 -08:00
Aaron Lehmann
5d1feb561f Merge pull request #28221 from aboch/ala
Add local address autodetection on swarm init
2016-11-10 15:45:59 -08:00
Aaron Lehmann
f69e5c18ac executor: Don't repull image if pinned by digest
If the image reference in the spec uses a digest, and an image with that
digest already exists locally, avoid an unnecessary repull.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-11-10 14:45:54 -08:00
Tonis Tiigi
439de7694d Start daemon if certificates have been expired
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-11-10 14:11:53 -08:00
Andrea Luzzardi
819d0159bb api: Service Logs support
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2016-11-10 13:46:02 -08:00
Alessandro Boch
c8d0cb9e71 Add local address autodetection on swarm init
- when advertise-addr is not local and listen-addr is
  not specified

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-11-10 13:45:32 -08:00
Andrea Luzzardi
0ec6865713 cluster executor: Logs retrieving support.
Plumbed the executor to the container logs backend.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2016-11-10 12:02:47 -08:00
Andrea Luzzardi
c13bf5ba51 Merge pull request #28173 from nishanttotla/pin-images-by-digest
Pin images by digest
2016-11-10 10:59:28 -08:00
Yong Tang
ea9a23ccdb Add flag --host to service create and --host-add/--host-rm to service update
This fix tries to address 27902 by adding a flag `--host`
to `docker service create` and `--host-add/--host-rm` to
`docker service update`, so that it is possible to
specify extra `host:ip` settings in `/etc/hosts`.

This fix adds `Hosts` in swarmkit's `ContainerSpec` so that it
is possible to specify extra hosts during service creation.

Related docs has been updated.

An integration test has been added.

This fix fixes 27902.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-11-10 10:20:24 -08:00
Daniel Nephin
eefccc25c5 Add integration test for stack deploy.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-11-10 11:28:18 -05:00
Vincent Demeester
d0117238fa Fix hostname support for compose file
Pass the hostname from ContainerSpec to the actual container.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-11-10 11:28:18 -05:00
Nishant Totla
764a9ed357
Pin image by digest on service create and update
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2016-11-09 23:31:26 -08:00
Aaron Lehmann
c3c70c4bcd Lock/unlock integration tests
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-11-09 16:09:01 -08:00
Aaron Lehmann
a6030a50c9 Add unlock key rotation
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-11-09 16:09:01 -08:00
Aaron Lehmann
0f9fc54df9 Revise swarm init/update flags, add unlocking capability
- Neither swarm init or swarm update should take an unlock key
- Add an autolock flag to turn on autolock
- Make the necessary docker api changes
- Add SwarmGetUnlockKey API call and use it when turning on autolock
- Add swarm unlock-key subcommand

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-11-09 16:09:00 -08:00
Tonis Tiigi
b4a667c8c4 Add support for swarm init lock and swarm unlock
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-11-09 16:09:00 -08:00
Victor Vieux
8ffd1a370c Merge pull request #28025 from vdemeester/swarm-mode-templating
Add support for swarm mode templating
2016-11-09 15:57:52 -08:00
Vincent Demeester
6212ea669b
Add support for swarm mode templating
Wire templating support of swarmkit for the engine, in order to be used
through services.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-11-09 23:28:06 +01:00
Evan Hazlett
a9d4118429 embed spec when converting from grpc
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-09 14:27:45 -05:00
Evan Hazlett
eff36b7d66 more review updates
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-09 14:27:45 -05:00
Evan Hazlett
583c013a87 support labels for secrets upon creation; review updates
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-09 14:27:45 -05:00
Evan Hazlett
b2e4c7f3b5 review updates
- use Filters instead of Filter for secret list
- UID, GID -> string
- getSecrets -> getSecretsByName
- updated test case for secrets with better source
- use golang.org/x/context instead of context
- for grpc conversion allocate with make
- check for nil with task.Spec.GetContainer()

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-09 14:27:45 -05:00
Evan Hazlett
88dea0e06e update to support new target in swarmkit
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-09 14:27:44 -05:00
Evan Hazlett
f50a65ff0c update to support latest swarm changes
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-11-09 14:27:43 -05:00