Skip to content

Conversation

@mxpv
Copy link
Member

@mxpv mxpv commented Sep 19, 2023

This PR refactors CRI service to run image service, runtime service, and pod sandbox controller as containerd plugins (previously these were instantiated manually). The former one is a prerequisite for work happening in #8268.

This change introduces cri-base internal plugin to maintain common dependencies between CRI (config, stores, etc) services. Higher level GRPC plugins add it as a dependency.

❯ sudo ./bin/ctr plugins ls | grep cri
io.containerd.internal.v1              cri-base                     darwin/arm64/v8    ok
io.containerd.grpc.v1                  cri-image-service            -                  ok
io.containerd.grpc.v1                  cri-runtime-service          -                  ok
io.containerd.grpc.v1                  cri-podsandbox-controller    -                  ok

Dependencies:

CRI base (loads configuration and validates environment)
^   ^---- Image CRI service
|           ^
|           |
|--------- Runtime CRI service (depends on base + calls image service)
|           ^
|           |
+--------- Pod sandbox service (depends on base + runtime service (events)).

@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@mxpv
Copy link
Member Author

mxpv commented Sep 19, 2023

/test all

criBase := criBasePlugin.(*base.CRIBase)

// Get image service.
criImagePlugin, err := ic.GetByID(plugin.GRPCPlugin, "cri-image-service")
Copy link
Member

Choose a reason for hiding this comment

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

This is not a safe dependency. I'm trying to carve out the client dependency and image service. If we define the interface needed here, we can probably break this out cleaner.

Copy link
Member Author

Choose a reason for hiding this comment

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

Briefly synced offline
I don't think there is a clean way to define these dependencies without reworking plugin/ package (or without breaking changes in configuration). Do you want to postpone this PR until we figure something out or its fine to leave a TODO for follow up work and move on with further decoupling?

@mxpv mxpv force-pushed the deps branch 7 times, most recently from e601dbc to cd74f65 Compare September 20, 2023 19:04
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>

// Base plugin that other CRI services depend on.
plugin.Register(&plugin.Registration{
Type: plugin.GRPCPlugin,
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems plugin.GRPCPlugin should implements a grpc interface, but CRIBase does not.

Requires: []plugin.Type{
plugin.EventPlugin,
plugin.ServicePlugin,
plugin.NRIApiPlugin,
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems NRIAPI is depended by cri-runtime-service only, shall we move the requirements to there?

@abel-von
Copy link
Contributor

abel-von commented Oct 9, 2023

Can I cherry-pick this commit to move on the work to split the cri plugins and make a clean podsandbox plugin?

@abel-von
Copy link
Contributor

abel-von commented Oct 9, 2023

CRI base (loads configuration and validates environment)
^   ^---- Image CRI service
|           ^
|           |
|--------- Runtime CRI service (depends on base + calls image service)
|           ^
|           |
+--------- Pod sandbox service (depends on base + runtime service (events)).

It seems Runtime CRI service should depends on Pod sandbox service as one of it's sandbox controller.

@mxpv
Copy link
Member Author

mxpv commented Oct 9, 2023

Can I cherry-pick this commit

Don't cherry-pick those yet, this PR needs some more work after #9141 and #9152 get merged.

@mxpv
Copy link
Member Author

mxpv commented Oct 12, 2023

Closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants