12681 Commits

Author SHA1 Message Date
db60a1e654 Add support for libsubid
This will enable remote access to /etc/subuid and /etc/subgid
information from ldap services, if shadow-utils ships with a libsubid.

[NO TESTS NEEDED] Since we have no way to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-08-27 08:13:01 -04:00
6f61ef87af Merge pull request #11337 from Luap99/anon-template
Shell completion for --format with anonymous fields
2021-08-27 07:23:26 -04:00
8469417040 Globally replace http:// with https://
[NO TESTS NEEDED] Hopefully existing tests will find issues.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-08-27 06:14:46 -04:00
ab6c43f3e0 Shell completion for --format with anonymous fields
In commit d81021ed265e I introduced shell completion for the `--format`
flag. This is a very nice way to complete go template field names.
However it did not work correct for anonymous fields. In this case the
child fields can be accessed directly from the parent.

For example:
```
type Anonymous struct {
   Field1 string
   Field2 string
   ...
}

type MyType struct {
    Anonymous
}

var s = MyType{}
```

Now if you want to access a field from the Anonymous struct you can just
do `s.Field1`. The same is allowed for go templates, using `{{.Field1}}`
should work. This commit adds this functionality, if the field is anonymous
read the child field names recursively and add them to the suggestions.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-08-27 10:28:15 +02:00
d28e85741f InfraContainer Rework
InfraContainer should go through the same creation process as regular containers. This change was from the cmd level
down, involving new container CLI opts and specgen creating functions. What now happens is that both container and pod
cli options are populated in cmd and used to create a podSpecgen and a containerSpecgen. The process then goes as follows

FillOutSpecGen (infra) -> MapSpec (podOpts -> infraOpts) -> PodCreate -> MakePod -> createPodOptions -> NewPod -> CompleteSpec (infra) -> MakeContainer -> NewContainer -> newContainer -> AddInfra (to pod state)

Signed-off-by: cdoern <cdoern@redhat.com>
2021-08-26 16:05:16 -04:00
94c37d7d47 Merge pull request #11298 from baude/kubeupdown
teardown play kube
2021-08-26 13:58:44 -04:00
70caa63e7c Merge pull request #11318 from jmguzik/volume-ls-prune-docs
[CI:DOCS] Add filter params description to volume list/prune docs
2021-08-26 13:01:44 -04:00
1e6d1e5c6b Add filter params description to volume list/prune docs
Description adjusted to the standard seen in other man pages.
[CI:DOCS]

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-08-26 17:09:06 +02:00
18da5b0bf6 Merge pull request #11208 from ashley-cui/streams
[NO TESTS NEEDED] Allow setting of machine stream and image path from containers.conf
2021-08-26 10:13:08 -04:00
54e0afffe7 Merge pull request #11218 from cdoern/untilBug
logFile until flag issue, negative duration replaced with positive
2021-08-26 10:12:09 -04:00
cb23559270 Merge pull request #11307 from flouthoc/volume-import-external
volumes: Add support for `volume import` which allows importing contents of external tarballs into podman volumes.
2021-08-26 09:33:08 -04:00
f5ce02b227 Bump github.com/containers/image/v5 from 5.15.2 to 5.16.0
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.15.2 to 5.16.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.15.2...v5.16.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-26 13:21:26 +00:00
6f1faf36da Merge pull request #11321 from containers/dependabot/go_modules/github.com/fsnotify/fsnotify-1.5.1
Bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.1
2021-08-26 09:03:06 -04:00
d5507704e9 volumes: Add volume import to allow importing contents on tar into volume
Following feature makes sure that users can load contents of external
tarball into the podman volumes.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2021-08-26 14:14:14 +05:30
e88b62b34b Fix swagger issue
Add special case for op PlayKubeDownLibpod Heuristic for guessing swagger operation id too limited for PlayKubeDownLibpod

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-08-25 15:50:55 -05:00
49cfed756f Merge pull request #11103 from jwhonce/wip/bindings
Fix file descriptor leaks in bindings and add test
2021-08-25 14:42:12 -04:00
fefa0b32c7 Merge pull request #11314 from Luap99/expose-ports
podman inspect show exposed ports
2021-08-25 09:29:03 -04:00
c6e12a2e44 Bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.1
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.4.9 to 1.5.1.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.4.9...v1.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-25 12:28:54 +00:00
1dc6d14735 Fix file descriptor leaks and add test
* Add response.Body.Close() where needed to release HTTP
  connections to API server.
* Add tests to ensure no general leaks occur. 100% coverage would be
  required to ensure no leaks on any call.
* Update code comments to be godoc correct

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-08-24 16:36:10 -07:00
1e176923b1 teardown play kube
add the ability for play kube to tear down based on the yaml used to
play it.  it is indicated by --down in the play kube command.  volumes
are NOT deleted during the teardown.  pods and their containers are
stopped and removed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-08-24 14:26:14 -05:00
3f22e52964 Allow setting of machine stream and image path from containers.conf
Default is "testing"

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-08-24 14:18:55 -04:00
23f9565547 Merge pull request #11263 from nalind/journal-read
libpod/Container.readFromJournal(): don't skip the first entry
2021-08-24 14:16:22 -04:00
24ee67bb09 Merge pull request #11315 from vrothberg/fix-11304
generate systemd: use --cidfile again
2021-08-24 13:10:45 -04:00
e9daaf62e3 Merge pull request #11232 from Luap99/network
Network interface
2021-08-24 10:30:11 -04:00
274d6fa19c generate systemd: use --cidfile again
Commit 9ac5267 changed the type of the generated systemd units from
`forking` to `notify`.  It further stopped using `--cidfile` and instead
intended systemd to take care of stopping the container, which turned
out to be a bad idea.

Systemd will send the stop/kill signals to conmon which in turn may exit
non-zero, depending on the signal, and ultimately breaking container
cleanup.

Hence, we need to use --cidfile again and let podman stop and remove the
container to make sure that everything's in order.

Fixes: #11304
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-24 15:46:00 +02:00
4b2dc48d0b podman inspect show exposed ports
Podman inspect has to show exposed ports to match docker. This requires
storing the exposed ports in the container config.
A exposed port is shown as `"80/tcp": null` while a forwarded port is
shown as `"80/tcp": [{"HostIp": "", "HostPort": "8080" }]`.

Also make sure to add the exposed ports to the new image when the
container is commited.

Fixes #10777

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-08-24 15:44:26 +02:00
74ab2aaf9f Revert "generate systemd: custom stop signal"
This reverts commit 70801b3d714b067d64744697433c5841926dad4d.

It turns out that letting systemd handle stopping the container is not
working as I thought it will.  Conmon is receiving the stop/kill signals
and may exit non-zero, which in turn lets the systemd service transition
into the `failed` state.

We need to get back to letting Podman stop the containers and do a
partial revert of commit 9ac5267 which removed using --cidfile.

Happening in a following commit.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-24 13:33:06 +02:00
c0b1edd6a4 Network interface
Implement a new network interface to abstract CNI from libpod. The
interface is implemented for the CNI backend but in the future we can
add more backends.

The code is structured in three new packages:
- `libpod/network/types`: contains the interface definition
  and the necessary types for it.
- `libpod/network/cni` contains the interface implementation for the CNI
  backend.
- `libpod/network/util` a set of utility functions related to
  networking.

The CNI package uses ginkgo style unit tests. To test Setup/Teardown the
test must be run as root. Each test will run in their own namespace to
make the test independent from the host environment.

New features with the CNI backend:
- The default network will be created in memory if it does not exists on
  disk.
- It can set more than one static IP per container network.
- Networks are loaded once from disk and only if this interface is
  used, e.g. for commands such as `podman info` networks are not loaded.
  This reduces unnecessary disk IO.

This commit only adds the interface it is not wired into libpod. This
requires a lot of breaking changes which will be done in a followup
commit.

Once this is integrated into libpod the current network code under
`libpod/network` should be removed. Also the dependency on OCICNI
should be dropped.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-08-24 12:28:03 +02:00
e20ec47a59 Merge pull request #11312 from vrothberg/fix-11304
generate systemd: custom stop signal
2021-08-24 06:13:56 -04:00
70801b3d71 generate systemd: custom stop signal
Commit 9ac5267598c3 changed the type of the generated systemd units from
forking to notify.  Parts of these changes was also removing the need to
pass any information via the file system (e.g., PIDFILE, container ID).
That in turn implies that systemd takes care of stopping the container.

By default, systemd first sends a SIGTERM and after a certain timeout,
it'll send a SIGKILL.  That's pretty much what Podman is doing, unless
the container was created with a custom stop signal which is the case
when the --stop-signal flag was used or systemd is mounted.

Account for that by using systemd's KillSignal option which allows for
changing SIGTERM to another signal.  Also make sure that we're using the
correct timeout for units generated with --new.

Fixes: #11304
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-24 10:50:16 +02:00
eb9d731c68 Merge pull request #11313 from nalind/leaked-bus-connection
utils.RunUnderSystemdScope(): always close Conn
2021-08-24 03:50:56 -04:00
3007bd4a99 130-kill.bats: increase timeouts from 10s to 60s
Increase the amount of time we're willing to wait for a log message that
a container should be printing to show up in the output of `logs -f`,
since on at least one CI configuration we're seeing a turnaround as high
as 46s, but it's not something we can directly control, so that's not a
hard maximum.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-23 18:09:56 -04:00
21f396de6f logs: adjust handling around partial log messages
In libpod/logs.LogLine.Write(), don't write a newline to stdout/stderr
when the log message is only part of a line.

