Commit Graph

172 Commits

Author SHA1 Message Date
Ygal Blum f1a1948b23 Quadlet - Do not override existing Environment in Service group for Pod units
Fixes: #26521

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-06-27 09:56:43 -04:00
openshift-merge-bot[bot] 7808625785
Merge pull request #26472 from Luap99/quadlet-nologrus
quadlet: remove indirect logrus import
2025-06-19 19:45:24 +00:00
Paul Holzinger 964069326d
quadlet: remove indirect logrus import
Reduces quadlet binary size about 170kb.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-19 18:47:40 +02:00
nbspsemicolon 5989370c39
pkg/systemd: expose [Pod] ExitPolicy key for pod create --exit-policy
Add ExitPolicy key to pod quadlets with logic to default to stop.

Docs updated with clarifcation on default value and usage example.

Simple assert added to bats to verify default constraint exists.

Changed argument order in ginkgo basic pod unit test

Signed-off-by: Neil Bailey <nbsp@nbailey.net>
2025-06-18 15:08:31 -04:00
Hiếu Lê 18ecd2046b
quadlet: generate RequiresMountsFor for Type=bind volumes
This makes sure that the volume source is available before the volume is
created.

Fixes: https://github.com/containers/podman/issues/26125

Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
2025-06-05 18:22:28 -05:00
Paul Holzinger a0f7db44e8
quadlet: add InterfaceName option to network unit
I noticed this was missing, its a simple 1 to 1 mapping to
--interface-name.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-04 16:46:39 +02:00
Ygal Blum 09d9d3e26b Revert "Quadlet - fix pod name to depend on the name of the generate service"
This reverts commit 4f38c2fea2.

Fixes: #26105
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-05-12 09:33:16 -04:00
Ygal Blum 4f38c2fea2 Quadlet - fix pod name to depend on the name of the generate service
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-05-06 12:02:01 -04:00
Ygal Blum 9b2fb40ab8 Quadlet - remove the usage of cid and podid for container and pod files
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-30 07:59:15 -04:00
Ygal Blum 3f56de0199 Quadlet - use helper function to initialize service struct
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-28 12:54:56 -04:00
Ygal Blum 633f727f2d Quadlet - use helper function for handling key=val type keys
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-24 14:15:39 -04:00
Robin Heinemeier 802fc15b1e Add Label to quadlet pod
Signed-off-by: Robin Heinemeier <sunnerlp@gmail.com>
2025-04-24 13:37:42 +00:00
openshift-merge-bot[bot] 5372c15bf8
Merge pull request #25892 from Regis-Caelum/quadlet-pod-hostname
Add HostName to quadlet pod
2025-04-22 12:52:04 +00:00
Inshal Khan 4ba8cde41d
Add HostName to quadlet pod
update docs for hostname

