Commit Graph

30 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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