mirror of https://github.com/k3s-io/k3s
Add a special-cased runtime handler for dockershim
parent
1fba88884b
commit
19a588eeda
|
@ -96,7 +96,7 @@ func (ds *dockerService) RunPodSandbox(ctx context.Context, r *runtimeapi.RunPod
|
|||
}
|
||||
|
||||
// Step 2: Create the sandbox container.
|
||||
if r.GetRuntimeHandler() != "" {
|
||||
if r.GetRuntimeHandler() != "" && r.GetRuntimeHandler() != runtimeName {
|
||||
return nil, fmt.Errorf("RuntimeHandler %q not supported", r.GetRuntimeHandler())
|
||||
}
|
||||
createConfig, err := ds.makeSandboxDockerConfig(config, image)
|
||||
|
|
|
@ -38,6 +38,9 @@ const (
|
|||
// PreconfiguredRuntimeHandler is the name of the runtime handler that is expected to be
|
||||
// preconfigured in the test environment.
|
||||
PreconfiguredRuntimeHandler = "test-handler"
|
||||
// DockerRuntimeHandler is a hardcoded runtime handler that is accepted by dockershim, and
|
||||
// treated equivalently to a nil runtime handler.
|
||||
DockerRuntimeHandler = "docker"
|
||||
)
|
||||
|
||||
var _ = Describe("[sig-node] RuntimeClass", func() {
|
||||
|
@ -59,9 +62,12 @@ var _ = Describe("[sig-node] RuntimeClass", func() {
|
|||
// This test requires that the PreconfiguredRuntimeHandler has already been set up on nodes.
|
||||
It("should run a Pod requesting a RuntimeClass with a configured handler [NodeFeature:RuntimeHandler]", func() {
|
||||
// The built-in docker runtime does not support configuring runtime handlers.
|
||||
framework.SkipIfContainerRuntimeIs("docker")
|
||||
handler := PreconfiguredRuntimeHandler
|
||||
if framework.TestContext.ContainerRuntime == "docker" {
|
||||
handler = DockerRuntimeHandler
|
||||
}
|
||||
|
||||
rcName := createRuntimeClass(f, "preconfigured-handler", PreconfiguredRuntimeHandler)
|
||||
rcName := createRuntimeClass(f, "preconfigured-handler", handler)
|
||||
pod := createRuntimeClassPod(f, rcName)
|
||||
expectPodSuccess(f, pod)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue