Skip to content

Conversation

@abel-von
Copy link
Contributor

To break the cyclic dependency of cri plugin and podsandbox plugin, we define a new plugin type of SandboxesServicePlugin and when cri init it's own client, it will add the all the controllers by get them from the SandboxesServicePlugin.
when podsandbox controller init it's own client, it do not includes the SandboxesServicePlugin as in memory service.

@k8s-ci-robot
Copy link

Hi @abel-von. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

ID: "sandbox-controllers",
Requires: []plugin.Type{
plugins.ServicePlugin,
plugins.SandboxesServicePlugin,
Copy link
Member

Choose a reason for hiding this comment

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

This one could just depend on SandboxControllerPlugin directly. The reason we had the services indirection before was because we either had services which did not have an underlying non-grpc interface or they were wrapped in the metadata store. It seems like the sandbox controller plugins can just be used directly and doesn't need the service plugin layer at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@abel-von
Copy link
Contributor Author

@dmcgowan I add a sandboxService into cri to fix the unit test regression issue in #8268, please take a look.

@abel-von abel-von force-pushed the sandbox-plugin-1019 branch from e74f97e to 29b393c Compare October 20, 2023 08:50
services.go Outdated
}
}

func WithSandboxers(ic *plugin.InitContext) ClientOpt {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the name WithSandboxControllers makes more sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to WithInMemorySandboxControllers

"github.com/containerd/log"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"

"github.com/containerd/containerd/pkg/cri/annotations"
Copy link
Member

Choose a reason for hiding this comment

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

We don't have goimport lint yet. But I think you should group github.com/containerd/* packages together.

Copy link
Member

Choose a reason for hiding this comment

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

And it's weird to put the cri-api deps in the config. What about holding the helper GetSandboxRuntime in the pkg/cri/utls?

Copy link
Contributor Author

@abel-von abel-von Oct 20, 2023

Choose a reason for hiding this comment

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

We don't have goimport lint yet. But I think you should group github.com/containerd/* packages together.

It seems the rule of goimports organize imports in 3 groups, 1. packages in runtime, like "io", "fmt", 2. package of other projects, 3. packages in the same project. the "github.com/containerd/log" seems to be "package in other project", because it is an independent github project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And it's weird to put the cri-api deps in the config. What about holding the helper GetSandboxRuntime in the pkg/cri/utls?

I tried but it will make a cyclic dependency if we define GetSandboxRuntime in github.com/containerd/containerd/pkg/cri/util

if err != nil {
return nil, fmt.Errorf("failed to get sandbox runtime: %w", err)
}
return c.client.SandboxController(ociRuntime.Sandboxer), nil
Copy link
Member

Choose a reason for hiding this comment

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

REF: https://github.com/containerd/containerd/pull/8268/files#r1219996770

I think you should add the SandboxMode back and mark it as deprecated and then update RELEASE.md.
We should delete the SandboxMode in v2.1

Copy link
Member

Choose a reason for hiding this comment

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

Or could this be a migration now

Copy link
Contributor Author

@abel-von abel-von Oct 20, 2023

Choose a reason for hiding this comment

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

I think it is a good idea. @dmcgowan I have defined a ConfigMigration in cri plugin in my local codes, I can add a migration from SandboxMode to Sandboxer in that commit, and submit it later. Is it ok? @fuweid

@abel-von abel-von force-pushed the sandbox-plugin-1019 branch 3 times, most recently from 3cd0b26 to 80e7687 Compare October 23, 2023 08:28
@abel-von
Copy link
Contributor Author

@dmcgowan @fuweid please take a look again, sorry to bother you because I have many subsequent PRs to submit, and I am willing to merge them before 2.0.

@abel-von abel-von force-pushed the sandbox-plugin-1019 branch from 80e7687 to d8acc17 Compare November 6, 2023 03:10
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

@abel-von
Copy link
Contributor Author

@dmcgowan could you please a look again?

To break the cyclic dependency of cri plugin and podsandbox plugin,
we define a new plugin type of SandboxesServicePlugin and when cri init
it's own client, it will add the all the controllers by get them from
the SandboxesServicePlugin.
when podsandbox controller init it's client, it will not Require the
SandboxesServicePlugin.

Signed-off-by: Abel Feng <fshb1988@gmail.com>
Signed-off-by: Abel Feng <fshb1988@gmail.com>
so that we can add a fakeSandboxService to the criService in tests.

Signed-off-by: Abel Feng <fshb1988@gmail.com>
@abel-von abel-von force-pushed the sandbox-plugin-1019 branch from d8acc17 to 32bf805 Compare November 15, 2023 01:32
@dmcgowan dmcgowan added this pull request to the merge queue Nov 15, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 15, 2023
@fuweid fuweid added this pull request to the merge queue Nov 16, 2023
Merged via the queue into containerd:main with commit 09723a6 Nov 16, 2023
@abel-von abel-von mentioned this pull request Nov 28, 2023
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants