Add a special-cased runtime handler for dockershim

This commit is contained in:
Tim Allclair 2019-05-24 15:30:34 -07:00
parent 1fba88884b
commit 19a588eeda
2 changed files with 9 additions and 3 deletions

View File

@ -96,7 +96,7 @@ func (ds *dockerService) RunPodSandbox(ctx context.Context, r *runtimeapi.RunPod
} }
// Step 2: Create the sandbox container. // 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()) return nil, fmt.Errorf("RuntimeHandler %q not supported", r.GetRuntimeHandler())
} }
createConfig, err := ds.makeSandboxDockerConfig(config, image) createConfig, err := ds.makeSandboxDockerConfig(config, image)

View File

@ -38,6 +38,9 @@ const (
// PreconfiguredRuntimeHandler is the name of the runtime handler that is expected to be // PreconfiguredRuntimeHandler is the name of the runtime handler that is expected to be
// preconfigured in the test environment. // preconfigured in the test environment.
PreconfiguredRuntimeHandler = "test-handler" 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() { 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. // 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() { 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. // 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) pod := createRuntimeClassPod(f, rcName)
expectPodSuccess(f, pod) expectPodSuccess(f, pod)
}) })