14995 Commits

Author SHA1 Message Date
da2dcad57d Merge pull request #14071 from containers/dependabot/go_modules/github.com/rootless-containers/rootlesskit-1.0.1
Bump github.com/rootless-containers/rootlesskit from 1.0.0 to 1.0.1
2022-05-03 10:04:17 -04:00
e5871bc675 Merge pull request #14084 from rhatdan/VENDOR
Vendor in containers/(common, storage, image)
2022-05-03 10:03:53 -04:00
e247f02a4f Vendor in containers/(common, storage, image)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-02 17:16:10 -04:00
3ac5cec086 Merge pull request #14081 from edsantiago/treadmill_revamp
Treadmill script: revamp
2022-05-02 16:48:56 -04:00
e74717f348 Treadmill script: revamp
Major revamp: instead of stacking a vendor commit on top of
the treadmill changes, do it the other way around: vendor,
then apply treadmill diffs.

Reason: the build-all-new-commits test. Sigh. It fails in the
common case where our treadmill changes include a new struct
element in cmd/podman/images/build.go

Why this is good: well, superficially, it's more intuitive.

Why this is horrible: omg the rebasing games are a nightmare.
When the vendor commit is on top (HEAD), it's ultra-trivial
to drop it, rebase the treadmill changes on main, then add
a new vendor-buildah commit on top. As you can see from the
diffs in this PR, treadmill-as-HEAD introduces all sorts
of complex dance steps in which things can go catastrophically
wrong and you can lose all your treadmill patches. I try very
hard to prevent this, and to offer hints if there's a problem,
and heck in the worst case it's still git so it's still possible
to find lost commits... but it's still much riskier than the
old way.

Alternative I considered: using sed magic to disable the
build-all-new-commits test. So tempting... but that would
also disable the bloat check.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-05-02 13:06:13 -06:00
698cb730a1 Merge pull request #14078 from Luap99/CI
CI: emergency fix for broken go get
2022-05-02 13:56:30 -04:00
e17b56e0cf CI: emergency fix for broken go get
go get is deprecated, we should use go install instead.

