Commit graph

3784 commits

Author SHA1 Message Date
OpenShift Merge Robot 5659b0734c
Merge pull request #12867 from cdoern/scp
switch podman image scp from depending on machinectl to just os/exec
2022-01-27 07:48:50 -05:00
Giuseppe Scrivano 6336e1ff1e
rootless: drop permission check for devices
commit 350ede1eeb added the feature.

Do not check whether the device is usable by the rootless user before
adding to the container.

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

[NO NEW TESTS NEEDED] it requires changes on the host to test it

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-01-27 09:35:02 +01:00
cdoern 77cd38d40c switch podman image scp from depending on machinectl to just os/exec
machinectl does not propogate error messages and adds extra lines in the output, exec.Cmd is able to clear the env besides PATH and TERM,
and use the given UID and GID to execute the command properly.

machinectl is still used to create a user session. Ubuntu support is limited by this.

Signed-off-by: cdoern <cdoern@redhat.com>
2022-01-26 14:40:44 -05:00
Jhon Honce 44a87229b6 Update godoc, swagger using wrong struct
Documentation for API volume list, pointed to a different struct
than the code.

[NO NEW TESTS NEEDED]

Fixes #12987

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-25 10:05:51 -07:00
OpenShift Merge Robot 6d03146a8c
Merge pull request #12974 from kolyshkin/typo
pkg/specgen/generate/security: fix error message text
2022-01-25 07:19:43 -05:00
OpenShift Merge Robot 95db13d342
Merge pull request #12969 from rhatdan/remote
Fix handling of duplicate matches on id expansion
2022-01-25 00:01:41 -05:00
Kir Kolyshkin 98739237ee pkg/specgen/generate/security: fix error message
This should be Network Namespace, not Host Namespace.

[NO NEW TESTS NEEDED]

Fixes: 0d70df11
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-01-24 13:24:37 -08:00
Paul Holzinger dbfe79757b
remote build: set rootless oci isolation correctly
When we run rootless buildah needs to have IsolationOCIRootless set
otherwise it will run code which cannot be used as rootless user.
Podman should use the buildah default if possible and change it to
rootless mode if needed.

[NO NEW TESTS NEEDED] Should be covered by existing tests once we have
podman-remote rootless tests.

Fixes #12989

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-24 19:51:59 +01:00
Daniel J Walsh 80a5295d42
Fix handling of duplicate matches on id expansion
Fixes: https://github.com/containers/podman/issues/12963

[NO NEW TESTS NEEDED] I don't know how to create two
containers with the same first digit of the digest,
which I could them attempt to remove.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-24 13:19:16 -05:00
Jakub Guzik 7938f32c53 Remove unused param and clean API handlers
This commit removes error message string from utils.Error in pkg/api.
Param was not used inside a function for quite a long time
[NO NEW TESTS NEEDED]

Signed-off-by: Jakub Guzik <jguzik@redhat.com>
2022-01-22 00:31:18 +01:00
OpenShift Merge Robot d847ad598d
Merge pull request #12961 from rhatdan/codespell
Run codespell
2022-01-21 14:55:26 -05:00
OpenShift Merge Robot 94703f668a
Merge pull request #12959 from afbjorklund/machine-wait
Restore machine start logic that was hanging
2022-01-21 13:29:25 -05:00
Anders F Björklund e834297b39 Restore machine start logic that was hanging
After refactoring Stop(), mounting volumes was hanging in Start().

Restore the conditional, and add error reporting from isListening.

[NO NEW TESTS NEEDED]

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2022-01-21 16:43:48 +01:00
OpenShift Merge Robot e3ea996919
Merge pull request #12951 from rhatdan/commit
Fix #2 for compat commit handling of --changes
2022-01-21 10:07:27 -05:00
OpenShift Merge Robot 6e17158502
Merge pull request #12948 from Luap99/rootless-networking
Remove rootless_networking option from containers.conf
2022-01-21 09:57:26 -05:00
Daniel J Walsh 5736649eb8
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-21 09:52:12 -05:00
OpenShift Merge Robot 3074a98378
Merge pull request #12943 from machacekondra/nil_fix
Fix nil pointer dereference for configmap optional
2022-01-21 07:29:25 -05:00
Daniel J Walsh 653da8fe8f
Fix #2 for compat commit handling of --changes
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-21 07:22:36 -05:00
OpenShift Merge Robot 845256bdb3
Merge pull request #12936 from cgwalters/null-history
Don't segfault if an image layer has no creation timestamp
2022-01-21 04:17:25 -05:00
Ondra Machacek 9d815707e2 Fix nil pointer dereference for configmap optional
This PR fixes nil pointer dereference for configmap optional parameter.
When optional parameter is not passed, the code tried to acces the
parameter which caused nil pointer dereference.

