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
318 stars 10 forks source link

[Feat. Req.] Add option to support older podman versions? #45

Closed cyqsimon closed 6 months ago

cyqsimon commented 6 months ago

Many point-release distros may ship older versions of podman. It would be nice if the newest version of podlet can generate a quadlet file that's compatible with an older version of podman on demand with an option. Something like this:

podlet --compat=4.6 compose

On the technical side, I know of the obake crate that allows versioned structs. Perhaps this is something worth looking into, although I cannot say for sure how applicable it will be to this specific situation.

k9withabone commented 6 months ago

I'm not sure maintaining multiple versioned structs is the way to go here. It would add too much complexity and cognitive overhead.

I'll add this as a "best effort" feature. The struct representing the quadlet (at the moment quadlet::File and quadlet::Resource) will be changed in place, moving new options to PodmanArgs=. The generated quadlet may not be optimal. Additionally, an error may be returned when downgrading.

cyqsimon commented 6 months ago

I can perhaps send a PR for this. Will look into this over the weekend.

k9withabone commented 6 months ago

I actually mostly finished it already. Wasn't as hard as I thought it would be. I'll post a PR later today or tomorrow. Once I post it, when you get the chance, could you take a look at it to see if it fits your expectations?

cyqsimon commented 6 months ago

That's awesome. Thanks for the great work. I'm happy to help with the review.