e2e: add option to create pods with different image in pod.Config

For testing certain features, the BusyBox image does not provide all the
tools that are needed. Notably 'dd' from BusyBox does not support
direct-io that is required for skipping caches while doing writes and
reads on a Block-mode PVC attached to different nodes.
This commit is contained in:
Niels de Vos 2020-09-17 15:55:35 +02:00
parent 3a7d7101c5
commit 00b6d7ccee
2 changed files with 9 additions and 2 deletions

View File

@ -48,6 +48,7 @@ type Config struct {
SeLinuxLabel *v1.SELinuxOptions SeLinuxLabel *v1.SELinuxOptions
FsGroup *int64 FsGroup *int64
NodeSelection NodeSelection NodeSelection NodeSelection
ImageID int
} }
// CreateUnschedulablePod with given claims based on node selector // CreateUnschedulablePod with given claims based on node selector
@ -185,6 +186,10 @@ func MakeSecPod(podConfig *Config) (*v1.Pod, error) {
return &i return &i
}(1000) }(1000)
} }
image := imageutils.BusyBox
if podConfig.ImageID != imageutils.None {
image = podConfig.ImageID
}
podSpec := &v1.Pod{ podSpec := &v1.Pod{
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
Kind: "Pod", Kind: "Pod",
@ -203,7 +208,7 @@ func MakeSecPod(podConfig *Config) (*v1.Pod, error) {
Containers: []v1.Container{ Containers: []v1.Container{
{ {
Name: "write-pod", Name: "write-pod",
Image: imageutils.GetE2EImage(imageutils.BusyBox), Image: imageutils.GetE2EImage(image),
Command: []string{"/bin/sh"}, Command: []string{"/bin/sh"},
Args: []string{"-c", podConfig.Command}, Args: []string{"-c", podConfig.Command},
SecurityContext: &v1.SecurityContext{ SecurityContext: &v1.SecurityContext{

View File

@ -119,8 +119,10 @@ var (
) )
const ( const (
// None is to be used for unset/default images
None = iota
// Agnhost image // Agnhost image
Agnhost = iota Agnhost
// AgnhostPrivate image // AgnhostPrivate image
AgnhostPrivate AgnhostPrivate
// APIServer image // APIServer image