In libpod.ConmonOCIRuntime.HTTPAttach(), don't send a newline over the
HTTP connection when the log message is only part of a line.

In pkg/api/handlers/compat.LogsFromContainer(), don't send a newline
over the HTTP connection when the log message is only part of a line,
and don't make doing so conditional on whether or not the client used
the docker or podman endpoint.

In pkg/domain/infra/tunnel.ContainerEngine.ContainerLogs(), don't add
our own newline to log messages, since they already come through from
the server when they need to.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-23 18:00:18 -04:00
b20a547059 330-corrupt-images: don't try to tag with a canonical name
In these tests, don't try to tag an image using a canonical ("with
digest") image name.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-23 18:00:08 -04:00
fc6a020330 bump github.com/containers/common
Update github.com/containers/common from 0.43.0 to 0.43.2.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-23 17:59:58 -04:00
1411fa5f23 libpod/Container.readFromJournal(): don't skip the first entry
When reading log entries from the journal, don't skip past the first
matching entry after we've positioned the cursor at it.

Make the first blank-line entry that we logged so that the container
would always have at least one log entry for us to find (until it gets
vacuumed out, at least) a fake history entry, so that `logs` doesn't
pass it on for display.

CI already has tests that exercise journal-based logging, so
[NO TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-23 17:59:49 -04:00
6b06e9b77c Switch eventlogger to journald by default
[NO TESTS NEEDED] Since we are just testing the default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-08-23 17:59:42 -04:00
02e59c6683 utils.RunUnderSystemdScope(): always close Conn
Make sure we close our private connection to the bus, even if we're not
successful in in using it to ask systemd to move a unit's processes to a
specific control group.

[NO TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-08-23 17:23:17 -04:00
d1137664fe Merge pull request #11311 from containers/dependabot/go_modules/github.com/containers/buildah-1.22.3
Bump github.com/containers/buildah from 1.22.0 to 1.22.3
2021-08-23 15:00:21 -04:00
90cf78b199 Merge pull request #11290 from flouthoc/volume-export
volumes: Add support for `volume export` which allows exporting content to  external path.
2021-08-23 14:01:20 -04:00
6a3741598c Merge pull request #11205 from Shivkumar13/shivkumar-tls-fix
Support for --tls-verify flag in podman-run & podman-create
2021-08-23 13:44:19 -04:00
062900c264 Merge pull request #11309 from containers/dependabot/go_modules/github.com/opencontainers/runc-1.0.2
Bump github.com/opencontainers/runc from 1.0.1 to 1.0.2
2021-08-23 13:40:22 -04:00
f9d706bc49 Merge pull request #11308 from vrothberg/profiling
profiling: higher memory sampling rate
2021-08-23 13:33:19 -04:00
d06d285e66 logFile until flag issue
we were adding a negative duration in podman events, causing inputs like
-5s to be correct and 5s to be incorrect.

fixes #11158

Signed-off-by: cdoern <cdoern@redhat.com>
2021-08-23 12:51:56 -04:00
edddfe8c4f volumes: Add support for exporting volumes to external tar
Adds support for transferring data between systems and backing up systems.
Use cases: recover from disasters or move data between machines.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2021-08-23 20:42:41 +05:30
d24a5d9fdd Bump github.com/opencontainers/runc from 1.0.1 to 1.0.2
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Commits](https://github.com/opencontainers/runc/compare/v1.0.1...v1.0.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 14:26:28 +00:00
7b54a5fbe8 profiling: higher memory sampling rate
Increase the memory-sampling rate to the same default as
github.com/pkg/profile.  Allow for custom rates by reading
the `MemProfileRate` env variable.

[NO TESTS NEEDED] since it's a dev only flag and not part of CI.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-23 16:19:47 +02:00
ac5f2e1162 Merge pull request #11310 from containers/dependabot/go_modules/github.com/onsi/gomega-1.16.0
Bump github.com/onsi/gomega from 1.15.0 to 1.16.0
2021-08-23 10:11:10 -04:00
d36510702b Merge pull request #11305 from Luap99/fix-11303
Use pod netns with --pod-id-file
2021-08-23 09:40:09 -04:00
34a6dfb30e Merge pull request #11291 from containers/dependabot/go_modules/k8s.io/api-0.22.1
Bump k8s.io/api from 0.22.0 to 0.22.1
2021-08-23 08:55:10 -04:00