Skip to content
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

Initial sandbox API CRI integration (implement Controller.Start) #7228

Merged
merged 7 commits into from
Aug 5, 2022

Conversation

mxpv
Copy link
Member

@mxpv mxpv commented Jul 29, 2022

Sandbox API has Controller interface used to manage a sandbox instances lifecycle (kin of TaskService interface to manage tasks lifecycle). containerd shims that support sandbox API supposed to implement this interface at shim level. This way we can expose different sandbox implementations in containerd (like podsandbox aka pause container or microVM).

In case of CRI/Kube, primary user of the Controller interface is going to be our CRI plugin (which we forked in #7164 for sandbox work). Depending on CRI request, it'll call appropriate controller func (e.g. RunPodSandbox invokes Controller.Start, StopPodSandbox invokes Controller.Stop, etc).

So the end-goal is to have CRI rely on Controller interface instead of managing pod-sandbox directly. This PR starts refactoring and handles Controller.Start implementation. All relevant CRI code is now moved to podsandbox package and implements Start func to setup container spec and launch a task.

For pod-sandbox, we'll have an in-memory implementation. Once migrated, Controller interface will get ttrpcRemoteController, which will call-in shims instead.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@mxpv mxpv force-pushed the sb2 branch 2 times, most recently from 9dc253a to d1e6777 Compare July 29, 2022 21:00
@containerd containerd deleted a comment from k8s-ci-robot Jul 29, 2022
mxpv added 5 commits July 29, 2022 16:08
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@mxpv
Copy link
Member Author

mxpv commented Aug 1, 2022

/test pull-containerd-sandboxed-node-e2e

@containerd containerd deleted a comment from k8s-ci-robot Aug 1, 2022
@dmcgowan dmcgowan added this to the 1.7 milestone Aug 1, 2022
@mxpv mxpv requested review from fuweid and mikebrow August 1, 2022 20:12
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

metadata/sandbox.go Show resolved Hide resolved
pkg/cri/sbserver/podsandbox/container_linux.go Outdated Show resolved Hide resolved
pkg/cri/sbserver/podsandbox/controller.go Outdated Show resolved Hide resolved
}

func (c *Controller) Start(ctx context.Context, id string) (_ *api.ControllerStartResponse, retErr error) {
sandboxInfo, err := c.client.SandboxStore().Get(ctx, id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering that we should handle network here or not. 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have strong opinion on this. Since we can build on all platforms and turn it off, it's ok to keep it in CRI for now. We can brainstorm more on this.

@mxpv
Copy link
Member Author

mxpv commented Aug 2, 2022

@fuweid thanks for looking into this. I've added a few TODOs to follow up.

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

It is milestone.
Let's move it forward!

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small nit .. progress! let's move forward

pkg/cri/sbserver/helpers.go Show resolved Hide resolved
@mxpv mxpv merged commit 01a2b79 into containerd:main Aug 5, 2022
@mxpv mxpv deleted the sb2 branch August 5, 2022 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants