tests: Adds configurable pod DNS nameservers and search list test

This test creates a pod with custom DNS configurations and expects
them to be set in the containers.

The test pod is using the agnhost image, which can output the container's
DNS configurations that the test checks.
This commit is contained in:
Claudiu Belu
2019-04-11 22:50:51 -07:00
parent 5b47a92ad8
commit a7598c791f
2 changed files with 67 additions and 0 deletions

View File

@@ -4873,6 +4873,25 @@ func (f *Framework) NewTestPod(name string, requests v1.ResourceList, limits v1.
}
}
// 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: imageutils.GetE2EImage(imageutils.Agnhost),
Args: args,
},
},
},
}
}
// CreateEmptyFileOnPod creates empty file at given path on the pod.
func CreateEmptyFileOnPod(namespace string, podName string, filePath string) error {
_, err := RunKubectl("exec", fmt.Sprintf("--namespace=%s", namespace), podName, "--", "/bin/sh", "-c", fmt.Sprintf("touch %s", filePath))