Merge pull request #92711 from alejandrox1/rename-image-prepull-lists

Renamed image "white lists" to pre-pull image lists in test
This commit is contained in:
Kubernetes Prow Robot 2020-07-02 04:17:58 -07:00 committed by GitHub
commit d07095d425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View File

@ -60,7 +60,7 @@ var CurrentSuite Suite
// PrePulledImages are a list of images used in e2e/common tests. These images should be prepulled // PrePulledImages are a list of images used in e2e/common tests. These images should be prepulled
// before tests starts, so that the tests won't fail due image pulling flakes. // before tests starts, so that the tests won't fail due image pulling flakes.
// Currently, this is only used by node e2e test. // Currently, this is only used by node e2e test.
// See also updateImageWhiteList() in ../../e2e_node/image_list.go // See also updateImageAllowList() in ../../e2e_node/image_list.go
// TODO(random-liu): Change the image puller pod to use similar mechanism. // TODO(random-liu): Change the image puller pod to use similar mechanism.
var PrePulledImages = sets.NewString( var PrePulledImages = sets.NewString(
imageutils.GetE2EImage(imageutils.Agnhost), imageutils.GetE2EImage(imageutils.Agnhost),

View File

@ -57,10 +57,10 @@ const (
forbiddenReason = "SysctlForbidden" forbiddenReason = "SysctlForbidden"
) )
// ImageWhiteList is the images used in the current test suite. It should be initialized in test suite and // ImagePrePullList is the images used in the current test suite. It should be initialized in test suite and
// the images in the white list should be pre-pulled in the test suite. Currently, this is only used by // the images in the list should be pre-pulled in the test suite. Currently, this is only used by
// node e2e test. // node e2e test.
var ImageWhiteList sets.String var ImagePrePullList sets.String
// PodClient is a convenience method for getting a pod client interface in the framework's namespace, // PodClient is a convenience method for getting a pod client interface in the framework's namespace,
// possibly applying test-suite specific transformations to the pod spec, e.g. for // possibly applying test-suite specific transformations to the pod spec, e.g. for
@ -187,7 +187,7 @@ func (c *PodClient) mungeSpec(pod *v1.Pod) {
} }
// If the image policy is not PullAlways, the image must be in the pre-pull list and // If the image policy is not PullAlways, the image must be in the pre-pull list and
// pre-pulled. // pre-pulled.
gomega.Expect(ImageWhiteList.Has(c.Image)).To(gomega.BeTrue(), "Image %q is not in the white list, consider adding it to CommonImageWhiteList in test/e2e/common/util.go or NodePrePullImageList in test/e2e_node/image_list.go", c.Image) gomega.Expect(ImagePrePullList.Has(c.Image)).To(gomega.BeTrue(), "Image %q is not in the pre-pull list, consider adding it to PrePulledImages in test/e2e/common/util.go or NodePrePullImageList in test/e2e_node/image_list.go", c.Image)
// Do not pull images during the tests because the images in pre-pull list should have // Do not pull images during the tests because the images in pre-pull list should have
// been prepulled. // been prepulled.
c.ImagePullPolicy = v1.PullNever c.ImagePullPolicy = v1.PullNever

View File

@ -179,7 +179,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
// This helps with debugging test flakes since it is hard to tell when a test failure is due to image pulling. // This helps with debugging test flakes since it is hard to tell when a test failure is due to image pulling.
if framework.TestContext.PrepullImages { if framework.TestContext.PrepullImages {
klog.Infof("Pre-pulling images so that they are cached for the tests.") klog.Infof("Pre-pulling images so that they are cached for the tests.")
updateImageWhiteList() updateImageAllowList()
err := PrePullAllImages() err := PrePullAllImages()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred()) gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
} }
@ -279,7 +279,7 @@ func waitForNodeReady() {
// update test context with node configuration. // update test context with node configuration.
func updateTestContext() error { func updateTestContext() error {
setExtraEnvs() setExtraEnvs()
updateImageWhiteList() updateImageAllowList()
client, err := getAPIServerClient() client, err := getAPIServerClient()
if err != nil { if err != nil {

View File

@ -61,16 +61,16 @@ var NodePrePullImageList = sets.NewString(
"gcr.io/kubernetes-e2e-test-images/node-perf/tf-wide-deep-amd64:1.0", "gcr.io/kubernetes-e2e-test-images/node-perf/tf-wide-deep-amd64:1.0",
) )
// updateImageWhiteList updates the framework.ImageWhiteList with // updateImageAllowList updates the framework.ImagePrePullList with
// 1. the hard coded lists // 1. the hard coded lists
// 2. the ones passed in from framework.TestContext.ExtraEnvs // 2. the ones passed in from framework.TestContext.ExtraEnvs
// So this function needs to be called after the extra envs are applied. // So this function needs to be called after the extra envs are applied.
func updateImageWhiteList() { func updateImageAllowList() {
// Union NodePrePullImageList and CommonImageWhiteList into the framework image pre-pull list. // Union NodePrePullImageList and PrePulledImages into the framework image pre-pull list.
framework.ImageWhiteList = NodePrePullImageList.Union(commontest.PrePulledImages) framework.ImagePrePullList = NodePrePullImageList.Union(commontest.PrePulledImages)
// Images from extra envs // Images from extra envs
framework.ImageWhiteList.Insert(getNodeProblemDetectorImage()) framework.ImagePrePullList.Insert(getNodeProblemDetectorImage())
framework.ImageWhiteList.Insert(getSRIOVDevicePluginImage()) framework.ImagePrePullList.Insert(getSRIOVDevicePluginImage())
} }
func getNodeProblemDetectorImage() string { func getNodeProblemDetectorImage() string {
@ -149,7 +149,7 @@ func PrePullAllImages() error {
if err != nil { if err != nil {
return err return err
} }
images := framework.ImageWhiteList.List() images := framework.ImagePrePullList.List()
klog.V(4).Infof("Pre-pulling images with %s %+v", puller.Name(), images) klog.V(4).Infof("Pre-pulling images with %s %+v", puller.Name(), images)
for _, image := range images { for _, image := range images {
var ( var (