Fresh dep ensure

This commit is contained in:
Mike Cronce
2018-11-26 13:23:56 -05:00
parent 93cb8a04d7
commit 407478ab9a
9016 changed files with 551394 additions and 279685 deletions

View File

@ -4,6 +4,7 @@ go_library(
name = "go_default_library",
srcs = [
"apparmor.go",
"crictl.go",
"events.go",
"framework.go",
"kubelet.go",
@ -12,6 +13,7 @@ go_library(
"pod_gc.go",
"pods.go",
"pre_stop.go",
"runtimeclass.go",
"security_context.go",
"ssh.go",
],
@ -19,22 +21,27 @@ 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",
"//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",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//test/e2e/common:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/utils:go_default_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/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

13
vendor/k8s.io/kubernetes/test/e2e/node/README.md generated vendored Normal file
View File

@ -0,0 +1,13 @@
# WARNING: Do not add tests in this directory
There are two types of end-to-end tests in Kubernetes:
* [Cluster end-to-end tests](https://git.k8s.io/community/contributors/devel/e2e-tests.md)
* [Node end-to-end
tests](https://github.com/kubernetes/community/blob/master/contributors/devel/e2e-node-tests.md)
Tests located in `${KUBE_ROOT}/test/e2e/common` are shared by both Cluster
and Node E2E test jobs. Tests in `${KUBE_ROOT}/test/e2e_node` are exclusively
owned by Node E2E. *If you want to add a test, most likely than not, you want
to add the test to one of the two directories mentioned above.* If you are
unsure, please check with the OWNER of the directory. This directory currently
contains misplaced and legacy tests; they will be cleaned up in the future.

73
vendor/k8s.io/kubernetes/test/e2e/node/crictl.go generated vendored Normal file
View File

@ -0,0 +1,73 @@
/*
Copyright 2018 The Kubernetes 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 node
import (
"fmt"
"strings"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo"
)
var _ = SIGDescribe("crictl", func() {
f := framework.NewDefaultFramework("crictl")
BeforeEach(func() {
// `crictl` is not available on all cloud providers.
framework.SkipUnlessProviderIs("gce", "gke")
// The test requires $HOME/.ssh/id_rsa key to be present.
framework.SkipUnlessSSHKeyPresent()
})
It("should be able to run crictl on the node", func() {
// Get all nodes' external IPs.
By("Getting all nodes' SSH-able IP addresses")
hosts, err := framework.NodeSSHHosts(f.ClientSet)
if err != nil {
framework.Failf("Error getting node hostnames: %v", err)
}
testCases := []struct {
cmd string
}{
{`sudo crictl version`},
{`sudo crictl info`},
}
for _, testCase := range testCases {
// Choose an arbitrary node to test.
host := hosts[0]
By(fmt.Sprintf("SSH'ing to node %q to run %q", host, testCase.cmd))
result, err := framework.SSH(testCase.cmd, host, framework.TestContext.Provider)
stdout, stderr := strings.TrimSpace(result.Stdout), strings.TrimSpace(result.Stderr)
if err != nil {
framework.Failf("Ran %q on %q, got error %v", testCase.cmd, host, err)
}
// Log the stdout/stderr output.
// TODO: Verify the output.
if len(stdout) > 0 {
framework.Logf("Got stdout from %q:\n %s\n", host, strings.TrimSpace(stdout))
}
if len(stderr) > 0 {
framework.Logf("Got stderr from %q:\n %s\n", host, strings.TrimSpace(stderr))
}
}
})
})

View File

@ -17,7 +17,6 @@ limitations under the License.
package node
import (
"fmt"
"strconv"
"time"
@ -36,6 +35,11 @@ import (
var _ = SIGDescribe("Events", func() {
f := framework.NewDefaultFramework("events")
/*
Release : v1.9
Testname: Pod events, verify event from Scheduler and Kubelet
Description: Create a Pod, make sure that the Pod can be queried. Create a event selector for the kind=Pod and the source is the Scheduler. List of the events MUST be at least one. Create a event selector for kind=Pod and the source is the Kubelet. List of the events MUST be at least one. Both Scheduler and Kubelet MUST send events when scheduling and running a Pod.
*/
framework.ConformanceIt("should be sent by kubelets and the scheduler about pods scheduling and running ", func() {
podClient := f.ClientSet.CoreV1().Pods(f.Namespace.Name)
@ -84,7 +88,7 @@ var _ = SIGDescribe("Events", func() {
if err != nil {
framework.Failf("Failed to get pod: %v", err)
}
fmt.Printf("%+v\n", podWithUid)
framework.Logf("%+v\n", podWithUid)
var events *v1.EventList
// Check for scheduler event about the pod.
By("checking for scheduler event about the pod")
@ -101,7 +105,7 @@ var _ = SIGDescribe("Events", func() {
return false, err
}
if len(events.Items) > 0 {
fmt.Println("Saw scheduler event for our pod.")
framework.Logf("Saw scheduler event for our pod.")
return true, nil
}
return false, nil
@ -121,7 +125,7 @@ var _ = SIGDescribe("Events", func() {
return false, err
}
if len(events.Items) > 0 {
fmt.Println("Saw kubelet event for our pod.")
framework.Logf("Saw kubelet event for our pod.")
return true, nil
}
return false, nil

View File

@ -133,7 +133,7 @@ func createPodUsingNfs(f *framework.Framework, c clientset.Interface, ns, nfsIP,
Containers: []v1.Container{
{
Name: "pod-nfs-vol",
Image: "busybox",
Image: imageutils.GetE2EImage(imageutils.BusyBox),
Command: []string{"/bin/sh"},
Args: cmdLine,
VolumeMounts: []v1.VolumeMount{

View File

@ -21,7 +21,6 @@ import (
"strings"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/uuid"
clientset "k8s.io/client-go/kubernetes"
@ -199,12 +198,6 @@ var _ = SIGDescribe("Kubelet [Serial] [Slow]", func() {
var rm *framework.ResourceMonitor
BeforeEach(func() {
// Wait until image prepull pod has completed so that they wouldn't
// affect the runtime cpu usage. Fail the test if prepulling cannot
// finish in time.
if err := framework.WaitForPodsSuccess(f.ClientSet, metav1.NamespaceSystem, framework.ImagePullerLabels, imagePrePullingLongTimeout); err != nil {
framework.Failf("Image puller didn't complete in %v, not running resource usage test since the metrics might be adultrated", imagePrePullingLongTimeout)
}
nodes := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
nodeNames = sets.NewString()
for _, node := range nodes.Items {

View File

@ -23,6 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -43,7 +44,7 @@ func preparePod(name string, node *v1.Node, propagation *v1.MountPropagationMode
Containers: []v1.Container{
{
Name: containerName,
Image: "busybox",
Image: imageutils.GetE2EImage(imageutils.BusyBox),
Command: []string{"sh", "-c", cmd},
VolumeMounts: []v1.VolumeMount{
{

View File

@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image"
)
// This test requires that --terminated-pod-gc-threshold=100 be set on the controller manager
@ -89,7 +90,7 @@ func createTerminatingPod(f *framework.Framework) (*v1.Pod, error) {
Containers: []v1.Container{
{
Name: string(uuid),
Image: "busybox",
Image: imageutils.GetE2EImage(imageutils.BusyBox),
},
},
SchedulerName: "please don't schedule my pods",

View File

@ -46,8 +46,13 @@ var _ = SIGDescribe("Pods Extended", func() {
BeforeEach(func() {
podClient = f.PodClient()
})
// Flaky issue #36821.
framework.ConformanceIt("should be submitted and removed [Flaky]", func() {
// TODO: Fix Flaky issue #68066 and then re-add this back into Conformance Suite
/*
Release : v1.9
Testname: Pods, delete grace period
Description: Create a pod, make sure it is running, create a watch to observe Pod creation. Create a 'kubectl local proxy', capture the port the proxy is listening. Using the http client send a delete with gracePeriodSeconds=30. Pod SHOULD get deleted within 30 seconds.
*/
It("should be submitted and removed [Flaky]", func() {
By("creating the pod")
name := "pod-submit-remove-" + string(uuid.NewUUID())
value := strconv.Itoa(time.Now().Nanosecond())
@ -63,7 +68,7 @@ var _ = SIGDescribe("Pods Extended", func() {
Containers: []v1.Container{
{
Name: "nginx",
Image: imageutils.GetE2EImage(imageutils.NginxSlim),
Image: imageutils.GetE2EImage(imageutils.Nginx),
},
},
},
@ -199,6 +204,11 @@ var _ = SIGDescribe("Pods Extended", func() {
BeforeEach(func() {
podClient = f.PodClient()
})
/*
Release : v1.9
Testname: Pods, QOS
Description: Create a Pod with CPU and Memory request and limits. Pos status MUST have QOSClass set to PodQOSGuaranteed.
*/
framework.ConformanceIt("should be submitted and removed ", func() {
By("creating the pod")
name := "pod-qos-class-" + string(uuid.NewUUID())
@ -213,7 +223,7 @@ var _ = SIGDescribe("Pods Extended", func() {
Containers: []v1.Container{
{
Name: "nginx",
Image: imageutils.GetE2EImage(imageutils.NginxSlim),
Image: imageutils.GetE2EImage(imageutils.Nginx),
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceCPU: resource.MustParse("100m"),

View File

@ -80,7 +80,7 @@ func testPreStop(c clientset.Interface, ns string) {
Containers: []v1.Container{
{
Name: "tester",
Image: "busybox",
Image: imageutils.GetE2EImage(imageutils.BusyBox),
Command: []string{"sleep", "600"},
Lifecycle: &v1.Lifecycle{
PreStop: &v1.Handler{
@ -162,9 +162,9 @@ var _ = SIGDescribe("PreStop", func() {
f := framework.NewDefaultFramework("prestop")
/*
Testname: pods-prestop-handler-invoked
Description: Makes sure a pod's preStop handler is successfully
invoked immediately before a container is terminated.
Release : v1.9
Testname: Pods, prestop hook
Description: Create a server pod with a rest endpoint '/write' that changes state.Received field. Create a Pod with a pre-stop handle that posts to the /write endpoint on the server Pod. Verify that the Pod with pre-stop hook is running. Delete the Pod with the pre-stop hook. Before the Pod is deleted, pre-stop handler MUST be called when configured. Verify that the Pod is deleted and a call to prestop hook is verified by checking the status received on the server Pod.
*/
framework.ConformanceIt("should call prestop when killing a pod ", func() {
testPreStop(f.ClientSet, f.Namespace.Name)

188
vendor/k8s.io/kubernetes/test/e2e/node/runtimeclass.go generated vendored Normal file
View File

@ -0,0 +1,188 @@
/*
Copyright 2018 The Kubernetes 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 node
import (
"fmt"
"time"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/kubernetes/pkg/kubelet/events"
runtimeclasstest "k8s.io/kubernetes/pkg/kubelet/runtimeclass/testing"
"k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image"
utilpointer "k8s.io/utils/pointer"
. "github.com/onsi/ginkgo"
)
const runtimeClassCRDName = "runtimeclasses.node.k8s.io"
var (
runtimeClassGVR = schema.GroupVersionResource{
Group: "node.k8s.io",
Version: "v1alpha1",
Resource: "runtimeclasses",
}
)
var _ = SIGDescribe("RuntimeClass [Feature:RuntimeClass]", func() {
f := framework.NewDefaultFramework("runtimeclass")
It("should reject a Pod requesting a non-existent RuntimeClass", func() {
rcName := f.Namespace.Name + "-nonexistent"
pod := createRuntimeClassPod(f, rcName)
expectSandboxFailureEvent(f, pod, fmt.Sprintf("\"%s\" not found", rcName))
})
It("should run a Pod requesting a RuntimeClass with an empty handler", func() {
rcName := createRuntimeClass(f, "empty-handler", "")
pod := createRuntimeClassPod(f, rcName)
expectPodSuccess(f, pod)
})
It("should reject a Pod requesting a RuntimeClass with an unconfigured handler", func() {
handler := f.Namespace.Name + "-handler"
rcName := createRuntimeClass(f, "unconfigured-handler", handler)
pod := createRuntimeClassPod(f, rcName)
expectSandboxFailureEvent(f, pod, handler)
})
It("should reject a Pod requesting a deleted RuntimeClass", func() {
rcName := createRuntimeClass(f, "delete-me", "")
By("Deleting RuntimeClass "+rcName, func() {
err := f.DynamicClient.Resource(runtimeClassGVR).Delete(rcName, nil)
framework.ExpectNoError(err, "failed to delete RuntimeClass %s", rcName)
By("Waiting for the RuntimeClass to disappear")
framework.ExpectNoError(wait.PollImmediate(framework.Poll, time.Minute, func() (bool, error) {
_, err := f.DynamicClient.Resource(runtimeClassGVR).Get(rcName, metav1.GetOptions{})
if errors.IsNotFound(err) {
return true, nil // done
}
if err != nil {
return true, err // stop wait with error
}
return false, nil
}))
})
pod := createRuntimeClassPod(f, rcName)
expectSandboxFailureEvent(f, pod, fmt.Sprintf("\"%s\" not found", rcName))
})
It("should recover when the RuntimeClass CRD is deleted [Slow]", func() {
By("Deleting the RuntimeClass CRD", func() {
crds := f.APIExtensionsClientSet.ApiextensionsV1beta1().CustomResourceDefinitions()
runtimeClassCRD, err := crds.Get(runtimeClassCRDName, metav1.GetOptions{})
framework.ExpectNoError(err, "failed to get RuntimeClass CRD %s", runtimeClassCRDName)
runtimeClassCRDUID := runtimeClassCRD.GetUID()
err = crds.Delete(runtimeClassCRDName, nil)
framework.ExpectNoError(err, "failed to delete RuntimeClass CRD %s", runtimeClassCRDName)
By("Waiting for the CRD to disappear")
framework.ExpectNoError(wait.PollImmediate(framework.Poll, time.Minute, func() (bool, error) {
crd, err := crds.Get(runtimeClassCRDName, metav1.GetOptions{})
if errors.IsNotFound(err) {
return true, nil // done
}
if err != nil {
return true, err // stop wait with error
}
// If the UID changed, that means the addon manager has already recreated it.
return crd.GetUID() != runtimeClassCRDUID, nil
}))
By("Waiting for the CRD to be recreated")
framework.ExpectNoError(wait.PollImmediate(framework.Poll, 5*time.Minute, func() (bool, error) {
crd, err := crds.Get(runtimeClassCRDName, metav1.GetOptions{})
if errors.IsNotFound(err) {
return false, nil // still not recreated
}
if err != nil {
return true, err // stop wait with error
}
if crd.GetUID() == runtimeClassCRDUID {
return true, fmt.Errorf("RuntimeClass CRD never deleted") // this shouldn't happen
}
return true, nil
}))
})
rcName := createRuntimeClass(f, "valid", "")
pod := createRuntimeClassPod(f, rcName)
expectPodSuccess(f, pod)
})
// TODO(tallclair): Test an actual configured non-default runtimeHandler.
})
// createRuntimeClass generates a RuntimeClass with the desired handler and a "namespaced" name,
// synchronously creates it with the dynamic client, and returns the resulting name.
func createRuntimeClass(f *framework.Framework, name, handler string) string {
uniqueName := fmt.Sprintf("%s-%s", f.Namespace.Name, name)
rc := runtimeclasstest.NewUnstructuredRuntimeClass(uniqueName, handler)
rc, err := f.DynamicClient.Resource(runtimeClassGVR).Create(rc, metav1.CreateOptions{})
framework.ExpectNoError(err, "failed to create RuntimeClass resource")
return rc.GetName()
}
// createRuntimeClass creates a test pod with the given runtimeClassName.
func createRuntimeClassPod(f *framework.Framework, runtimeClassName string) *v1.Pod {
pod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: fmt.Sprintf("test-runtimeclass-%s-", runtimeClassName),
},
Spec: v1.PodSpec{
RuntimeClassName: &runtimeClassName,
Containers: []v1.Container{{
Name: "test",
Image: imageutils.GetE2EImage(imageutils.BusyBox),
Command: []string{"true"},
}},
RestartPolicy: v1.RestartPolicyNever,
AutomountServiceAccountToken: utilpointer.BoolPtr(false),
},
}
return f.PodClient().Create(pod)
}
// expectPodSuccess waits for the given pod to terminate successfully.
func expectPodSuccess(f *framework.Framework, pod *v1.Pod) {
framework.ExpectNoError(framework.WaitForPodSuccessInNamespace(
f.ClientSet, pod.Name, f.Namespace.Name))
}
// expectSandboxFailureEvent polls for an event with reason "FailedCreatePodSandBox" containing the
// expected message string.
func expectSandboxFailureEvent(f *framework.Framework, pod *v1.Pod, msg string) {
eventSelector := fields.Set{
"involvedObject.kind": "Pod",
"involvedObject.name": pod.Name,
"involvedObject.namespace": f.Namespace.Name,
"reason": events.FailedCreatePodSandBox,
}.AsSelector().String()
framework.ExpectNoError(framework.WaitTimeoutForPodEvent(
f.ClientSet, pod.Name, f.Namespace.Name, eventSelector, msg, framework.PodEventTimeout))
}

View File

@ -29,6 +29,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/test/e2e/framework"
imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -49,7 +50,7 @@ func scTestPod(hostIPC bool, hostPID bool) *v1.Pod {
Containers: []v1.Container{
{
Name: "test-container",
Image: "busybox",
Image: imageutils.GetE2EImage(imageutils.BusyBox),
},
},
RestartPolicy: v1.RestartPolicyNever,

View File

@ -59,7 +59,7 @@ var _ = SIGDescribe("SSH", func() {
// Keep this test first - this variant runs on all nodes.
{`echo "Hello from $(whoami)@$(hostname)"`, false, "", "", 0, nil},
{`echo "foo" | grep "bar"`, true, "", "", 1, nil},
{`echo "Out" && echo "Error" >&2 && exit 7`, true, "Out", "Error", 7, nil},
{`echo "stdout" && echo "stderr" >&2 && exit 7`, true, "stdout", "stderr", 7, nil},
}
for i, testCase := range testCases {