aboutsummaryrefslogtreecommitdiff
path: root/cmd
Commit message (Collapse)AuthorAge
* Merge pull request #11890 from Luap99/portsOpenShift Merge Robot2021-11-06
|\ | | | | libpod: deduplicate ports in db
| * libpod: deduplicate ports in dbPaul Holzinger2021-10-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The OCICNI port format has one big problem: It does not support ranges. So if a users forwards a range of 1k ports with podman run -p 1001-2000 we have to store each of the thousand ports individually as array element. This bloats the db and makes the JSON encoding and decoding much slower. In many places we already use a better port struct type which supports ranges, e.g. `pkg/specgen` or the new network interface. Because of this we have to do many runtime conversions between the two port formats. If everything uses the new format we can skip the runtime conversions. This commit adds logic to replace all occurrences of the old format with the new one. The database will automatically migrate the ports to new format when the container config is read for the first time after the update. The `ParsePortMapping` function is `pkg/specgen/generate` has been reworked to better work with the new format. The new logic is able to deduplicate the given ports. This is necessary the ensure we store them efficiently in the DB. The new code should also be more performant than the old one. To prove that the code is fast enough I added go benchmarks. Parsing 1 million ports took less than 0.5 seconds on my laptop. Benchmark normalize PortMappings in specgen: Please note that the 1 million ports are actually 20x 50k ranges because we cannot have bigger ranges than 65535 ports. ``` $ go test -bench=. -benchmem ./pkg/specgen/generate/ goos: linux goarch: amd64 pkg: github.com/containers/podman/v3/pkg/specgen/generate cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz BenchmarkParsePortMappingNoPorts-12 480821532 2.230 ns/op 0 B/op 0 allocs/op BenchmarkParsePortMapping1-12 38972 30183 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMapping100-12 18752 60688 ns/op 141088 B/op 315 allocs/op BenchmarkParsePortMapping1k-12 3104 331719 ns/op 223840 B/op 3018 allocs/op BenchmarkParsePortMapping10k-12 376 3122930 ns/op 1223650 B/op 30027 allocs/op BenchmarkParsePortMapping1m-12 3 390869926 ns/op 124593840 B/op 4000624 allocs/op BenchmarkParsePortMappingReverse100-12 18940 63414 ns/op 141088 B/op 315 allocs/op BenchmarkParsePortMappingReverse1k-12 3015 362500 ns/op 223841 B/op 3018 allocs/op BenchmarkParsePortMappingReverse10k-12 343 3318135 ns/op 1223650 B/op 30027 allocs/op BenchmarkParsePortMappingReverse1m-12 3 403392469 ns/op 124593840 B/op 4000624 allocs/op BenchmarkParsePortMappingRange1-12 37635 28756 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange100-12 39604 28935 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange1k-12 38384 29921 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange10k-12 29479 40381 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange1m-12 927 1279369 ns/op 143022 B/op 164 allocs/op PASS ok github.com/containers/podman/v3/pkg/specgen/generate 25.492s ``` Benchmark convert old port format to new one: ``` go test -bench=. -benchmem ./libpod/ goos: linux goarch: amd64 pkg: github.com/containers/podman/v3/libpod cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz Benchmark_ocicniPortsToNetTypesPortsNoPorts-12 663526126 1.663 ns/op 0 B/op 0 allocs/op Benchmark_ocicniPortsToNetTypesPorts1-12 7858082 141.9 ns/op 72 B/op 2 allocs/op Benchmark_ocicniPortsToNetTypesPorts10-12 2065347 571.0 ns/op 536 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts100-12 138478 8641 ns/op 4216 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts1k-12 9414 120964 ns/op 41080 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts10k-12 781 1490526 ns/op 401528 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts1m-12 4 250579010 ns/op 40001656 B/op 4 allocs/op PASS ok github.com/containers/podman/v3/libpod 11.727s ``` Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | Merge pull request #12183 from Luap99/rootless-netns-cleanupOpenShift Merge Robot2021-11-05
|\ \ | | | | | | Fix rootless cni netns cleanup logic and rename to rootless netns
| * | rename rootless cni ns to rootless netnsPaul Holzinger2021-11-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we want to use the rootless cni ns also for netavark we should pick a more generic name. The name is now "rootless network namespace" or short "rootless netns". The rename might cause some issues after the update but when the all containers are restarted or the host is rebooted it should work correctly. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | | tweak a couple of flag descriptions in help outputNalin Dahyabhai2021-11-04
|/ / | | | | | | | | | | Descriptions of flags don't need to start with whitespace of their own. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
* | Make stop message more similar to startAnders F Björklund2021-11-02
| | | | | | | | | | | | [NO TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
* | Merge pull request #12141 from kprav33n/help-docOpenShift Merge Robot2021-10-30
|\ \ | | | | | | Fix help message case for `podman version`
| * | Fix help message case for `podman version`Praveen Kumar2021-10-29
| |/ | | | | | | | | | | | | | | | | This is a cosmetic change. The help message for `podman version` is in title case whereas all other command help messages are not in title case. This stands out as inconsistent when looking at the output of `podman help`. Signed-off-by: Praveen Kumar <praveen+git@kumar.in>
* | Merge pull request #12090 from afbjorklund/image-streamOpenShift Merge Robot2021-10-29
|\ \ | |/ |/| Record the image stream along with the path
| * Record the image stream along with the pathAnders F Björklund2021-10-26
| | | | | | | | | | | | [NO TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
* | container create: fix --tls-verify parsingValentin Rothberg2021-10-27
| | | | | | | | | | | | | | | | | | Make sure that the value is only set if specified on the CLI. c/image already defaults to true but if set in the system context, we'd skip settings in the registries.conf. Fixes: #11933 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | pod create: remove need for pause imageValentin Rothberg2021-10-26
|/ | | | | | | | | So far, the infra containers of pods required pulling down an image rendering pods not usable in disconnected environments. Instead, build an image locally which uses local pause binary. Fixes: #10354 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Add support to play kube for --log-optDaniel J Walsh2021-10-25
| | | | | | Fixes: https://github.com/containers/podman/issues/11727 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix some typos in documentation and comments (found by codespell)Stefan Weil2021-10-25
| | | | Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Merge pull request #11991 from rhatdan/sizeOpenShift Merge Robot2021-10-22
|\ | | | | Allow API to specify size and inode quota
| * Allow API to specify size and inode quotaDaniel J Walsh2021-10-18
| | | | | | | | | | | | | | | | | | | | | | Fixes: https://github.com/containers/podman/issues/11016 [NO NEW TESTS NEEDED] We have no easy way to tests this in CI/CD systems. Requires quota to be setup on directories to work. Fixes: https://github.com/containers/podman/issues/11016 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Remove --kernel-memory optionsDaniel J Walsh2021-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel memory option has been depracated in runtime-spec, It is believed that it will not work properly on certain kernels. runc ignores it. This PR removes documentation of the flag and also prints a warning if a user uses it. [NO NEW TESTS NEEDED] Helps Fix: https://github.com/containers/podman/issues/12045 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | System tests: confirm that -a and -l clashEd Santiago2021-10-20
| | | | | | | | | | | | ...and fix one instance where there was no check Signed-off-by: Ed Santiago <santiago@redhat.com>
* | Change podman connection list to use default fieldDaniel J Walsh2021-10-18
|/ | | | | | | | | Stop using "*" to indicate default. Add default field to make it more obvios and the json field more machine usable. Fixes: https://github.com/containers/podman/issues/12019 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Move CONTAINER_HOST and _CONNECTION to IsRemote FunctionDaniel J Walsh2021-10-15
| | | | | | | | Current code does not check early enough. Follow up to https://github.com/containers/podman/pull/11978 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* If CONTAINER_HOST env variable is set default podman --remote=trueDaniel J Walsh2021-10-14
| | | | | | | | | | | Users enabling CONTAINER_HOST==PATH is indicating to podman they intend to use remote functionality. Fixes: https://github.com/containers/podman/issues/11196 Update man pages to document all of the environment variables. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #11971 from rhatdan/archiveOpenShift Merge Robot2021-10-14
|\ | | | | Don't use docker/pkg/archive, use containers/storage/pkg/archive
| * Don't use docker/pkg/archive, use containers/storage/pkg/archiveDaniel J Walsh2021-10-14
| | | | | | | | | | | | [NO NEW TESTS NEEDED] Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Fix panic in container create compat apiPaul Holzinger2021-10-14
|/ | | | | | | | | The bind and tmpfs options can be nil, we have to check that before we try to use it. Fixes #11961 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Merge pull request #11948 from rhatdan/codespellOpenShift Merge Robot2021-10-13
|\ | | | | codespell code
| * codespell codeDaniel J Walsh2021-10-12
| | | | | | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Merge pull request #11892 from vrothberg/searchOpenShift Merge Robot2021-10-13
|\ \ | | | | | | podman search: display only name and description by default
| * | podman search: display only name and description by defaultValentin Rothberg2021-10-13
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the default format of `podman search` to only display the name and the description of each image. The index is redundant to the name and consumes a lot of space, and other descriptors (i.e., stars, official, automated) are specific to Docker Hub and also consume a lot space. Users can still use `--format` for displaying the descriptors they want to. Add a `--compatible` flag to offer an easy way to get them back. Also update the man page to account for the behavior and get some fresh data in the examples. Motivated by a recent conversation in libimage: https://github.com/containers/common/pull/802#issuecomment-937108734 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | Merge pull request #11565 from Luap99/rootlessport-binOpenShift Merge Robot2021-10-13
|\ \ | |/ |/| rootlessport: reduce memory usage of the process
| * rootlessport: reduce memory usage of the processPaul Holzinger2021-10-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use reexec for the rootlessport process, instead make it a separate binary to reduce the memory usage. The problem with reexec is that it will import all packages that podman uses and therefore loads a lot of stuff into the heap. The rootlessport process however only needs the rootlesskit library. The memory usage is a concern since the rootlessport process will spawn two process per container which has ports forwarded. The processes stay until the container dies. On my laptop the current reexec version uses 47800 KB RSS. The new separate binary only uses 4540 KB RSS. This is more than a 90% improvement. The Makefile has been updated to compile the new binary and install it to the libexec directory. Fixes #10790 [NO TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | Merge pull request #11924 from jwhonce/issues/11894OpenShift Merge Robot2021-10-12
|\ \ | |/ |/| Refactor podman search to be more code friendly
| * Refactor podman search to be more code friendlyJhon Honce2021-10-12
| | | | | | | | | | | | | | | | | | | | | | * JSON and API description fields are no longer truncated. Formatting moved to client, better support of MVP. * --no-trunc now defaults to true * Updated tests for changes Closes #11894 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | Merge pull request #11927 from jwhonce/issues/11921OpenShift Merge Robot2021-10-12
|\ \ | | | | | | Fix CI flake on time of shutdown for API service
| * | Fix CI flake on time of shutdown for API serviceJhon Honce2021-10-12
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Increase timeout for tests to 10s * To aid in debugging add PID to shutdown package logging * Added new message for forced service shutdown * Always wait for HTTP server to shutdown, duration of 0 not friendly to clients Note: The log event "IdleTracker: StateClosed transition by connection marked un-managed" denotes a TCP connection has been initiated but no HTTP request was sent. And is expected during these tests. Fixes #11921 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* / builder: Add support for builder pruneAditya Rajan2021-10-12
|/ | | | | | | | | | | | | | Docker has support for docker builder prune and docker builder build This patch will add a hidden command to support scripts using this syntax. We don't want to encourage this deviation. Add podman build prune to implement docker builder prune functionality. Co-authored-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Aditya Rajan <arajan@redhat.com>
* Merge pull request #11919 from Luap99/stats-cgroupOpenShift Merge Robot2021-10-11
|\ | | | | podman stats: move cgroup validation to server
| * podman stats: move cgroup validation to serverPaul Holzinger2021-10-11
| | | | | | | | | | | | | | | | | | | | | | | | Podman stats is not supported for rootless cgroupv1 setups. The check for this must be on the server side and not the client. [NO NEW TESTS NEEDED] we cannot test this because remote and server are always on the same machine in CI Fixes #11909 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | Merge pull request #11819 from trynaeat/dial-stdioOpenShift Merge Robot2021-10-11
|\ \ | |/ |/| Adding dial-stdio CLI cmd
| * Fixes #11668Jake Parks2021-10-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding dial-stdio CLI cmd Signed-off-by: Jake Parks <jamesparks10@gmail.com> Made dial-stdio URI configurable Slight refactors Signed-off-by: Jake Parks <jamesparks10@gmail.com> Added simple test for existence of `podman system dial-stdio` command Fix 'system dial-stdio' integration tests Changed link in comment to permalink
* | Merge pull request #11869 from jwhonce/wip/pprofOpenShift Merge Robot2021-10-10
|\ \ | | | | | | Enable /debug/pprof API service endpoints
| * | Enable /debug/pprof API service endpointsJhon Honce2021-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor sidecar HTTP service for /debug/pprof endpoints to use a TCP address given via new podman system service --pprof-address flag * Allow same URL parsing in "system service" as bindings/connection.go * Refactor NewServerWithSettings() to use entities.ServiceOptions in place of deleted server.Options * Updated godoc for impacted functions and types * Fixed API service Shutdown() to do an orderly shutdown when terminated and running with --time=0 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | | Not all fields in machine list were set properlyAnders F Björklund2021-10-08
|/ / | | | | | | | | | | | | | | | | When using custom output formats like table, some of the booleans introduced for json format were not initialized correctly (wrong). [NO TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
* / [CI:DOCS] introduce --replace flag for play kubeChen Zhiwei2021-10-08
|/ | | | | | | | With this flag, users can easily sync up the yaml content with the existing pods. Fixes #11481 Signed-off-by: Chen Zhiwei <zhiweik@gmail.com>
* Add --time out for podman * rm -f commandsDaniel J Walsh2021-10-04
| | | | | | | | | Add --time flag to podman container rm Add --time flag to podman pod rm Add --time flag to podman volume rm Add --time flag to podman network rm Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Pod Volumes From Supportcdoern2021-10-01
| | | | | | | added support for a volumes from container. this flag just required movement of the volumes-from flag declaration out of the !IsInfra block, and minor modificaions to container_create.go Signed-off-by: cdoern <cdoern@redhat.com>
* Merge pull request #11707 from rhatdan/playOpenShift Merge Robot2021-10-01
|\ | | | | Add podman play kube --no-hosts options
| * Add podman play kube --no-hosts optionsDaniel J Walsh2021-10-01
| | | | | | | | | | | | | | | | | | This option will setup the containers to not modify their /etc/hosts file and just use the one from the image. Fixes: https://github.com/containers/podman/issues/9500 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Merge pull request #11686 from cdoern/podDeviceOptionsOpenShift Merge Robot2021-10-01
|\ \ | |/ |/| Pod Device-Read-BPS support
| * Pod Device-Read-BPS supportcdoern2021-09-28
| | | | | | | | | | | | | | | | | | added the option for the user to specify a rate, in bytes, at which they would like to be able to read from the device being added to the pod. This is the first in a line of pod device options. WARNING: changed pod name json tag to pod_name to avoid confusion when marshaling with the containerspec's name Signed-off-by: cdoern <cdoern@redhat.com>
* | Merge pull request #11794 from umohnani8/pidOpenShift Merge Robot2021-09-30
|\ \ | | | | | | Allow a value of -1 to set unlimited pids limit