Commit graph

46580 commits

Author SHA1 Message Date
Sebastiaan van Stijn
11c6ec6eb2
Merge pull request #45891 from corhere/fix-daemon-restart-iptables-collision
integration: disable iptables in parallel tests
2023-07-05 21:48:20 +02:00
Cory Snider
cdcb7c28c5 integration: disable iptables in parallel tests
Multiple daemons starting/running concurrently can collide with each
other when editing iptables rules. Most integration tests which opt into
parallelism and start daemons work around this problem by starting the
daemon with the --iptables=false option. However, some of the tests
neglect to pass the option when starting or restarting the daemon,
resulting in those tests being flaky.

Audit the integration tests which call t.Parallel() and (*Daemon).Stop()
and add --iptables=false arguments where needed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-07-05 13:49:53 -04:00
Sebastiaan van Stijn
ce00af8590
Merge pull request #45889 from corhere/fix-flaky-plugins-client-test
pkg/plugins: make unit test less time sensitive
2023-07-05 19:17:10 +02:00
Cory Snider
9cee34bc94 pkg/plugins: make unit test less time sensitive
TestClientWithRequestTimeout has been observed to flake in CI. The
timing in the test is quite tight, only giving the client a 10ms window
to time out, which could potentially be missed if the host is under
load and the goroutine scheduling is unlucky. Give the client a full
five seconds of grace to time out before failing the test.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-07-05 12:09:37 -04:00
Bjorn Neergaard
ba02bbb3b4
Merge pull request #45886 from thaJeztah/more_grepable
use string-literals for easier grep'ing
2023-07-05 07:02:14 -06:00
Bjorn Neergaard
569e1a4b77
Merge pull request #45870 from thaJeztah/libnetwork_cleanup_kvstore
libnetwork: remove dead / unused code from datastore and kvstore
2023-07-05 07:00:55 -06:00
Sebastiaan van Stijn
6944d2dddb
libnetwork: TestBoltdbBackend(): use t.TempDir()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:21 +02:00
Sebastiaan van Stijn
2fd88c7ca4
libnetwork: inline store config options
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:21 +02:00
Sebastiaan van Stijn
cda187222e
libnetwork/config: remove options that were only used in tests
The OptionLocalKVProvider, OptionLocalKVProviderURL, and OptionLocalKVProviderConfig
options were only used in tests, so un-export them, and move them to the
test-files.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:21 +02:00
Sebastiaan van Stijn
bc80c5d067
libnetwork: rename vars that shadowed with pkg vars and imports
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:21 +02:00
Sebastiaan van Stijn
332ffe8d74
libnetwork/networkdb: NetworkDB.Watch(): remove unused "key" argument
This function was implemented in dd4950f36d
which added a "key" field, but that field was never used anywhere, and
still appears unused.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:20 +02:00
Sebastiaan van Stijn
4c4149a09c
libnetwork/internal/kvstore: remove unused Delete()
All code is using the atomic alternatives (AtomicDelete)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:20 +02:00
Sebastiaan van Stijn
4d09e60f5b
libnetwork/internal/kvstore: remove unused Watch() method
The BoltDB store is not Watchable, and the Watch function was never used,
so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:20 +02:00
Sebastiaan van Stijn
c14a9f5b3d
libnetwork/datastore: un-export Mutex
Keep the mutex internal to the DataStore.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:20 +02:00
Sebastiaan van Stijn
e21e802fc6
libnetwork/datastore: remove unused DeleteTree() method
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:20 +02:00
Sebastiaan van Stijn
58d2f21dae
libnetwork/datastore: remove unused PutObject(), DeleteObject()
all code is using the atomic alternatives for these (PutObjectAtomic,
DeleteObjectAtomic)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:20 +02:00
Sebastiaan van Stijn
a3b0181503
libnetwork/datastore: remove Watch(), Watchable(), RestartWatch()
The `store.Watch()` was only used in `Controller.processEndpointCreate()`,
and skipped if the store was not "watchable" (`store.Watchable()`).

Whether a store is watchable depends on the store's datastore.scope;
local stores are not watchable;

    func (ds *datastore) Watchable() bool {
        return ds.scope != LocalScope
    }

datastore is only initialized in two locations, and both locations set the
scope field to LocalScope:

datastore.newClient() (also called by datastore.NewDataStore()):
3e4c9d90cf/libnetwork/datastore/datastore.go (L213)

datastore.NewTestDataStore() (used in tests);
3e4c9d90cf/libnetwork/datastore/datastore_test.go (L14-L17)

Furthermore, the backing BoltDB kvstore does not implement the Watch()
method;

3e4c9d90cf/libnetwork/internal/kvstore/boltdb/boltdb.go (L464-L467)

Based on the above;

- our datastore is never Watchable()
- so datastore.Watch() is never used

This patch removes the Watchable(), Watch(), and RestartWatch() functions,
as well as the code handling watching.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:19 +02:00
Sebastiaan van Stijn
2409a36e29
libnetwork/datastore: cache.get(): remove unused "key" argument
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:19 +02:00
Sebastiaan van Stijn
824abbf8d9
libnetwork/datastore: remove redundant datastore.sequential
The sequential field determined whether a lock was needed when storing
and retrieving data. This field was always set to true, with the exception
of NewTestDataStore() in the tests.

