sandbox: podsandbox controller init its own client#9275
sandbox: podsandbox controller init its own client#9275fuweid merged 3 commits intocontainerd:mainfrom
Conversation
|
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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, |
There was a problem hiding this comment.
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.
062353a to
b2879c9
Compare
6a71662 to
e74f97e
Compare
e74f97e to
29b393c
Compare
services.go
Outdated
| } | ||
| } | ||
|
|
||
| func WithSandboxers(ic *plugin.InitContext) ClientOpt { |
There was a problem hiding this comment.
Maybe the name WithSandboxControllers makes more sense.
There was a problem hiding this comment.
changed to WithInMemorySandboxControllers
pkg/cri/config/config.go
Outdated
| "github.com/containerd/log" | ||
| runtime "k8s.io/cri-api/pkg/apis/runtime/v1" | ||
|
|
||
| "github.com/containerd/containerd/pkg/cri/annotations" |
There was a problem hiding this comment.
We don't have goimport lint yet. But I think you should group github.com/containerd/* packages together.
There was a problem hiding this comment.
And it's weird to put the cri-api deps in the config. What about holding the helper GetSandboxRuntime in the pkg/cri/utls?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
pkg/cri/server/sandbox_service.go
Outdated
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get sandbox runtime: %w", err) | ||
| } | ||
| return c.client.SandboxController(ociRuntime.Sandboxer), nil |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Or could this be a migration now
3cd0b26 to
80e7687
Compare
80e7687 to
d8acc17
Compare
|
@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 <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
so that we can add a fakeSandboxService to the criService in tests. Signed-off-by: Abel Feng <[email protected]>
d8acc17 to
32bf805
Compare
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.