14209 Commits

Author SHA1 Message Date
e4e21522d1 Merge pull request #12091 from ananthb/docker-api-compat
Fixes #12063 Add docker compatible output after image build.
2021-12-14 18:32:57 +01:00
c134698fa1 Merge pull request #12593 from vrothberg/fix-11682
pause scope: don't use the global math/rand RNG
2021-12-14 17:52:57 +01:00
afdb4dc22f Update Windows Install Doc
Updates the Windows install doc to make it more clear.

Fixes: #11382

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2021-12-14 11:23:32 -05:00
3b9af150ab Merge pull request #12589 from containers/dependabot/go_modules/github.com/docker/docker-20.10.12incompatible
Bump github.com/docker/docker from 20.10.11+incompatible to 20.10.12+incompatible
2021-12-14 16:52:57 +01:00
52b12fe985 Fixes #12063 Add docker compatible output after image build.
Signed-off-by: Ananth Bhaskararaman <antsub@gmail.com>
2021-12-14 21:08:31 +05:30
65d5a2b68b pause scope: don't use the global math/rand RNG
Otherwise, we'll always get the same sequence of random numbers which
may lead to conflicts.  Also bump the number of maximum attempts to 10
instead of 3.

[NO NEW TESTS NEEDED] as I cannot enforce random number collisions.
Existing tests should continue be green and flake slightly less.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-14 16:34:54 +01:00
c501c1d642 Merge pull request #12585 from Luap99/network-ls-sort
network ls: show networks in deterministic order
2021-12-14 16:05:42 +01:00
ef325bc8c4 specgen: check that networks are only set with bridge
Because we cannot reqad the networking mode in the frontent because we
should always use the server default we have to parse the mac and ip
address to the server via a default network. Now when the server reads
the default nsmode it has to reject the provided networks when the mode
is not set to bridge.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:40 +01:00
094e1d70de container restore/import: store networks from db
It is important that we store the current networks from the db in the
config. Also make sure to properly handle aliases and ignore static ip/mac
addresses.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:40 +01:00
3e9af2029f play kube add support for multiple networks
Allow the same --network options for play kube as for podman run/create.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:40 +01:00
535818414c support advanced network configuration via cli
Rework the --network parse logic to support multiple networks with
specific network configuration settings.
--network can now be set multiple times. For bridge network mode the
following options have been added:
  - **alias=name**: Add network-scoped alias for the container.
  - **ip=IPv4**: Specify a static ipv4 address for this container.
  - **ip=IPv6**: Specify a static ipv6 address for this container.
  - **mac=MAC**: Specify a static mac address address for this container.
  - **interface_name**: Specify a name for the created network interface inside the container.

So now you can set --network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99
for the default bridge network as well as for network names.
This is better than using --ip because we can set the ip per network
without any confusion which network the ip address should be assigned
to.
The --ip, --mac-address and --network-alias options are still supported
but --ip or --mac-address can only be set when only one network is set.
This limitation already existed previously.

The ability to specify a custom network interface name is new
Fixes #11534

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
d072167fe2 Add new networks format to spegecen
Add the new networks format to specgen. For api users cni_networks is
still supported to make migration easier however the static ip and mac
fields are removed.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
46938bbf88 fix incorrect swagger doc for network dis/connect
The swagger api docs used the extra Body struct as part of the request
which is wrong. We just want the plain type.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
4791595b5c network connect allow ip, ipv6 and mac address
Network connect now supports setting a static ipv4, ipv6 and mac address
for the container network. The options are added to the cli and api.

Fixes #9883

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
9ce6b64133 network db: add new strucutre to container create
Make sure we create new containers in the db with the correct structure.
Also remove some unneeded code for alias handling. We no longer need this
functions.

The specgen format has not been changed for now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
4e8ad039ce remove unneeded return value from c.Networks()
We do not need to return a extra bool.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:38 +01:00
5490be67b3 network db rewrite: migrate existing settings
The new network db structure stores everything in the networks bucket.
Previously some network settings were not written the the network bucket
and only stored in the container config.
Instead of the old format which used the container ID as value in the
networks buckets we now use the PerNetworkoptions struct there.