This field was added in a18e2f9965
to make locking optional for non-local scoped stores. Such stores are no
longer used, so we can remove this field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:19 +02:00
Sebastiaan van Stijn
e9b6965079
libnetwork/datastore: remove unused datastore.Active()
The value was set, and updated, but never used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:19 +02:00
Sebastiaan van Stijn
b32e41f016
libnetwork/internal/kvstore/boltdb: un-export Mutex
Keep the mutex internal to BoltDB.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:19 +02:00
Sebastiaan van Stijn
7e7c7bbc17
libnetwork/internal/kvstore/boltdb: BoltDB.List(): minor cleanup
cleanup the code to be slightly more idiomatic

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:19 +02:00
Sebastiaan van Stijn
95b96eebdd
libnetwork/internal/kvstore/boltdb: BoltDB.Get(): don't shadow error
Don't shadow the original error if we got one.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:19 +02:00
Sebastiaan van Stijn
fb61b07bcf
libnetwork/internal/kvstore/boltdb: BoltDB.Exists(): fix error handling
This function could potentially return "true" even if an error was returned.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:18 +02:00
Sebastiaan van Stijn
c94ccd4207
libnetwork/internal/kvstore/boltdb: minor cleanup/refactor
Make the code slightly more idiomatic; remove some "var" declarations,
remove some intermediate variables and redundant error-checks, and remove
the filePerm const.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:18 +02:00
Sebastiaan van Stijn
acfd3934a7
libnetwork/internal/kvstore: AtomicDelete(): remove unused "deleted" return
This boolean was not used anywhere, so we can remove it. Also cleaning up
the implementation a bit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:18 +02:00
Sebastiaan van Stijn
b576682bdc
libnetwork/internal/kvstore: AtomicPut(): remove unused "created" return
This boolean was not used anywhere, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:18 +02:00
Sebastiaan van Stijn
c37b58bbc3
libnetwork/internal/kvstore: remove unused WriteOptions
The WriteOptions struct was only used to set the "IsDir" option. This option
was added in d635a8e32b
and was only supported by the etcd libkv store.

The BoltDB store does not support this option, making the WriteOptions
struct fully redundant.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:18 +02:00
Sebastiaan van Stijn
e515bef423
libnetwork/internal/kvstore: remove unused WatchTree and NewLock methods
These were not used, and not implemented by the BoltDB store.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:18 +02:00
Sebastiaan van Stijn
a373983a86
libnetwork/internal/kvstore: fix some linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:17 +02:00
Sebastiaan van Stijn
05988f88b7
libnetwork/internal/kvstore: remove unused Config options
The only remaining kvstore is BoltDB, which doesn't use TLS connections
or authentication, so we can remove these options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:30:17 +02:00
Sebastiaan van Stijn
ec11aea880
pkg/jsonmessage: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:02 +02:00
Sebastiaan van Stijn
fded42c3bd
pkg/ioutils: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:02 +02:00
Sebastiaan van Stijn
1da079f211
pkg/idtools: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:01 +02:00
Sebastiaan van Stijn
84000190d3
opts: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:01 +02:00
Sebastiaan van Stijn
ddec605aef
integration: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:01 +02:00
Sebastiaan van Stijn
96a1c444cc
libnetwork: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:01 +02:00
Sebastiaan van Stijn
0db4a32b9c
daemon/cluster: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:01 +02:00
Sebastiaan van Stijn
4e69e16fde
client: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:01 +02:00
Sebastiaan van Stijn
c3d533f37f
cli/debug: use string-literals for easier grep'ing
Also removed some newlines from t.Fatal() as they shouldn't be needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:00 +02:00
Sebastiaan van Stijn
02815416bb
daemon: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:00 +02:00
Sebastiaan van Stijn
6331a3a346
integration-cli: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:27:00 +02:00
Sebastiaan van Stijn
2f61620339
builder/builder-next: use string-literals for easier grep'ing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:26:51 +02:00
Sebastiaan van Stijn
202907b14c
builder/dockerfile: use string-literals for easier grep'ing
Use string-literal for reduce escaped quotes, which makes for easier grepping.
While at it, also changed http -> https to keep some linters at bay.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-05 12:25:59 +02:00
Sebastiaan van Stijn
4ee0cf6878
Merge pull request #45847 from thaJeztah/sysinfo_singleflight
api: use singleflight for /info endpoint
2023-07-04 13:45:49 +02:00
Sebastiaan van Stijn
a1c9a686b0
api: use singleflight for /info endpoint
Prevent potential suggestion when many concurrent requests happen on
the /info endpoint. It's worth noting that with this change,
requests to the endpoint while another request is still in flight
will share the results, hence might be slightly incorrect (for example,
the output includes SystemTime, which may now be incorrect).

Assuming that under normal circumstances, requests will still
happen fast enough to not be shared, this may not be a problem,
but we could decide to update specific fields to not be shared.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-04 12:22:32 +02:00
Sebastiaan van Stijn
20364bd658
Merge pull request #45873 from thaJeztah/systeminfo_no_ad_hoc_type
api: info: don't use ad-hoc type for compatibility with old api versions
2023-07-04 12:21:51 +02:00
Sebastiaan van Stijn
99a8e53573
Merge pull request #45875 from thaJeztah/pkg_system_no_windows
pkg/system: remove windows stubs for MkDev/MkNod
2023-07-03 23:56:22 +02:00
Sebastiaan van Stijn
6dff1b8c82
Merge pull request #45874 from thaJeztah/integration_no_sys
integration: don't use pkg/system MkNod/mkDev
2023-07-03 23:53:21 +02:00
Sebastiaan van Stijn
cffe563d4d
pkg/system: remove windows stubs for MkDev/MkNod
They're not used anywhere, so let's remove them; better to have
a compile error than a panic at runtime.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-03 18:50:30 +02:00