Also for some reason go get -u golang.org/x/tools/cmd/goimports is
broken at the moment, thus failing CI jobs where we have to install
this. Switching to go install seems to fix it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-02 18:03:59 +02:00
c3d871a3f6 Merge pull request #13859 from vrothberg/fix-13464
pod: add exit policies
2022-05-02 11:53:30 -04:00
adf6ee671f Merge pull request #14063 from Luap99/libpod-networks
libpod: unset networks before storing container conf
2022-05-02 11:15:30 -04:00
4b2dc2d8df Merge pull request #14069 from n1hility/wsl-inspect
Implement machine inspect for WSL
2022-05-02 10:13:40 -04:00
4e44e5b5de Bump github.com/rootless-containers/rootlesskit from 1.0.0 to 1.0.1
Bumps [github.com/rootless-containers/rootlesskit](https://github.com/rootless-containers/rootlesskit) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/rootless-containers/rootlesskit/releases)
- [Commits](https://github.com/rootless-containers/rootlesskit/compare/v1.0.0...v1.0.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 12:12:08 +00:00
4eff0c8cf2 pod: add exit policies
Add the notion of an "exit policy" to a pod.  This policy controls the
behaviour when the last container of pod exits.  Initially, there are
two policies:

 - "continue" : the pod continues running. This is the default policy
                when creating a pod.

 - "stop" : stop the pod when the last container exits. This is the
            default behaviour for `play kube`.

In order to implement the deferred stop of a pod, add a worker queue to
the libpod runtime.  The queue will pick up work items and in this case
helps resolve dead locks that would otherwise occur if we attempted to
stop a pod during container cleanup.

Note that the default restart policy of `play kube` is "Always".  Hence,
in order to really solve #13464, the YAML files must set a custom
restart policy; the tests use "OnFailure".

Fixes: #13464
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-02 13:29:59 +02:00
cfca853565 libpod: unset networks before storing container conf
Since networks must always be read from the db bucket directly we should
unset them in config to avoid caller from accidentally using them.

I already tried this but it didn't work because the networks were unset
after the config was marshalled.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-02 13:23:16 +02:00
77d872ea38 vendor c/common@main
Required for using the newly added pod exit policies.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-02 11:16:14 +02:00
5b78f9576c Implement machine inspect for WSL
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-05-01 16:39:54 -05:00
80315b9c86 Merge pull request #14026 from n1hility/simulate-dualstack
Use simulated dual-stack binds when using WSL
2022-04-30 06:38:19 -04:00
772ead2531 Use simulated dual-stack binds when using WSL
Resolves a WSL problem where traffic from only one stack is relayed

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-04-29 17:03:45 -05:00
d6f6d6129c Merge pull request #14032 from edsantiago/treadmill_script_more_checks
[CI:DOCS] buildah-vendor-treadmill script: yet more checks
2022-04-29 17:54:27 -04:00
23de3801d6 buildah-vendor-treadmill script: yet more checks
More safety checks for the treadmill script:

 * for --sync:
   - issue warning if HEAD is not a vendor commit
   - if run-buildah-bud-tests fails, leave the working dir
     for user to investigate. And offer a long helpful warning.
   - tweak .cirrus.yml so buildah-bud tests run early, so
     we can fail early. (Remember, the top commit will never
     ever ever ever be merged)

 * for --pick:
   - check branch merge-base (of your vendor-update branch),
     compare against that of the treadmill PR. If treadmill
     is newer, bail, and suggest rebasing. This would've
     saved us some time in #14005.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-29 15:15:28 -06:00
2e75cb72ca Merge pull request #14062 from Luap99/resolv.conf
libpod: host netns keep same /etc/resolv.conf
2022-04-29 13:45:59 -04:00
95ff349de2 Merge pull request #14031 from Luap99/errcheck
enable errcheck linter
2022-04-29 11:31:39 -04:00
01acc2565a libpod: host netns keep same /etc/resolv.conf
When a container is run in the host network namespace we have to keep
the same resolv.conf content and not use the systemd-resolve detection
logic.

But also make sure we still allow --dns options.

Fixes #14055

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 15:37:14 +02:00
5198209269 fix incorrect permissions for /etc/resolv.conf in userns
The files /etc/hosts, /etc/hostname and /etc/resolv.conf should always
be owned by the root user in the container. This worked correct for
/etc/hostname and /etc/hosts but not for /etc/resolv.conf.

A container run with --userns keep-id would have the reolv.conf file
owned by the current container user which is wrong.

Consolidate some common code in a new helper function to make the code more
cleaner.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 15:30:55 +02:00
73836e0c6a Merge pull request #14036 from edsantiago/release_note_template
[CI:DOCS] Github PR template: add release-note block
2022-04-29 08:51:37 -04:00
59f154a095 Merge pull request #14061 from giuseppe/unlock-before-pod-cgroup-cleanup
libpod: unlock containers when removing pod
2022-04-29 08:49:33 -04:00
e6557bf0a2 pkg/api: do not register decoder in endpoint handler
Since the decoder is shared registering the decoder inside a single
endpoint will also register it for all others. Also the problem with
that is the it will register it everytime this endpoint is called which
is wrong.

Instead we should register it once like the other custom decoder
functions.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 14:06:54 +02:00
a48c37df37 fix broken hooks-dir test
The test has been broken since it was added 4 years ago. Instead of
using hardcoded paths we should use tmp files.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 14:06:54 +02:00
69c479b16e enable errcheck linter
The errcheck linter makes sure that errors are always check and not
ignored by accident. It spotted a lot of unchecked errors, mostly in the
tests but also some real problem in the code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 14:06:38 +02:00
384c2359b7 libpod: unlock containers when removing pod
It solves a race where a container cleanup process launched because of
the container process exiting normally would hang.

It also solves a problem when running as rootless on cgroup v1 since
it is not possible to force pids.max = 1 on conmon to limit spawning
the cleanup process.

Partially copied from https://github.com/containers/podman/pull/13403

Related to: https://github.com/containers/podman/issues/14057

[NO NEW TESTS NEEDED] it doesn't add any new functionality

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-04-29 12:58:11 +02:00
ab3e072a0c Merge pull request #14045 from cdoern/cgroupPath
remove unused codepath for creating/running ctr in a pod
2022-04-28 18:26:14 -04:00
765c8818e4 Merge pull request #14033 from baude/inspectredo
Refactor machine inspect
2022-04-28 16:21:33 -04:00
2902d32c49 Refactor machine inspect
I was asked to refactor machine inspect output to represent more common
and basic information.  machine inspect now has information that would
be appropriate for different machines.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-04-28 13:32:21 -05:00
2e9f792e37 Merge pull request #14053 from Luap99/shell-format
shell completion --format: work with nil structs
2022-04-28 14:25:43 -04:00
b2725024f8 Merge pull request #14024 from cdoern/machine
podman machine starting test
2022-04-28 13:59:23 -04:00
8c2d6b8664 Merge pull request #14039 from rhatdan/hosts
Report properly whether pod shares host network
2022-04-28 13:53:22 -04:00
64a368ba24 remove unused codepath for creating/running ctr in a pod
`pod.CgroupPath()` currently includes a codepath that is never accessed,
which is supposed to start the infra ctr and obtain the cgroup path from there
that is never necessary/safe because p.state.CgroupPath is never empty

[NO NEW TESTS NEEDED]

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2022-04-28 12:42:23 -04:00
6b7fd318bd image search --format: add completion for go template
podman image search accepts a go template, we can use the same shell
completion logic which is used everywhere else in the code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-28 18:33:23 +02:00
0d9f190280 shell completion --format: use structs by reference
For the AutocompleteFormat function we expect the correct template
struct which is used in the golang template. The function can handle
both struct and pointer to a struct. Using the reference is more
efficient since it doe snot have to copy the whole struct.

Also change some structs to use he actual type from the template instead
of some nested one to make sure it has to correct fields.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-28 18:12:17 +02:00
f722879d3b Merge pull request #14052 from containers/dependabot/go_modules/github.com/containernetworking/cni-1.1.0
Bump github.com/containernetworking/cni from 1.0.1 to 1.1.0
2022-04-28 11:57:45 -04:00
cac2b7800b image --format: fix add completion for go template
It used the wrong struct so not all fields were listed in the
completion.
Fixes podman images --format and podman image history --format

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-28 16:53:12 +02:00
7f28fd9386 Report properly whether pod shares host network
Fixes: https://github.com/containers/podman/issues/14028

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-28 10:27:21 -04:00
87454cf87a Merge pull request #14040 from edsantiago/gomega_havefield
e2e tests: use HaveField() for better error checking
2022-04-28 10:25:46 -04:00
d0b96a541d Merge pull request #14051 from giuseppe/volume-create-noquota-option
volume: add new option -o o=noquota
2022-04-28 10:23:58 -04:00
cb9a45630f shell completion --format: use anonymous struct field once
We should not include the anonymous twice in the suggestions.

one example is `podman network ls --format {{.` it will also show
`{{.Network` but since Network is the actual struct all fields are
already shown so there is no need for it to be suggested.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-28 15:11:25 +02:00
8be9781586 network inspect --format: add completion for go template
Make sure to autocomplete the go template for network inspect.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-28 15:11:25 +02:00
f93ba587c6 shell completion --format: work with nil structs
AutocompleteFormat() takes the format struct as argument. Often the structs
are deeply nested and contain other structs. Up until now if there was a
pointer to a struct the logic was not able to get the field names from
that, simply because the pointer was nil. However it is possible to
create a new initialized type with reflect.New(). This allows us to
complete all struct fields/functions even when there nil pointers.
Therefore we can drop the extra initialization which was done by some
callers.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-28 15:11:21 +02:00
589e42c990 Bump github.com/containernetworking/cni from 1.0.1 to 1.1.0
Bumps [github.com/containernetworking/cni](https://github.com/containernetworking/cni) from 1.0.1 to 1.1.0.
- [Release notes](https://github.com/containernetworking/cni/releases)
- [Commits](https://github.com/containernetworking/cni/compare/v1.0.1...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/containernetworking/cni
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-28 12:09:13 +00:00
a5aea8e503 Three manual fixes
Two for this error:

    invalid indirect of pod.Spec.DNSConfig.Options[0]

...and one for a gofmt error (spaces).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-28 05:43:41 -06:00
b3f38c31b2 Ginkgo: use HaveField() for better error checking
This is a very late followup to my ginkgo-improving work of 2021.
It has been stuck since December because it requires gomega 1.17,
which we've just enabled.

This commit is simply a copy-paste of a command I saved in
my TODO list many months ago:

     sed -i -e 's/Expect(\([^ ]\+\)\.\([a-zA-Z0-9]\+\))\.To(Equal(/Expect(\1).To(HaveField(\"\2\", /' test/e2e/*_test.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-28 05:41:53 -06:00
91ead15283 volume: add new option -o o=noquota
add a new option to completely disable xfs quota usage for a volume.

xfs quota set on a volume, even just for tracking disk usage, can
cause weird errors if the volume is later re-used by a container with
a different quota projid.  More specifically, link(2) and rename(2)
might fail with EXDEV if the source file has a projid that is
different from the parent directory.

To prevent such kind of issues, the volume should be created
beforehand with `podman volume create -o o=noquota $ID`

Closes: https://github.com/containers/podman/issues/14049

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-04-28 13:29:01 +02:00