-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Podman API takes a SpecGenerator rather than CreateOptions, why? #14239
Comments
I am fine with this, but I will leave it up to @mheon for approval. |
@baude I definitely see why its specgen from the podman-remote side of things: since we go through |
this is a major code cleanup and redundancy removal due to the fact that the API can now use the infra container spec as its main point of unmarshaling. This removes a huge weight off of pod creation and allows the pod cretion process to be even easier than last summers infra rework put in place just getting rolling :) resolves containers#14239 Signed-off-by: Charlie Doern <[email protected]>
A friendly reminder that this issue had no activity for 30 days. |
@cdoern what is going on with this issue? |
@rhatdan I am working on getting this implemented. It is a 5.0 feature so we have time, but it involves a lot of redesign so I thought I would get started. |
If possible, lets try our best to not break existing APIs. If users use the libpod API directly, they should not break on each (~yearly) major version bump. |
@vrothberg I am trying to make it so that specifying |
That would be great, thanks! |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
@cdoern @vrothberg Please update what is going on here? |
I am still working on this, slated for a 5.0 timeline so I did not want to get too far ahead too quickly because this will be a major structural change @rhatdan |
Retagging 6.0 |
Discussed in #12820
Originally posted by cdoern January 11, 2022
@containers/podman-maintainers I have been grappling with this for a while when implementing different pod create options...
The last domino in redesigning the infra container for easier implementation of pod creation options seems to be podman-remote as well as the API itself.
Currently in cmd/podman/pods/create.go, the infra container's options are formed from the command line and turned into a spec generator in that file. If the user is executing the
podman pod create
command via podman-remote, all of this work is basically thrown out.This is because pkg/api/handlers/libpod/pods.go
PodCreate
takes a PodSpecGenerator as the request input, decoding directly into one of these structs. This causes the process of creating the pod to be duplicated, filling out the specgen again, and manually inputting the infra information since we do not have flags to place the create options.This also causes unecessary fields to be added to the PodSpecGenerator that are really container SpecGenerator fields that need to be carried over for the remote API...
A good example I am working on now is SysCtls:
FillOutSpecGen
, validating it as a []string map.Step 1 is all we need for a regular podman and podman-remote approach technically, steps 2 and 3 are only done because of the requirements of the API
the original ContainerCreateOption of type []string is put back into the PodCreateOptions and then re validated and put into the PodSpecgen as a []string map for the remote path.
pkg/api/handlers/libpod/pods.go then receives the PodSpecgen, ignoring infra's if it is already filled out, and recreates infra's SpecGenerator manually and by marshaling/unmarshaling things that happen to match
This is a redundant process for every case except for the direct API usage.
I would like to have a conversation about either:
using create options rather than a Specgen for the API input
making a less roundabout way of populating a
ContainerCreateOptions
struct so infra is formed properly. Maybe there is a way to somehow map a PodSpecgen back to ContainerCreateOptions?Looking at cmd/podman and pkg/api shows some commonality that should somehow be joined, and aren't the create options more "user friendly" instead of exposing the Specgen to the API users?
I am converting this to an issue as it is exemplified with issues like #14233. The main issue here is that the work done for the infra container redesign basically is undone by the tunnel path since
InfraContainerSpec
withinPodSpecGen
cannot be marshalled because if it was, it would expose too many options to user of remote pod create. I think we should convert the API to using create options across the map rather than a specgen.The text was updated successfully, but these errors were encountered: