From 19a588eeda50ffb452c15d3017d4872b12f0d916 Mon Sep 17 00:00:00 2001 From: Tim Allclair Date: Fri, 24 May 2019 15:30:34 -0700 Subject: [PATCH] Add a special-cased runtime handler for dockershim --- pkg/kubelet/dockershim/docker_sandbox.go | 2 +- test/e2e/common/runtimeclass.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/dockershim/docker_sandbox.go b/pkg/kubelet/dockershim/docker_sandbox.go index 8b156a79299..5d721148bb5 100644 --- a/pkg/kubelet/dockershim/docker_sandbox.go +++ b/pkg/kubelet/dockershim/docker_sandbox.go @@ -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) diff --git a/test/e2e/common/runtimeclass.go b/test/e2e/common/runtimeclass.go index be38fc3ff27..10b054aa38d 100644 --- a/test/e2e/common/runtimeclass.go +++ b/test/e2e/common/runtimeclass.go @@ -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) })