Signed-off-by: Ondra Machacek <omachace@redhat.com>
2022-01-21 10:01:32 +01:00
Colin Walters 2947ded7a8 Don't segfault if an image layer has no creation timestamp
It's optional in the specification, and I initially omitted
it in the ostree code.  Now I've fixed the ostree code
to inject a timestamp, but we should clearly avoid segfaulting
on this case.

Signed-off-by: Colin Walters <walters@verbum.org>
2022-01-20 18:02:58 -05:00
OpenShift Merge Robot 993c072029
Merge pull request #12942 from flouthoc/compat-load-tar-with-multiple-images
compat: `images/load` must be able to load tar with multiple images
2022-01-20 17:29:31 -05:00
Aditya R 1c0fdba4f2
compat: remove hardcoded index from load images output report
Signed-off-by: Aditya R <arajan@redhat.com>
2022-01-21 00:46:17 +05:30
Aditya R 9df31cfb77
compat: images/load must be able to load tar with multiple images
`http:/host:port/images/load` fails to accept tar with more than one
images however manual load works as expected. Remove explicit check for
`1` image and only fail if result set has value less than `1`.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-01-21 00:23:54 +05:30
Paul Holzinger ee039b7403
Remove rootless_networking option from containers.conf
This field was only needed for machine to force cni, however you can set
netns="bridge" in the config to have the same effect. This is already
done in the machine setup.

see https://github.com/containers/common/pull/895

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-20 19:08:15 +01:00
OpenShift Merge Robot 206e57e5b0
Merge pull request #12928 from n1hility/win-env
Implement env parsing on Windows
2022-01-20 09:33:30 -05:00
OpenShift Merge Robot f46478c1e9
Merge pull request #12931 from giuseppe/fix-crash-with-bazel-linux-sandbox
rootless: report correctly the error
2022-01-20 00:57:26 -05:00
OpenShift Merge Robot 7fc8bf4a42
Merge pull request #12887 from esendjer/main
Add custom defined dependencies to podman generate systemd
2022-01-19 20:29:01 -05:00
OpenShift Merge Robot 6b59b10248
Merge pull request #12916 from n1hility/winproxy
Implement API forwarding for podman machine on Windows
2022-01-19 17:41:03 -05:00
Giuseppe Scrivano 7046e78040
rootless: report correctly the error
`err` is nil at this point, so errors.Wrapf() would return nil
ignoring the remaining arguments.  This would prevent SetupRootless()
to fail causing podman to run without capabilities but believing so,
and it would end up in a crash when accessing the local store.

Closes: https://github.com/containers/podman/discussions/12923

[NO NEW TESTS NEEDED] it requires running in the environment created
by bazel linux-sandbox.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-01-19 21:14:33 +01:00
Jason T. Greene 2d0b5ebb5b Implement API forwarding for podman machine on Windows
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-01-19 13:03:49 -06:00
Jason T. Greene 4693fc6db1 Implement env parsing on Windows
Fixes #12056
Also, enables existing parsing logic for all Unix derived OSs

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-01-19 12:05:04 -06:00
Daniel J Walsh c674d3cc75
Handle changes in docker compat mode
Fixes: https://github.com/containers/podman/issues/12830

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-19 13:03:58 -05:00
esendjer b9a2d8698a Handlers for generate systemd with custom dependencies
This commit includes:
* Handlers for generate systemd unit
  with manually defined dependencies such as:
  Wants=, After= and Requires=

* The new unit and e2e tests for checking generated systemd units
  for container and pod with custom dependencies

* Documented descriptions for custom dependencies options

