-
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
Add pod annotations to container #4368
Add pod annotations to container #4368
Conversation
PTAL @zer0def |
LGTM, assuming that's the right spot to retain the info. I'll let other chime in on that part. |
cmd/podman/shared/create.go
Outdated
@@ -322,7 +322,7 @@ func configurePod(c *GenericCLIResults, runtime *libpod.Runtime, namespaces map[ | |||
if (namespaces["uts"] == cc.Pod) || (!c.IsSet("uts") && pod.SharesUTS()) { | |||
namespaces["uts"] = fmt.Sprintf("container:%s", podInfraID) | |||
} | |||
return namespaces, nil | |||
return namespaces, pod.ID(), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be either of these, in running state:
- infra container's ID
- if we don't have an infra container, the ID of whichever container is running with ContainerType ==
sandbox
(perhaps the first attached container to the pod could become the sandbox, but this may have drawbacks I'm absolutely oblivious to)
Only then the bundle config under /var/lib/containers/storage/overlay-containers/${INFRA_CONTAINER_ID}/userdata/config.json
exists for other containers in the same pod to latch onto. As far as I can tell, any container created without ContainerType=container
and an appropriate SandboxID will be created as a separate QEMU VM sandbox, to the degree Kata is concerned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the sounds of it @zer0def, it seems like we should only allow this kind of sharing if the sandbox container is an infra container. There is already mechanisms in place to guarentee the infra container isn't deleted before other containers in the pod, which seems like something that could effect kata.
For instance, if the first pod in the container is created, another is added (and attached to its vm) and the first is deleted, I'm pretty sure that container's config.json is going to be removed. Would that negatively effect the other containers in the pod?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the intended idea would be to have the infra container be the pod's sandbox container, but I wouldn't immediately dismiss other ideas, if there's sufficient motivation for doing so with careful execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I'll stick to an infra container for now
/hold |
17f3ce2
to
ed3eaf2
Compare
563fc76
to
1342d71
Compare
As of
I've also removed the complementing condition for
|
@haircommander Any update on this PR? |
1342d71
to
a53708a
Compare
a53708a
to
678969b
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haircommander, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This inevitably sets itself up for "why does it work on it's own and not through |
@zer0def could we make it work with play kube? |
☔ The latest upstream changes (presumably #4265) made this pull request unmergeable. Please resolve the merge conflicts. |
@rhatdan I'm not much of a golang coder, but since current changes revolve around |
I can take care of that later today |
Something like this does the trick, though I would deem it more of a hack than a proper solution, with code duplication and all.
|
@zer0def thanks, your approach was basically what I was going to do :) |
We have the annotations SandboxID, let's use them. This also allows kata containers to be created in pods and share a VM with the infra container. Note: as of now, this sharing only works if the pod has an infra container Signed-off-by: Peter Hunt <pehunt@redhat.com>
Signed-off-by: Peter Hunt <pehunt@redhat.com>
3d1f6a8
to
f920f93
Compare
Can confirm both cases of creating a pod with an infra container and |
/lgtm |
/hold cancel |
@haircommander Thanks for the PR. cc @giuseppe |
@amshinde right now, we're kind of using the infra container as a crutch (mostly because I don't really understand the needs of kata). Let's imagine pods and kata work without infra. if a pod is created without an infra container, the first container would become the owner of the vm (annotated as sandbox) and the other containers that are added to the pod attach to that vm (annotated as container). If the first container in the pod is removed (which it can be if it's not marked an infra), what happens to that VM? who should the other containers add as a reference for Relying on the infra container here is the most clear way to make sure there is a container running that holds the VM, that the other containers can always rely on joining to. is my understanding correct for how the kata VM works? |
You are right there. But Kata also does not rely on the pause container being the last one to exit iirc. |
@amshinde You can still create a pod without an infra container (which is also what would be, as you put it, "a uniquely generated one") by following these instructions coutresy of @mheon and substituting images and commands as you see fit. It's just unnecessarily tideous, on top of not providing namespace guarantees for other containers in the pod to rely on, as @haircommander outlined. Do mind that this PR hasn't yet been part of a stable release, in which case the behavior you're describing is expected as of the current latest stable, 1.6.3, because each container will be started as a separate VM due to not receiving appropriate container-type and sandbox-id annotations, unless explicitly specified by the end user. |
We have the annotations SandboxID and SandboxName, let's use them. This also allows kata containers to be created in pods
partial fix to #4353 (we don't need to add the annotations manually, but still need to disable selinux labeling manually)
Signed-off-by: Peter Hunt pehunt@redhat.com