To migrate existing users we use the state.GetNetworks() function. If it
fails to read the new format it will automatically migrate the old
config format to the new one. This is allows a flawless migration path.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:20 +01:00
5f1f62f0bb network ls: show networks in deterministic order
The new network backend stores the networks in a map so the returned
order is not deterministic. Lets sort the network names alphabetically
to ensure a deterministic order.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 13:52:38 +01:00
5a071d9f50 Bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.11+incompatible to 20.10.12+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Changelog](https://github.com/moby/moby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/docker/docker/compare/v20.10.11...v20.10.12)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-14 12:28:51 +00:00
4a060caeab Merge pull request #12588 from vrothberg/fix-12167
pprof flakes: bump timeout to 20 seconds
2021-12-14 13:25:39 +01:00
1fff76c3c3 pprof flakes: bump timeout to 20 seconds
This is the third and hopefully the last attempt to address the flakes
in the pprof tests.  We first bumped the timeouts to 2 seconds, then to
5, and since I am running out of ideas let's bump it now to 20 seconds.

Since the timeouts poll, the tests will terminate much earlier but 20
seconds should now really be enough even under highly loaded CI VMs.

Fixes: #12167
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-14 10:59:56 +01:00
50501f49a3 Add secret list --filter to cli
This PR is a follow-up of #11431. It adds possibility of filtering
secret list based on id and name.

Signed-off-by: Jakub Guzik <jguzik@redhat.com>
2021-12-14 10:41:03 +01:00
4543fd463e Merge pull request #12571 from vrothberg/fix-12566
compat build: adhere to q/quiet
2021-12-13 14:54:03 -05:00
b6ce7e19ec Merge pull request #12581 from cevich/disable_gitlab
[CI:DOCS] Cirrus: Temp. ignore gitlab task failures
2021-12-13 16:57:25 +01:00
8cb93ac103 Cirrus: Temp. ignore gitlab task failures
Appears related to https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28732
Log: https://cirrus-ci.com/task/5708221852680192?logs=setup#L433

Marking test to be ignored until I can figure out where/how to fix it.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-12-13 10:31:01 -05:00
81a0a79844 compat build: adhere to q/quiet
Fixes: #12566
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-13 09:52:24 +01:00
e993b88c03 Merge pull request #12573 from Luap99/fix-test
fix e2e test missing network cleanup
2021-12-10 17:56:28 +00:00
5bbcfaf4aa Make XRegistryAuthHeader and XRegistryConfigHeader private
... now that they have no public users.

Also remove the HeaderAuthName type, we don't need the type-safety
so much for private constants, and using plain strings results in
less visual noise.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:27 +01:00
3cfefa1248 Remove the authfile parameter of MakeXRegistryAuthHeader
Having a parameter that modifies the provides types.SystemContext
seems rather unexpected and risky to have around - and the only
user of that is actually a no-op, others only provide a nil
SystemContext; so, remove that option and simplify (well, somewhat;
many callers now have extra &types.SystemContext{AuthFilePath}
boilerplate; at least that's consistent with that code carrying
a TODO to create a larger-scope SystemContext).

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:27 +01:00
d79414c54f Simplify the header decision in pkg/bindings/images.Build a bit
... now that two of the three cases are the same.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:26 +01:00
f9be326274 Remove the authfile parameter of MakeXRegistryConfigHeader
Having a parameter that modifies the provides types.SystemContext
seems rather unexpected and risky to have around - and the only
user of that is actually a no-op; so, remove that option and simplify.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:26 +01:00
935dcbb008 Remove no-longer-useful name variables
which used to contain more context, but now are just
a pointless copy.

Should not change (test) behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:25 +01:00
0e29b89753 Consolidate creation of SystemContext with auth.json into a helper
Should not change (test) behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:25 +01:00
fe1230ef70 Remove pkg/auth.Header
It is no longer used.

Split the existing tests into MakeXRegistryConfigHeader
and MakeXRegistryAuthHeader variants. For now we don't modify
the implementations at all, to make review simpler; cleanups
will follow.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:24 +01:00
3725a34cbf Call MakeXRegistryAuthHeader instead of Header(..., XRegistryAuthHeader)
All callers hard-code a header value, so this is actually shorter.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:24 +01:00
78dd797520 Turn headerAuth into MakeXRegistryAuthHeader
... which can be called independently.

For now, there are no new callers, to test that the behavior
has not changed.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:23 +01:00
d073b1275d Call MakeXRegistryConfigHeader instead of Header(..., XRegistryConfigHeader)
All callers hard-code a header value, so this is actually shorter.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:23 +01:00
8155fb5658 Turn headerConfig into MakeXRegistryConfigHeader
... which can be called independently.

For now, there are no new callers, to test that the behavior
has not changed.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:22 +01:00
29f4088713 Move the auth file creation to GetCredentials
This shares the code, and makes getConfigCredentials
and getAuthCredentials side-effect free and possibly easier to test.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:22 +01:00
9d56ebb611 Consolidate the error handling path in GetCredentials
We'll share even more code here in the future.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:21 +01:00
da86a23285 Only look up HTTP header values once in GetCredentials
... and have GetCredentials pass the values down to
getConfigCredentials and getAuthCredentials.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:21 +01:00
1589d70bcb Use Header.Values in GetCredentials.has
It's possibly a bit more expensive, but semantically safer
because it does header normalization.

And we'll regain the cost by not looking up the value repeatedly.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:20 +01:00
2946e83493 Beautify GetCredentials.has a bit
Use separate lines, and use the provided .String() API.

Should not change behaivor.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:20 +01:00
1ecc6ba728 Pass a header value directly to parseSingleAuthHeader and parseMultiAuthHeader
Both have a single caller, so there's no point in looking up
the header value twice.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:19 +01:00
6f1a26b04f Simplify parseSingleAuthHeader
In the "no input" case, return a constant instead of
continuing with the decode/convert path, converting empty data.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:19 +01:00
7674f2f76b Simplify the interface of parseSingleAuthHeader
Don't create a single-element map only for the only caller
to laboriously extract an element of that map; just return
a single entry.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:18 +01:00
2aeb690d37 Don't return a header name from auth.GetCredentials
Almost every caller is using it only to wrap an error
in exactly the same way, so move that error context into GetCredentials
and simplify the users.

(The one other caller, build, was even wrapping the error incorrectly
talking about query parameters; so let it use the same text as the others.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:18 +01:00
491951d66e Fix normalizeAuthFileKey to use the correct semantics
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:17 +01:00
1b6bf97130 Rename normalize and a few variables
... to refer to auth file keys instead of servers and the like.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:17 +01:00
d29a4a6d17 Add TestHeaderGetCredentialsRoundtrip
... as an end-to-end unit test of the header creation/parsing
code.

Leave the docker.io and docker.io/vendor test cases commented out,
because they are currently failing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:15 +01:00