-
Notifications
You must be signed in to change notification settings - Fork 3.8k
sandbox: podsandbox controller init its own client #9275
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
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.
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.
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.
done
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
Or could this be a migration now
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.
3cd0b26 to
80e7687
Compare
80e7687 to
d8acc17
Compare
fuweid
left a comment
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.
LGTM
|
@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>
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.