containers / podlet

Generate Podman Quadlet files from a Podman command, compose file, or existing object
https://crates.io/crates/podlet
Mozilla Public License 2.0
322 stars 10 forks source link

Support for generating .pod files #35

Closed hakong closed 6 months ago

hakong commented 6 months ago

Can support for .pod files be added? I don't see an option for that at the moment.

https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html#pod-units-pod

ps. Support for the Pod= parameter seems to have been added sometime after 4.6.1 since it's not working on 4.6.1:

Client:       Podman Engine
Version:      4.6.1
API Version:  4.6.1
Go Version:   go1.20.10
Built:        Sat Dec  2 10:05:24 2023
OS/Arch:      linux/amd64
converting "grafana.container": unsupported key 'Pod' in group 'Container' in /home/xyz/.config/containers/systemd/grafana.container

grafana.container:

[Container]
Image=docker.io/xyz/grafana:latest
Environment=DATABASE_USER=.....
PublishPort=3000:3000
Volume=xyz-grafana-data:/var/lib/grafana
Pod=xyz.pod

[Service]
Restart=always

[Install]
WantedBy=default.target

xyz.pod:

[Pod]
PodName=xyz
k9withabone commented 6 months ago

From my understanding, .pod files will be a part of podman v5.0.0, which is still being worked on. The podman docs aren't very clear on this but the latest version is actually built from podman's main branch. If you want the newest released version of the docs you have to switch to the stable version.

I am planning to eventually support .pod files for compose by moving the current functionality of the --pod flag (generating Kubernetes YAML) of the podlet compose command to --kube. Then use --pod for generating a .pod file and linking the generated .container files to it. However, it is a bit more complicated as user namespace and network settings (e.g. ports to publish) have to be defined on the pod, not the container.

In addition, I will add a podlet podman pod create command similar to the other podman commands.

k9withabone commented 6 months ago

I'm going to close this for now. Once podman v5.0.0 is released I'll create an issue for its new features that podlet should support, like .pod files.