329 Commits

Author SHA1 Message Date
f293c1a179 Initial implementation of podman quadlet commands
This adds `podman quadlet list`, `podman quadlet install`,
`podman quadlet rm` and `podman quadlet print`.

Signed-off-by: Matt Heon <mheon@redhat.com>
Co-authored-by: flouthoc <flouthoc.git@gmail.com>
Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-07-18 13:57:11 -07:00
439448c287 Quadlet - add support for the Policy key for .image files
Resolves: #26446

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-07-10 13:06:38 -04:00
cd807f8ff6 Quadlet - print warning when fail to parse
Fixes: #26542

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-07-07 14:49:32 -04:00
31b4efcaec warn instead of error, lift logic to main.go
Signed-off-by: Evan Miller <miller.evan815@gmail.com>
2025-07-02 18:23:00 -07:00
4b1f7bcb9a Quadlet - Error when units define User, Group, or DynamicUser in Service group
Fixes: #26543

Signed-off-by: Evan Miller <miller.evan815@gmail.com>
2025-07-02 00:34:46 -07:00
72393c1c53 Merge pull request #26522 from ygalblum/quadlet-pod-service-environment
Quadlet - Do not override existing Environment in Service group for Pod units
2025-07-01 19:25:06 +00:00
43b74b1754 Merge pull request #26322 from NotSoFancyName/issue-26247
quadlet: handle generate environment params that inherit from host
2025-06-30 11:44:33 +00:00
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
7808625785 Merge pull request #26472 from Luap99/quadlet-nologrus
quadlet: remove indirect logrus import
2025-06-19 19:45:24 +00:00
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
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
2b6c477884 quadlet: handle generate environment params that inherit from host
Fixes: #26247

Signed-off-by: Volodymyr Pankin <volopank@gmail.com>
2025-06-10 20:50:13 +02:00
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
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
09d9d3e26b Revert "Quadlet - fix pod name to depend on the name of the generate service"
This reverts commit 4f38c2fea2f945388491c35327d905cba36f8a5b.

Fixes: #26105
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2025-05-12 09:33:16 -04:00
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
400a9a528b Merge pull request #25722 from l0rd/fix-hyperv-volumes-with-space
Fix machines failing to start when a volume's path contains spaces
2025-05-02 14:03:15 +00:00
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
8e6ecb97c9 Fix running machines with volumes containing spaces
Machines configured to mount local paths containing
spaces failed to start on Hyper-V and silently failed
to mount the folder on macOS/Linux.

On Windows/hyperv, where local paths are mounted
running a 9p client inside the VM, the local host
path needs to be surrounding with quotation marks
before using in a `podman machine ssh ...` command.

A similar behavior happened on Linux/QEMU where the
path was used in a SSH command to mount the folder
using virtiofs. Quoting the path when buidling the
command arguments fixed the problem.

On macOS/libkit,applehv the path was written as is
in a systemd unit name to instruct how to mount it.
Escaping space chars so that they are are parsed
successfully fixed this:
```diff
-- enable path with spaces.mount
++ enable path\x20with\x20spaces.mount
```

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

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-04-30 08:54:42 +02:00
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
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
802fc15b1e Add Label to quadlet pod
Signed-off-by: Robin Heinemeier <sunnerlp@gmail.com>
2025-04-24 13:37:42 +00:00
5372c15bf8 Merge pull request #25892 from Regis-Caelum/quadlet-pod-hostname
Add HostName to quadlet pod
2025-04-22 12:52:04 +00:00
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
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
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
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
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
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
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
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
cc4d904dd2 Fix QF1012 staticcheck warnings
> QF1012: Use fmt.Fprintf(...) instead of WriteString

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
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
0105131b5c Fix QF1003: could use tagged switch" staticcheck warning
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
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
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
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
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
04e6488315 Merge pull request #25011 from AhmedMoalla/fix-wrongly-ported-cunescape_one
Fix unescaping octal escape sequence in values of Quadlet unit files
2025-01-15 11:44:56 +00:00
68f29df602 Fix unescaping octal escape sequence in values of Quadlet unit files
Signed-off-by: Ahmed Moalla <ahmed.moalla@gmail.com>
2025-01-14 23:21:47 +01:00
75b4a1b2aa add support to ; for comments in unit files as per systemd documentation
Signed-off-by: Ahmed Moalla <ahmed.moalla@gmail.com>
2025-01-13 14:20:24 +01:00
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
3cffc6bcaf Merge pull request #24825 from giuseppe/simplify-systemd-parser
systemd: simplify parser and fix infinite loop
2024-12-13 18:47:03 +00:00
64e94efb95 systemd: simplify parser and fix infinite loop
This commit simplifies the systemd parser logic, and it solves an
infinite loop when using a continuation line.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-12-12 20:45:23 +01:00
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
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
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
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
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
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