mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #74757 from tallclair/runtimehandler-e2e
Add custom runtime handler e2e test
This commit is contained in:
commit
c8d6d7c0d0
@ -34,6 +34,7 @@ go_library(
|
||||
"projected_downwardapi.go",
|
||||
"projected_secret.go",
|
||||
"runtime.go",
|
||||
"runtimeclass.go",
|
||||
"secrets.go",
|
||||
"secrets_volume.go",
|
||||
"security_context.go",
|
||||
@ -50,6 +51,7 @@ go_library(
|
||||
"//pkg/kubelet:go_default_library",
|
||||
"//pkg/kubelet/events:go_default_library",
|
||||
"//pkg/kubelet/images:go_default_library",
|
||||
"//pkg/kubelet/runtimeclass/testing:go_default_library",
|
||||
"//pkg/kubelet/sysctl:go_default_library",
|
||||
"//pkg/security/apparmor:go_default_library",
|
||||
"//staging/src/k8s.io/api/autoscaling/v1:go_default_library",
|
||||
@ -83,6 +85,7 @@ go_library(
|
||||
"//vendor/github.com/onsi/gomega/types:go_default_library",
|
||||
"//vendor/golang.org/x/net/websocket:go_default_library",
|
||||
"//vendor/k8s.io/klog:go_default_library",
|
||||
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package node
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -34,7 +34,13 @@ import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = SIGDescribe("RuntimeClass", func() {
|
||||
const (
|
||||
// PreconfiguredRuntimeHandler is the name of the runtime handler that is expected to be
|
||||
// preconfigured in the test environment.
|
||||
PreconfiguredRuntimeHandler = "test-handler"
|
||||
)
|
||||
|
||||
var _ = Describe("[sig-node] RuntimeClass", func() {
|
||||
f := framework.NewDefaultFramework("runtimeclass")
|
||||
|
||||
It("should reject a Pod requesting a non-existent RuntimeClass", func() {
|
||||
@ -50,6 +56,16 @@ var _ = SIGDescribe("RuntimeClass", func() {
|
||||
expectSandboxFailureEvent(f, pod, handler)
|
||||
})
|
||||
|
||||
// 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")
|
||||
|
||||
rcName := createRuntimeClass(f, "preconfigured-handler", PreconfiguredRuntimeHandler)
|
||||
pod := createRuntimeClassPod(f, rcName)
|
||||
expectPodSuccess(f, pod)
|
||||
})
|
||||
|
||||
It("should reject a Pod requesting a deleted RuntimeClass", func() {
|
||||
rcName := createRuntimeClass(f, "delete-me", "runc")
|
||||
rcClient := f.ClientSet.NodeV1beta1().RuntimeClasses()
|
||||
@ -74,8 +90,6 @@ var _ = SIGDescribe("RuntimeClass", func() {
|
||||
pod := createRuntimeClassPod(f, rcName)
|
||||
expectSandboxFailureEvent(f, pod, fmt.Sprintf("\"%s\" not found", rcName))
|
||||
})
|
||||
|
||||
// TODO(tallclair): Test an actual configured non-default runtimeHandler.
|
||||
})
|
||||
|
||||
// createRuntimeClass generates a RuntimeClass with the desired handler and a "namespaced" name,
|
@ -14,7 +14,6 @@ go_library(
|
||||
"pod_gc.go",
|
||||
"pods.go",
|
||||
"pre_stop.go",
|
||||
"runtimeclass.go",
|
||||
"security_context.go",
|
||||
"ssh.go",
|
||||
"ttlafterfinished.go",
|
||||
@ -23,13 +22,10 @@ go_library(
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/kubelet/apis/stats/v1alpha1:go_default_library",
|
||||
"//pkg/kubelet/events:go_default_library",
|
||||
"//pkg/kubelet/runtimeclass/testing:go_default_library",
|
||||
"//pkg/master/ports:go_default_library",
|
||||
"//pkg/util/slice:go_default_library",
|
||||
"//staging/src/k8s.io/api/batch/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/fields:go_default_library",
|
||||
@ -44,7 +40,6 @@ go_library(
|
||||
"//test/utils/image:go_default_library",
|
||||
"//vendor/github.com/onsi/ginkgo:go_default_library",
|
||||
"//vendor/github.com/onsi/gomega:go_default_library",
|
||||
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user