plaurent
c599566439
Allow for OomScoreAdj
...
Signed-off-by: plaurent <patrick@saint-laurent.us>
(cherry picked from commit aa2c2cd906
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 19:06:39 +02:00
Sebastiaan van Stijn
2088c5963b
vendor: github.com/docker/docker 1a1f3cff45ec (master, v27.0-dev)
...
Rewrite local code to use the new container.Ulimit alias to start
transitioning away from direct uses of go-units.Ulimit.
full diff: https://github.com/docker/docker/compare/v27.0.0-rc.2...1a1f3cff45ec5aba4a520fae88b4f929eab8b3e8
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-20 13:04:54 +02:00
Sebastiaan van Stijn
97b7746df0
vendor: github.com/docker/docker 59996a493cfc (v27.0.0-dev)
...
full diff: 181e70cc07...59996a493c
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-07 16:11:03 +02:00
Rob Murray
94f9de5928
Handle networks.driver_opts for a service
...
These are endpoint-specific driver options...
services:
myservice:
image: myimage
networks:
mynet:
driver_opts:
"option1": "value1"
The API has had support for a long time, it's only recently been
added to compose (unreleased right now).
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-06-07 08:20:43 +00:00
Casey Korver
d4491fc093
Correct typos in the cli/ folder
...
Signed-off-by: Casey Korver <casey@korver.dev>
2024-06-04 03:08:56 +00:00
Mathias Duedahl
ccfd0b2cc2
test/ Improve test coverage in volume.go
...
Co-authored-by: Adam Siraj <40822894+asirago@users.noreply.github.com>
Co-authored-by: Emil Sjölander <72094310+emilsjol@users.noreply.github.com>
Co-authored-by: Omar Askar Vergara <71982892+Omar-AV@users.noreply.github.com>
Co-authored-by: Emir Catir <emir.catir@gmail.com>
Signed-off-by: Mathias Duedahl <64321057+Lussebullen@users.noreply.github.com>
2024-03-20 19:53:33 +01:00
Brian Goff
5400a48aaf
Plumb contexts through commands
...
This is to prepare for otel support.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-12 22:30:16 +01:00
Sebastiaan van Stijn
539537ddf5
vendor: github.com/docker/docker cfdca8dc1d4c (v25.0.0-dev)
...
also added nolint:staticcheck to spec.Networks refs
full diff: https://github.com/docker/docker/compare/v25.0.0-beta.1...cfdca8dc1d4c84ee235f395a011ca62315c957a7
Co-authored-by: Albin Kerouanton <albinker@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-24 09:50:12 +01:00
Sebastiaan van Stijn
9c0c49a5f2
golangci-lint: revive: enable empty-lines
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-20 19:52:45 +01:00
Sebastiaan van Stijn
8e9aec6904
golangci-lint: revive: enable import-shadowing
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-20 19:52:41 +01:00
Sebastiaan van Stijn
888df09879
linting: address assorted issues found by gocritic
...
internal/test/builders/config.go:36:15: captLocal: `ID' should not be capitalized (gocritic)
func ConfigID(ID string) func(config *swarm.Config) {
^
internal/test/builders/secret.go:45:15: captLocal: `ID' should not be capitalized (gocritic)
func SecretID(ID string) func(secret *swarm.Secret) {
^
internal/test/builders/service.go:21:16: captLocal: `ID' should not be capitalized (gocritic)
func ServiceID(ID string) func(*swarm.Service) {
^
cli/command/image/formatter_history.go💯 15: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(c.h.CreatedBy, "\t", " ", -1)` (gocritic)
createdBy := strings.Replace(c.h.CreatedBy, "\t", " ", -1)
^
e2e/image/push_test.go:246:34: badCall: suspicious Join on 1 argument (gocritic)
assert.NilError(t, os.RemoveAll(filepath.Join(dir.Join("trust"))))
^
e2e/image/push_test.go:313:34: badCall: suspicious Join on 1 argument (gocritic)
assert.NilError(t, os.RemoveAll(filepath.Join(dir.Join("trust"))))
^
cli/config/configfile/file_test.go:185:2: assignOp: replace `c.GetAllCallCount = c.GetAllCallCount + 1` with `c.GetAllCallCount++` (gocritic)
c.GetAllCallCount = c.GetAllCallCount + 1
^
cli/command/context/inspect_test.go:20:58: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(si.MetadataPath, `\`, `\\`, -1)` (gocritic)
expected = strings.Replace(expected, "<METADATA_PATH>", strings.Replace(si.MetadataPath, `\`, `\\`, -1), 1)
^
cli/command/context/inspect_test.go:21:53: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(si.TLSPath, `\`, `\\`, -1)` (gocritic)
expected = strings.Replace(expected, "<TLS_PATH>", strings.Replace(si.TLSPath, `\`, `\\`, -1), 1)
^
cli/command/container/formatter_stats.go:119:46: captLocal: `Stats' should not be capitalized (gocritic)
func statsFormatWrite(ctx formatter.Context, Stats []StatsEntry, osType string, trunc bool) error {
^
cli/command/container/stats_helpers.go:209:4: assignOp: replace `blkRead = blkRead + bioEntry.Value` with `blkRead += bioEntry.Value` (gocritic)
blkRead = blkRead + bioEntry.Value
^
cli/command/container/stats_helpers.go:211:4: assignOp: replace `blkWrite = blkWrite + bioEntry.Value` with `blkWrite += bioEntry.Value` (gocritic)
blkWrite = blkWrite + bioEntry.Value
^
cli/command/registry/formatter_search.go:67:10: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(c.s.Description, "\n", " ", -1)` (gocritic)
desc := strings.Replace(c.s.Description, "\n", " ", -1)
^
cli/command/registry/formatter_search.go:68:9: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(desc, "\r", " ", -1)` (gocritic)
desc = strings.Replace(desc, "\r", " ", -1)
^
cli/command/service/list_test.go:164:5: assignOp: replace `tc.doc = tc.doc + " with quiet"` with `tc.doc += " with quiet"` (gocritic)
tc.doc = tc.doc + " with quiet"
^
cli/command/service/progress/progress.go:274:11: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(errMsg, "\n", " ", -1)` (gocritic)
errMsg = strings.Replace(errMsg, "\n", " ", -1)
^
cli/manifest/store/store.go:153:9: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(fileName, "/", "_", -1)` (gocritic)
return strings.Replace(fileName, "/", "_", -1)
^
cli/manifest/store/store.go:152:14: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(ref, ":", "-", -1)` (gocritic)
fileName := strings.Replace(ref, ":", "-", -1)
^
cli/command/plugin/formatter.go:79:10: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(c.p.Config.Description, "\n", "", -1)` (gocritic)
desc := strings.Replace(c.p.Config.Description, "\n", "", -1)
^
cli/command/plugin/formatter.go:80:9: wrapperFunc: use strings.ReplaceAll method in `strings.Replace(desc, "\r", "", -1)` (gocritic)
desc = strings.Replace(desc, "\r", "", -1)
^
cli/compose/convert/service.go:642:23: captLocal: `DNS' should not be capitalized (gocritic)
func convertDNSConfig(DNS []string, DNSSearch []string) *swarm.DNSConfig {
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-20 16:02:16 +01:00
Sebastiaan van Stijn
d0dee3cebe
linting: Consider pre-allocating sliceVar (prealloc)
...
While updating, also addressed some redundant fmt.Sprintf()
opts/throttledevice.go:86:2: Consider pre-allocating `out` (prealloc)
var out []string
^
opts/ulimit.go:37:2: Consider pre-allocating `out` (prealloc)
var out []string
^
opts/ulimit.go:47:2: Consider pre-allocating `ulimits` (prealloc)
var ulimits []*units.Ulimit
^
opts/weightdevice.go:68:2: Consider pre-allocating `out` (prealloc)
var out []string
^
cli/context/store/metadatastore.go:96:2: Consider pre-allocating `res` (prealloc)
var res []Metadata
^
cli/context/store/store.go:127:2: Consider pre-allocating `names` (prealloc)
var names []string
^
cli/compose/loader/loader.go:223:2: Consider pre-allocating `keys` (prealloc)
var keys []string
^
cli/compose/loader/loader.go:397:2: Consider pre-allocating `services` (prealloc)
var services []types.ServiceConfig
^
cli/command/stack/loader/loader.go:63:2: Consider pre-allocating `msgs` (prealloc)
var msgs []string
^
cli/command/stack/loader/loader.go:118:2: Consider pre-allocating `configFiles` (prealloc)
var configFiles []composetypes.ConfigFile
^
cli/command/formatter/container.go:245:2: Consider pre-allocating `joinLabels` (prealloc)
var joinLabels []string
^
cli/command/formatter/container.go:265:2: Consider pre-allocating `mounts` (prealloc)
var mounts []string
^
cli/command/formatter/container.go:316:2: Consider pre-allocating `result` (prealloc)
var result []string
^
cli/command/formatter/displayutils.go:43:2: Consider pre-allocating `display` (prealloc)
var (
^
cli/command/formatter/volume.go:103:2: Consider pre-allocating `joinLabels` (prealloc)
var joinLabels []string
^
cli-plugins/manager/manager_test.go:49:2: Consider pre-allocating `dirs` (prealloc)
var dirs []string
^
cli/command/swarm/init.go:69:2: Consider pre-allocating `defaultAddrPool` (prealloc)
var defaultAddrPool []string
^
cli/command/manifest/push.go:195:2: Consider pre-allocating `blobReqs` (prealloc)
var blobReqs []manifestBlob
^
cli/command/secret/formatter.go:111:2: Consider pre-allocating `joinLabels` (prealloc)
var joinLabels []string
^
cli/command/network/formatter.go:104:2: Consider pre-allocating `joinLabels` (prealloc)
var joinLabels []string
^
cli/command/context/list.go:52:2: Consider pre-allocating `contexts` (prealloc)
var contexts []*formatter.ClientContext
^
cli/command/config/formatter.go:104:2: Consider pre-allocating `joinLabels` (prealloc)
var joinLabels []string
^
cli/command/trust/common_test.go:23:2: Consider pre-allocating `targetNames` (prealloc)
var targetNames []string
^
cli/command/service/generic_resource_opts.go:55:2: Consider pre-allocating `generic` (prealloc)
var generic []swarm.GenericResource
^
cli/command/service/generic_resource_opts.go:98:2: Consider pre-allocating `l` (prealloc)
var l []swarm.GenericResource
^
cli/command/service/opts.go:378:2: Consider pre-allocating `netAttach` (prealloc)
var netAttach []swarm.NetworkAttachmentConfig
^
cli/command/service/update.go:731:2: Consider pre-allocating `limits` (prealloc)
var limits []*units.Ulimit
^
cli/command/service/update.go:1315:2: Consider pre-allocating `newNetworks` (prealloc)
var newNetworks []swarm.NetworkAttachmentConfig
^
cli/command/service/update.go:1514:2: Consider pre-allocating `out` (prealloc)
var out []string
^
cli/compose/convert/service.go:713:2: Consider pre-allocating `ulimits` (prealloc)
var ulimits []*units.Ulimit
^
cli/compose/convert/volume.go:13:2: Consider pre-allocating `mounts` (prealloc)
var mounts []mount.Mount
^
cli/command/stack/swarm/list.go:39:2: Consider pre-allocating `stacks` (prealloc)
var stacks []*formatter.Stack
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-20 16:02:16 +01:00
Brian Goff
defa52b8c6
stacks: Add support for start interval
...
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-20 18:42:59 +02:00
Sebastiaan van Stijn
d68b361538
cli/compose/convert: convertEnvironment: sort results
...
All users of this function sorted the results afterwards, so let's
do it as part of the function itself.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-12 19:03:59 +02:00
Sebastiaan van Stijn
f4bde68694
replace some basic uses of fmt.Sprintf()
...
Really tiny gains here, and doesn't significantly impact readability:
BenchmarkSprintf
BenchmarkSprintf-10 11528700 91.59 ns/op 32 B/op 1 allocs/op
BenchmarkConcat
BenchmarkConcat-10 100000000 11.76 ns/op 0 B/op 0 allocs/op
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-12 19:03:49 +02:00
Sebastiaan van Stijn
6355bcee66
cli/compose/convert: fakeClient: remove name for unused arg (revive)
...
cli/compose/convert/service_test.go:599:33: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (c *fakeClient) SecretList(ctx context.Context, options types.SecretListOptions) ([]swarm.Secret, error) {
^
cli/compose/convert/service_test.go:606:33: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func (c *fakeClient) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:22:10 +02:00
Sebastiaan van Stijn
3bed830a27
cli/compose: use strings.Cut
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-29 15:19:31 +01:00
Sebastiaan van Stijn
8a19043cc7
Merge pull request #3798 from thaJeztah/gofumpt_linting
...
Use gofumpt if available, and enable gofumpt linter
2022-11-04 19:04:51 +01:00
Drew Erny
02e7826923
Add compose support for cluster volumes
...
Signed-off-by: Drew Erny <derny@mirantis.com>
2022-11-02 11:27:06 -05:00
Sebastiaan van Stijn
616124525e
format go with gofumpt (with -lang=1.19)
...
Looks like the linter uses an explicit -lang, which (for go1.19)
results in some additional formatting for octal values.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-30 19:14:36 +02:00
Sebastiaan van Stijn
1da95ff6aa
format code with gofumpt
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-30 11:59:11 +02:00
ollypom
3997f3431f
Added Swarm Job support to Stack Deploy
...
Added the support for both `global-job` and `replicated-job` to Docker
stack deploy.
Signed-off-by: ollypom <oppomeroy@gmail.com>
2022-05-17 22:30:22 +02:00
Sebastiaan van Stijn
b9f0340b68
cli/compose: remove deprecated io/ioutil
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-25 15:42:15 +01:00
Albin Kerouanton
940907951b
Support ulimits in docker stack deploy
...
This is related to moby/moby 40639.
Signed-off-by: Albin Kerouanton <albin@akerouanton.name>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-10 14:59:02 +02:00
Sebastiaan van Stijn
190c64b415
Service cap-add/cap-drop: improve handling of combinations and special "ALL" value
...
When creating and updating services, we need to avoid unneeded service churn.
The interaction of separate lists to "add" and "drop" capabilities, a special
("ALL") capability, as well as a "relaxed" format for accepted capabilities
(case-insensitive, `CAP_` prefix optional) make this rather involved.
This patch updates how we handle `--cap-add` / `--cap-drop` when _creating_ as
well as _updating_, with the following rules/assumptions applied:
- both existing (service spec) and new (values passed through flags or in
the compose-file) are normalized and de-duplicated before use.
- the special "ALL" capability is equivalent to "all capabilities" and taken
into account when normalizing capabilities. Combining "ALL" capabilities
and other capabilities is therefore equivalent to just specifying "ALL".
- adding capabilities takes precedence over dropping, which means that if
a capability is both set to be "dropped" and to be "added", it is removed
from the list to "drop".
- the final lists should be sorted and normalized to reduce service churn
- no validation of capabilities is handled by the client. Validation is
delegated to the daemon/server.
When deploying a service using a docker-compose file, the docker-compose file
is *mostly* handled as being "declarative". However, many of the issues outlined
above also apply to compose-files, so similar handling is applied to compose
files as well to prevent service churn.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-08 14:38:35 +02:00
Olli Janatuinen
0db61ff6da
stack: Support cap_add and cap_drop on services
...
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
Signed-off-by: Albin Kerouanton <albin@akerouanton.name>
2020-09-08 14:24:52 +02:00
Sebastiaan van Stijn
851eeb9639
Add support for pids limit in stacks (swarm)
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-18 21:25:08 +02:00
Sebastiaan van Stijn
0d57a400b3
vendor: docker/docker aaf470eca7b588aa19e6681bff8bf08d17be1bf2
...
full diff: 41ac6bef8d...aaf470eca7
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-15 13:32:53 +02:00
Sebastiaan van Stijn
2c0e93063b
bump gotest.tools v3.0.1 for compatibility with Go 1.14
...
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-23 00:28:55 +01:00
Sebastiaan van Stijn
34f595975d
cli/compose/convert: driverObjectConfig - result 1 (error) is always nil (unparam)
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-31 19:22:26 +01:00
Silvin Lubecki
c237379167
cli/compose/convert/service_test.go:274:72: unnecessary conversion (unconvert)
...
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-10-31 19:22:24 +01:00
Silvin Lubecki
d640f44df3
cli/compose/convert: result 1 (error) is always nil (unparam)
...
cli/compose/convert/service.go:592:76: convertDNSConfig - result 1 (error) is always nil (unparam)
cli/compose/convert/service.go:538:110: convertEndpointSpec - result 1 (error) is always nil (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-31 19:22:20 +01:00
Drew Erny
42ec51e1ae
add support for config credentialspecs to compose
...
Signed-off-by: Drew Erny <drew.erny@docker.com>
2019-04-12 11:17:34 -05:00
Sebastiaan van Stijn
6511da877f
Add support for using Configs as CredentialSpecs in services
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-12 11:17:29 -05:00
Sune Keller
c662ba03de
Make use of driver and driver_opts fields in secrets
...
Signed-off-by: Sune Keller <absukl@almbrand.dk>
2019-04-05 12:01:21 +02:00
Sebastiaan van Stijn
f620349837
Add systctl support for services
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-19 13:33:32 +01:00
Vincent Demeester
7764101a54
Add support for `template_driver` in composefiles
...
This maps the `--template-driver` flag on secret and config creation.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-03-18 23:49:30 +01:00
Olli Janatuinen
6347ab315b
Add maximum replicas per node support to stack version 3.8
...
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2019-02-19 11:25:12 +02:00
Sebastiaan van Stijn
3e4e232e0d
Merge pull request #1195 from olljanat/34795-npipe-mount-type
...
Allow npipe volume type on stack file
2018-09-28 10:57:09 +02:00
Olli Janatuinen
0704d9a031
Allow npipe volume type on stack file
...
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2018-09-27 18:47:20 +03:00
Joffrey F
e7788d6f9a
Allow marshalling of Compose config to JSON
...
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-09-10 11:16:05 -07:00
Arash Deshmeh
71d650ee17
refactored cli/compose and cli/command/trust to use sort.Slice and removed custom types used for sorting
...
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2018-07-08 15:08:17 -04:00
Vincent Demeester
cc26da94ed
Add `init` support in 3.7 schema
...
> Run an init inside the container that forwards signals and reaps
processes
This is supported on `run` and now on Swarm services too, so it's also
possible to have in on a composefile :).
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-25 11:13:32 +02:00
Vincent Demeester
2c4de4fb5e
Update tests to use gotest.tools 👼
...
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 18:24:26 +02:00
Vincent Demeester
4e6e5d583c
Support for rollback config in compose 3.7
...
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-05-29 11:37:51 +02:00
Kir Kolyshkin
6f8070deb2
Switch from x/net/context to context
...
Since go 1.7, "context" is a standard package. Since go 1.9,
x/net/context merely provides some types aliased to those in
the standard context package.
The changes were performed by the following script:
for f in $(git ls-files \*.go | grep -v ^vendor/); do
sed -i 's|golang.org/x/net/context|context|' $f
goimports -w $f
for i in 1 2; do
awk '/^$/ {e=1; next;}
/\t"context"$/ {e=0;}
{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
mv $f.new $f
goimports -w $f
done
done
[v2: do awk/goimports fixup twice]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-11 16:49:43 -07:00
Daniel Nephin
b4c108a385
Fix named network in compose file
...
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-12 15:15:27 -04:00
Daniel Nephin
e15b208e96
Convert assert.Check(t, is.Error()) to assert.Error
...
git grep -l -P '^\s+assert\.Check\(t, is\.Error\(' | \
xargs perl -pi -e 's/^(\s+assert\.)Check\(t, is\.Error\((.*)\)$/\1Error(t, \2/'
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 16:00:28 -05:00
Daniel Nephin
baf65a5502
Convert to assert.NilError
...
Using:
git grep -l '^\s\+assert\.Check(t, err)$' | \
xargs sed -i -e 's/^\(\s\+assert\)\.Check(t, err)$/\1.NilError(t, err)/'
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 15:27:34 -05:00
Daniel Nephin
39c2ca57c1
Automated migration
...
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00