diff --git a/pkg/cri/config/config.go b/pkg/cri/config/config.go index 279a2a56d..038ad19f5 100644 --- a/pkg/cri/config/config.go +++ b/pkg/cri/config/config.go @@ -74,11 +74,11 @@ type Runtime struct { // while using default snapshotters for operational simplicity. // See https://github.com/containerd/containerd/issues/6657 for details. Snapshotter string `toml:"snapshotter" json:"snapshotter"` - // SandboxMode defines which sandbox runtime to use when scheduling pods + // Sandboxer defines which sandbox runtime to use when scheduling pods // This features requires the new CRI server implementation (enabled by default in 2.0) // shim - means use whatever Controller implementation provided by shim (e.g. use RemoteController). // podsandbox - means use Controller implementation from sbserver podsandbox package. - SandboxMode string `toml:"sandbox_mode" json:"sandboxMode"` + Sandboxer string `toml:"sandboxer" json:"sandboxer"` } // ContainerdConfig contains toml config related to containerd @@ -383,8 +383,8 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) error { return errors.New("`privileged_without_host_devices_all_devices_allowed` requires `privileged_without_host_devices` to be enabled") } // If empty, use default podSandbox mode - if len(r.SandboxMode) == 0 { - r.SandboxMode = string(ModePodSandbox) + if len(r.Sandboxer) == 0 { + r.Sandboxer = string(ModePodSandbox) c.ContainerdConfig.Runtimes[k] = r } } diff --git a/pkg/cri/config/config_test.go b/pkg/cri/config/config_test.go index 171228e99..5c021857e 100644 --- a/pkg/cri/config/config_test.go +++ b/pkg/cri/config/config_test.go @@ -61,7 +61,7 @@ func TestValidateConfig(t *testing.T) { DefaultRuntimeName: RuntimeDefault, Runtimes: map[string]Runtime{ RuntimeDefault: { - SandboxMode: string(ModePodSandbox), + Sandboxer: string(ModePodSandbox), }, }, }, diff --git a/pkg/cri/config/config_unix.go b/pkg/cri/config/config_unix.go index 29476ee4c..76bbe9148 100644 --- a/pkg/cri/config/config_unix.go +++ b/pkg/cri/config/config_unix.go @@ -69,9 +69,9 @@ func DefaultConfig() PluginConfig { DefaultRuntimeName: "runc", Runtimes: map[string]Runtime{ "runc": { - Type: "io.containerd.runc.v2", - Options: m, - SandboxMode: string(ModePodSandbox), + Type: "io.containerd.runc.v2", + Options: m, + Sandboxer: string(ModePodSandbox), }, }, DisableSnapshotAnnotations: true, diff --git a/pkg/cri/server/container_create.go b/pkg/cri/server/container_create.go index b1bf08960..5c2e73267 100644 --- a/pkg/cri/server/container_create.go +++ b/pkg/cri/server/container_create.go @@ -275,7 +275,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta ) // When using sandboxed shims, containerd's runtime needs to know which sandbox shim instance to use. - if ociRuntime.SandboxMode == string(criconfig.ModeShim) { + if ociRuntime.Sandboxer == string(criconfig.ModeShim) { opts = append(opts, containerd.WithSandbox(sandboxID)) } diff --git a/pkg/cri/server/sandbox_run.go b/pkg/cri/server/sandbox_run.go index 6dbecdc38..9a55c04f1 100644 --- a/pkg/cri/server/sandbox_run.go +++ b/pkg/cri/server/sandbox_run.go @@ -352,7 +352,7 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox } // TODO: get rid of this. sandbox object should no longer have Container field. - if ociRuntime.SandboxMode == string(criconfig.ModePodSandbox) { + if ociRuntime.Sandboxer == string(criconfig.ModePodSandbox) { container, err := c.client.LoadContainer(ctx, id) if err != nil { return nil, fmt.Errorf("failed to load container %q for sandbox: %w", id, err) @@ -691,13 +691,13 @@ func (c *criService) getSandboxController(config *runtime.PodSandboxConfig, runt return nil, fmt.Errorf("failed to get sandbox runtime: %w", err) } // Validate mode - if err = ValidateMode(ociRuntime.SandboxMode); err != nil { + if err = ValidateMode(ociRuntime.Sandboxer); err != nil { return nil, err } // Use sandbox controller to delete sandbox - controller, exist := c.sandboxControllers[criconfig.SandboxControllerMode(ociRuntime.SandboxMode)] + controller, exist := c.sandboxControllers[criconfig.SandboxControllerMode(ociRuntime.Sandboxer)] if !exist { - return nil, fmt.Errorf("sandbox controller %s not exist", ociRuntime.SandboxMode) + return nil, fmt.Errorf("sandbox controller %s not exist", ociRuntime.Sandboxer) } return controller, nil }