Signed-off-by: Inshal Khan <kziaul123@gmail.com>
2025-04-19 08:51:45 +05:30
Ygal Blum 6ac0a28564 Quadlet - support additional systemd unit relationship keys
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-17 14:51:24 -04:00
openshift-merge-bot[bot] 17f3aed4fd
Merge pull request #25899 from ygalblum/quadlet-unit-deps
Quadlet - translate dependencies on other quadlet units
2025-04-16 21:03:52 +00:00
Ygal Blum e498c6526b Quadlet - translate dependencies on other quadlet units
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-16 15:29:42 -04:00
openshift-merge-bot[bot] 09c2546b27
Merge pull request #25844 from ygalblum/quadlet-network-delete
Quadlet - allow deleting the network when stopping the service
2025-04-14 17:57:45 +00:00
Ygal Blum 0d4a148ee6 Quadlet - allow deleting the network when stopping the service
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-10 10:34:16 -04:00
Ygal Blum fe107ff0ce Quadlet - Add support for adding ExecReload command
Add tests
Update man page

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-04-09 14:40:41 -04:00
Kir Kolyshkin 1739b7170e pkg/systemd/quadlet: rm splitPorts
Usage of splitPorts was removed by commit abc4cfb04 ("quadlet: allow
variables in PublishPort") but the function remained, as well as its
tests.

Drop those.

Found by running golangci-lint with --tests=false option.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
Kir Kolyshkin f4f2580b0d ci: remove stylecheck linter
It is to be merged into staticcheck linter in golangci-lint v2.0.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
Kir Kolyshkin 0dddc5e3c0 Apply De Morgan's law
This fixes a bunch of "QF1001: could apply De Morgan's law" warnings
from staticcheck linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
Jan Kaluza 08a1c6d91e Add support for Retry= and RetryDelay= to Podman Quadlet.
This commit adds new Retry= and RetryDelay= options
to quadlet.go which result in --retry and --retry-delay
usage in podman run, image and build commands.

This allows configuring the retry logic in the systemd
files.

Fixes: #25109

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-03-26 09:01:28 +01:00
Ygal Blum 02658bc4cc Quadlet - Propagate warnings and print errors and warnings as they occur
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-03-10 11:51:32 -04:00
Ben Boeckel 543be25ef3 quadlet: support `Memory=` in `[Container]` sections
Maps to the `--memory=` flag.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
2025-02-17 17:29:15 +01:00
Odilon Sousa d1a3f96cbf Add support to ShmSize in Pods with Quadlet
This closes #22915

Signed-off-by: Odilon Sousa <osousa@redhat.com>
2024-12-30 12:33:00 -03:00
Misaki Kasumi cf505fe788 quadlet: fix inter-dependency of containers in `Network=`
Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
2024-12-11 08:33:37 +08:00
Ygal Blum 13affe96d6 Quadlet - Use = sign when setting the pull arg for build
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-11-22 15:06:50 -05:00
openshift-merge-bot[bot] a358d83ce9
Merge pull request #24437 from lambinoo/feat-split-pod-container-start-24401
Add key to control if a container can get started by its pod
2024-11-05 15:04:16 +00:00
Farya L. Maerten 2597eeae70 Add key to control if a container can get started by its pod
By default today, the container is always started if its pod is also
started. This prevents to create custom with systemd where containers in
a pod could be started through their `[Install]` section.

We add a key `StartWithPod=`, enabled by default, that enables one to
disable that behavior.

This prevents the pod service from changing the state of the container
service.

Fixes #24401

Signed-off-by: Farya L. Maerten <me@ltow.me>
2024-11-05 08:39:23 +01:00
Daniel J Walsh c6be5a6684
Honor users requests in quadlet files
Fixes: https://github.com/containers/podman/issues/24322

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-11-04 15:08:26 -05:00
Ygal Blum dbfc8cccda Quadlet - support image file based mount in container file
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-11-01 16:20:23 -04:00
Paul Holzinger 67e0fa8b89
quadlet: add default network dependencies to all units
There is no good reason for the special case, kube and pod units
definitely need it. Volume and network units maybe not but for
consistency we add it there as well. This makes the docs much easier to
write and understand for users as the behavior will not differ.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-18 14:01:22 +02:00
Paul Holzinger 57b022782b
quadlet: ensure user units wait for the network
As documented in the issue there is no way to wait for system units from
the user session[1]. This causes problems for rootless quadlet units as
they might be started before the network is fully up. TWhile this was
always the case and thus was never really noticed the main thing that
trigger a bunch of errors was the switch to pasta.

Pasta requires the network to be fully up in order to correctly select
the right "template" interface based on the routes. If it cannot find a
suitable interface it just fails and we cannot start the container
understandingly leading to a lot of frustration from users.

As there is no sign of any movement on the systemd issue we work around
here by using our own user unit that check if the system session
network-online.target it ready.

Now for testing it is a bit complicated. While we do now correctly test
the root and rootless generator since commit ada75c0bb8 the resulting
Wants/After= lines differ between them and there is no logic in the
testfiles themself to say if root/rootless to match specifics. One idea
was to use `assert-key-is-rootless/root` but that seemed like more
duplication for little reason so use a regex and allow both to make it
pass always. To still have some test coverage add a check in the system
test to ask systemd if we did indeed have the right depdendencies where
we can check for exact root/rootless name match.

[1] https://github.com/systemd/systemd/issues/3312

Fixes #22197

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-18 11:43:48 +02:00
Paul Holzinger 9c6b1e20a3
quadlet: do not reject RemapUsers=keep-id as root
This is simply wrong, as of commit de63ad7044 --userns=keep-id is also
allowed as root.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-17 15:53:10 +02:00
Farya L. M bac655a6b1 Allow removing implicit quadlet systemd dependencies
Quadlet inserts network-online.target Wants/After dependencies to ensure pulling works.
Those systemd statements cannot be subsequently reset.

In the cases where those dependencies are not wanted, we add a new
configuration item called `DefaultDependencies=` in a new section called
[Quadlet]. This section is shared between different unit types.

fixes #24193

Signed-off-by: Farya L. Maerten <me@ltow.me>
2024-10-09 14:48:05 +02:00
Ygal Blum fc25a3a5fc Quadlet - prefer "param val" over "param=val" to allow env expansion
When possible use a generic function to add strings and booleans
Adjust tests

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-10-01 18:01:05 -04:00
Paul Holzinger abc4cfb049
quadlet: allow variables in PublishPort
There is no reason to validate the args here, first podman may change
the syntax so this is just duplication that may hurt us long term. It
also added special handling of some options that just do not make sense,
i.e. removing 0.0.0.0, podman should really be the only parser here. And
more importantly this prevents variables from being used.

Fixes #24081

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-01 10:07:20 +02:00
Jan Rodák de856dab99
Add --health-max-log-count, --health-max-log-size, --health-log-destination flags
These flags can affect the output of the HealtCheck log. Currently, when a container is configured with HealthCheck, the output from the HealthCheck command is only logged to the container status file, which is accessible via `podman inspect`.
It is also limited to the last five executions and the first 500 characters per execution.

This makes debugging past problems very difficult, since the only information available about the failure of the HealthCheck command is the generic `healthcheck service failed` record.

- The `--health-log-destination` flag sets the destination of the HealthCheck log.
  - `none`: (default behavior) `HealthCheckResults` are stored in overlay containers. (For example: `$runroot/healthcheck.log`)
  - `directory`: creates a log file named `<container-ID>-healthcheck.log` with JSON `HealthCheckResults` in the specified directory.
  - `events_logger`: The log will be written with logging mechanism set by events_loggeri. It also saves the log to a default directory, for performance on a system with a large number of logs.

- The `--health-max-log-count` flag sets the maximum number of attempts in the HealthCheck log file.
  - A value of `0` indicates an infinite number of attempts in the log file.
  - The default value is `5` attempts in the log file.
- The `--health-max-log-size` flag sets the maximum length of the log stored.
  - A value of `0` indicates an infinite log length.
  - The default value is `500` log characters.

Add --health-max-log-count flag

Signed-off-by: Jan Rodák <hony.com@seznam.cz>

Add --health-max-log-size flag

Signed-off-by: Jan Rodák <hony.com@seznam.cz>

Add --health-log-destination flag

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-09-25 14:01:35 +02:00
Steve Jibson 15bde1abdb Add DNS, DNSOption and DNSSearch to quadlet pod
Signed-off-by: Steve Jibson <steve@jibson.com>
2024-09-04 11:31:32 -06:00
Misaki Kasumi 71fd15726d quadlet: support container network reusing
Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
2024-08-30 21:35:21 +08:00
Ygal Blum 2b14db2af3 Quadlet - Support multiple image tags in .build files
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-08-29 15:07:49 -04:00
Jerome Degroote 7c5d8bec0d Add support for AddHost in quadlet .pod and .container
Signed-off-by: Jerome degroote <jeromedu59230@gmx.fr>
2024-08-26 14:32:08 +02:00
Jerome Degroote d55b12f70b Add support for IP in quadlet .pod files
Signed-off-by: Jerome degroote <jeromedu59230@gmx.fr>
2024-08-22 14:51:12 +02:00
openshift-merge-bot[bot] e7905122d7
Merge pull request #23679 from ruihe774/pod-userns
quadlet: support user mapping in pod unit
2024-08-22 12:33:43 +00:00
Misaki Kasumi 4fbfa7de6e quadlet: support user mapping in pod unit
Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
2024-08-22 09:41:06 +08:00
openshift-merge-bot[bot] 8be89caf46
Merge pull request #23675 from ruihe774/fix-pod-cgroups
Add key CgroupsMode in Quadlet container unit
2024-08-20 18:47:16 +00:00
Misaki Kasumi 1ccccde183 quadlet: add key CgroupsMode
Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
2024-08-20 22:09:36 +08:00
Misaki Kasumi e5c91ff03a quadlet: set infra name to %s-infra
e.g.: if the pod name is systemd-awd, the name of its infra container will be systemd-awd-infra

Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
2024-08-20 18:20:02 +08:00