Signed-off-by: Eugene (Evgenii) Shubin <esendjer@gmail.com>
2022-01-19 21:46:16 +05:00
OpenShift Merge Robot 8301a7cd82
Merge pull request #12862 from matejvasek/fix-info-ep
Add IndexConfigs info to compat /info endpoint
2022-01-19 09:29:05 -05:00
Matej Vasek 4b384e08a9 Add IndexConfigs to compat /info endpoint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-01-19 13:46:32 +01:00
Paul Holzinger c0e0723463
rename --cni-config-dir to --network-config-dir
Since this option will also be used for netavark we should rename it to
something more generic. It is important that --cni-config-dir still
works otherwise we could break existing container cleanup commands.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-18 19:28:25 +01:00
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00
OpenShift Merge Robot d0eb24bae0
Merge pull request #12870 from rhatdan/userns1
Use PODMAN_USERNS environment variable when running as a service
2022-01-18 06:08:06 -05:00
OpenShift Merge Robot 8514ebd182
Merge pull request #12860 from rhatdan/cgroups
Use CONTAINERS_CONF cgroups flag for remote API.
2022-01-17 12:57:20 +01:00
Daniel J Walsh 10d969ff1a
Use PODMAN_USERNS environment variable when running as a service
Fixes: https://github.com/containers/podman/issues/11350#issuecomment-1011562526

Also add inspect information about the idmappings if they exists.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-17 06:48:54 -05:00
Jakub Guzik 6bca61e0f1 Unify the method of parsing filters in cmd
This commit unifies the method of filters parsing in cmd.
It removes also the function redundancy.
[NO NEW TESTS NEEDED]

Signed-off-by: Jakub Guzik <jguzik@redhat.com>
2022-01-16 00:47:00 +01:00
OpenShift Merge Robot 3c9e41bb53
Merge pull request #12572 from rhatdan/image
Remove two GetImages functions from API
2022-01-15 20:39:16 +01:00
OpenShift Merge Robot fff9e8755c
Merge pull request #12861 from aklajnert/recursively_copy_certs
ignition: recursively copy cert files
2022-01-15 15:55:16 +01:00
Andrzej Klajnert 420303b943 Recursively copy cert files.
[NO NEW TESTS NEEDED]

Signed-off-by: Andrzej Klajnert <github@aklajnert.pl>
2022-01-15 12:47:49 +01:00
Jhon Honce 8a7e70919f Refactor manifest list operations
* Update method/function signatures use the manifest list name and
  images associated with the operation explicitly, in general

  func f(ctx context.Context, manifestListName string,
         ImageNames []string, options *fOptions)

* Leverage gorilla/mux Subrouters to support API v3.x and v4.x for
  manifests
* Make manifest API endpoints more RESTful
* Add PUT /manifest/{id} to update existing manifests
* Add manifests.Annotate to go bindings, uncommented unit test
* Add DELETE /manifest/{Id} to remove existing manifest list, use
  PUT /manifest/{id} to remove images from a list
* Deprecated POST /manifest/{id}/add and /manifest/{id}/remove, use
  PUT /manifest/{id} instead
* Corrected swagger godoc and updated to cover API changes
* Update podman manifest commands to use registry.Context()
* Expose utils.GetVar() to obtain query parameters by name
* Unexpose server.registerSwaggerHandlers, not sure why this was ever
  exposed.
* Refactored code to use http.Header instead of map[string]string when
  operating on HTTP headers.
* Add API-Version header support in bindings to allow calling explicate
  versions of the API. Header is _NOT_ forwarded to the API service.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-14 16:13:35 -07:00
Daniel J Walsh 607cb80bf7
Fix cgroup mode handling in api server
Also change code to globably be consistent when refering to capatilized
Cgroup.

Fixed: https://github.com/containers/podman/issues/12550

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 12:32:35 -05:00
Daniel J Walsh a15dfb3648
Standardize on capatalized Cgroups
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 12:30:20 -05:00
OpenShift Merge Robot 7ab99227e6
Merge pull request #12825 from elezar/update-cdi
Update use of CDI API
2022-01-14 15:17:21 +01:00
Daniel J Walsh 14940a067d
Remove two GetImages functions from API
[NO NEW TESTS NEEDED] This is just code cleanup.

The remote API has three different GetImages functions, which I believe
can be handled by just one function.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 07:37:55 -05:00