mirror of
https://github.com/containerd/containerd.git
synced 2026-11-06 05:17:02 +00:00
A runtime handler can name its shim binary with runtime_path. The task service replaces the runtime name with that path and the podsandbox controller passes it to the pause task, but the shim sandboxer never saw it: CRI stored only the runtime type in the sandbox record and the shim controller started the binary resolved from that type. Add a RuntimePath create option to the sandbox controller, have the shim controller start that binary when it is set (the shim manager already accepts an absolute path in place of a runtime name), and pass it from CRI. The gRPC proxy cannot carry it, since ControllerCreateRequest has no field for it, so a remote sandboxer logs a warning instead. Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
/*
|
|
Copyright The containerd Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package proxy
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/containerd/errdefs"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/containerd/containerd/v2/core/sandbox"
|
|
)
|
|
|
|
// A failing create option ends Create before the request is sent: the
|
|
// controller has no client here, so getting past the options would panic.
|
|
func TestCreateOptionError(t *testing.T) {
|
|
c := NewSandboxController(nil, "remote")
|
|
err := c.Create(context.Background(), sandbox.Sandbox{ID: "sb"}, sandbox.WithRuntimePath("containerd-shim-example-v1"))
|
|
require.ErrorIs(t, err, errdefs.ErrInvalidArgument)
|
|
}
|