// Node e2e does not support the default DNSClusterFirst policy. Set
if!TestContext.PrepullImages{
// the policy to DNSDefault, which is configured per node.
return
pod.Spec.DNSPolicy=api.DNSDefault
}
// If prepull is enabled, munge the container spec to make sure the images are not pulled
// PrepullImages only works for node e2e now. For cluster e2e, image prepull is not enforced,
// during the test.
// we should not munge ImagePullPolicy for cluster e2e pods.
fori:=rangepod.Spec.Containers{
if!TestContext.PrepullImages{
c:=&pod.Spec.Containers[i]
return
ifc.ImagePullPolicy==api.PullAlways{
}
// If the image pull policy is PullAlways, the image doesn't need to be in
// If prepull is enabled, munge the container spec to make sure the images are not pulled
// the white list or pre-pulled, because the image is expected to be pulled
// during the test.
// in the test anyway.
fori:=rangepod.Spec.Containers{
continue
c:=&pod.Spec.Containers[i]
}
ifc.ImagePullPolicy==api.PullAlways{
// If the image policy is not PullAlways, the image must be in the white list and
// If the image pull policy is PullAlways, the image doesn't need to be in
// pre-pulled.
// the white list or pre-pulled, because the image is expected to be pulled
Expect(ImageWhiteList.Has(c.Image)).To(BeTrue(),"Image %q is not in the white list, consider adding it to CommonImageWhiteList in test/e2e/common/util.go or NodeImageWhiteList in test/e2e_node/image_list.go",c.Image)
// in the test anyway.
// Do not pull images during the tests because the images in white list should have
continue
// been prepulled.
c.ImagePullPolicy=api.PullNever
}
}
// If the image policy is not PullAlways, the image must be in the white list and
// pre-pulled.
Expect(ImageWhiteList.Has(c.Image)).To(BeTrue(),"Image %q is not in the white list, consider adding it to CommonImageWhiteList in test/e2e/common/util.go or NodeImageWhiteList in test/e2e_node/image_list.go",c.Image)
// Do not pull images during the tests because the images in white list should have