Closed cob-web-corner closed 2 weeks ago
Just found this:
https://github.com/containers/podlet/pull/55
and tried podlet --absolute-host-paths compose --kube
but I'm still getting relative paths in the yaml output
I will note, this is translating from relative to absolute paths when using this /usr/lib/systemd/system-generators/podman-system-generator --user --dryrun
From podlet --help
:
-a, --absolute-host-paths [<RESOLVE_DIR>]
Convert relative host paths to absolute paths.
Relative host paths in generated Quadlet files are resolved using the given directory or the current working
directory. For `podlet compose`, the parent directory of the compose file is used as the default if the compose file
is not read from stdin.
All host paths are also cleaned to remove interior `/../`, `/./`, and `//`.
When using `podlet compose --pod`, modifying paths in generated Kubernetes YAML files is not supported.
Note that only host paths not in the `PodmanArgs=` Quadlet option will be modified.
Podlet will return an error if the current working directory cannot be read, or if the given directory path is not
absolute.
See that it says "Quadlet files", not Kubernetes YAML. The reason for this is that it would be significantly more complicated to do for Kubernetes YAML files. The types are controlled by the k8s-openapi
library, and they are not the correct to work with what I did to get that feature working with Quadlet files (the paths are String
s, not PathBuf
s). It would also be a lot of additional work to find all the host paths and potentially parse them out from other strings. I would gladly accept a PR that figures out a way around the limitations and does the work, but I don't have the time for it.
Note that Podman does work Kubernetes YAML that has relative paths. The SetWorkingDirectory=
option is all about how relative paths should be resolved.
Just noticed in the help that it says in the 4th paragraph podlet compose --pod
instead of --kube
like it should.
It would also be a lot of additional work to find all the host paths and potentially parse them out from other strings. I would gladly accept a PR that figures out a way around the limitations and does the work, but I don't have the time for it.
I get it, other more important things to work on and this isn't a show stopper and the SetWorkingDirectory
option is available
Just noticed in the help that it says in the 4th paragraph
podlet compose --pod
instead of--kube
like it should.
Okay glad I'm not crazy I read that about 20 times before I saw your comment
Thanks for the response!
podlet compose --kube docker-compose.yaml
The compose:
Resulting yaml
Obviously not a whole real-example but just to demonstrate. The only way the resulting kube file can be used in a corresponding
.kube
service is by using absolute paths. During the podlet run it should convert these pathsVersion