mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #89387 from oomichi/NewAgnhostPod
Move NewAgnhostPod() to e2e/network
This commit is contained in:
commit
91766b86a9
@ -155,9 +155,6 @@ var (
|
||||
// BusyBoxImage is the image URI of BusyBox.
|
||||
BusyBoxImage = imageutils.GetE2EImage(imageutils.BusyBox)
|
||||
|
||||
// AgnHostImage is the image URI of AgnHost
|
||||
AgnHostImage = imageutils.GetE2EImage(imageutils.Agnhost)
|
||||
|
||||
// ProvidersWithSSH are those providers where each node is accessible with SSH
|
||||
ProvidersWithSSH = []string{"gce", "gke", "aws", "local"}
|
||||
|
||||
@ -1516,25 +1513,6 @@ func DescribeIng(ns string) {
|
||||
Logf(desc)
|
||||
}
|
||||
|
||||
// NewAgnhostPod returns a pod that uses the agnhost image. The image's binary supports various subcommands
|
||||
// that behave the same, no matter the underlying OS.
|
||||
func (f *Framework) NewAgnhostPod(name string, args ...string) *v1.Pod {
|
||||
return &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: "agnhost",
|
||||
Image: AgnHostImage,
|
||||
Args: args,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// CreateEmptyFileOnPod creates empty file at given path on the pod.
|
||||
// TODO(alejandrox1): move to subpkg pod once kubectl methods have been refactored.
|
||||
func CreateEmptyFileOnPod(namespace string, podName string, filePath string) error {
|
||||
|
@ -409,7 +409,7 @@ var _ = SIGDescribe("DNS", func() {
|
||||
ginkgo.By("Creating a pod with dnsPolicy=None and customized dnsConfig...")
|
||||
testServerIP := "1.1.1.1"
|
||||
testSearchPath := "resolv.conf.local"
|
||||
testAgnhostPod := f.NewAgnhostPod(f.Namespace.Name, "pause")
|
||||
testAgnhostPod := newAgnhostPod(f.Namespace.Name, "pause")
|
||||
testAgnhostPod.Spec.DNSPolicy = v1.DNSNone
|
||||
testAgnhostPod.Spec.DNSConfig = &v1.PodDNSConfig{
|
||||
Nameservers: []string{testServerIP},
|
||||
|
@ -146,7 +146,7 @@ var _ = SIGDescribe("Firewall rule", func() {
|
||||
podName := fmt.Sprintf("netexec%v", i)
|
||||
|
||||
framework.Logf("Creating netexec pod %q on node %v in namespace %q", podName, nodeName, ns)
|
||||
pod := f.NewAgnhostPod(podName,
|
||||
pod := newAgnhostPod(podName,
|
||||
"netexec",
|
||||
fmt.Sprintf("--http-port=%d", firewallTestHTTPPort),
|
||||
fmt.Sprintf("--udp-port=%d", firewallTestUDPPort))
|
||||
|
@ -60,7 +60,7 @@ func checkConnectivityToHost(f *framework.Framework, nodeName, podName, host str
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: contName,
|
||||
Image: framework.AgnHostImage,
|
||||
Image: agnHostImage,
|
||||
Command: command,
|
||||
},
|
||||
},
|
||||
|
@ -902,7 +902,7 @@ var _ = SIGDescribe("Services", func() {
|
||||
|
||||
ginkgo.By("Creating a webserver pod to be part of the TCP service which echoes back source ip")
|
||||
serverPodName := "echo-sourceip"
|
||||
pod := f.NewAgnhostPod(serverPodName, "netexec", "--http-port", strconv.Itoa(servicePort))
|
||||
pod := newAgnhostPod(serverPodName, "netexec", "--http-port", strconv.Itoa(servicePort))
|
||||
pod.Labels = jig.Labels
|
||||
_, err = cs.CoreV1().Pods(ns).Create(context.TODO(), pod, metav1.CreateOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
@ -960,7 +960,7 @@ var _ = SIGDescribe("Services", func() {
|
||||
|
||||
ginkgo.By("creating a client/server pod")
|
||||
serverPodName := "hairpin"
|
||||
podTemplate := f.NewAgnhostPod(serverPodName, "netexec", "--http-port", strconv.Itoa(servicePort))
|
||||
podTemplate := newAgnhostPod(serverPodName, "netexec", "--http-port", strconv.Itoa(servicePort))
|
||||
podTemplate.Labels = jig.Labels
|
||||
pod, err := cs.CoreV1().Pods(ns).Create(context.TODO(), podTemplate, metav1.CreateOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
@ -3334,7 +3334,7 @@ func proxyMode(f *framework.Framework) (string, error) {
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: "detector",
|
||||
Image: framework.AgnHostImage,
|
||||
Image: agnHostImage,
|
||||
Args: []string{"pause"},
|
||||
},
|
||||
},
|
||||
|
@ -21,9 +21,17 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2enetwork "k8s.io/kubernetes/test/e2e/framework/network"
|
||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||
)
|
||||
|
||||
var (
|
||||
// agnHostImage is the image URI of AgnHost
|
||||
agnHostImage = imageutils.GetE2EImage(imageutils.Agnhost)
|
||||
)
|
||||
|
||||
// GetHTTPContent returns the content of the given url by HTTP.
|
||||
@ -49,3 +57,22 @@ func DescribeSvc(ns string) {
|
||||
ns, "describe", "svc", fmt.Sprintf("--namespace=%v", ns))
|
||||
framework.Logf(desc)
|
||||
}
|
||||
|
||||
// newAgnhostPod returns a pod that uses the agnhost image. The image's binary supports various subcommands
|
||||
// that behave the same, no matter the underlying OS.
|
||||
func newAgnhostPod(name string, args ...string) *v1.Pod {
|
||||
return &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: "agnhost",
|
||||
Image: agnHostImage,
|
||||
Args: args,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user