mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
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:
commit
d07095d425
@ -60,7 +60,7 @@ var CurrentSuite Suite
|
||||
// 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.
|
||||
// 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.
|
||||
var PrePulledImages = sets.NewString(
|
||||
imageutils.GetE2EImage(imageutils.Agnhost),
|
||||
|
@ -57,10 +57,10 @@ const (
|
||||
forbiddenReason = "SysctlForbidden"
|
||||
)
|
||||
|
||||
// ImageWhiteList 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
|
||||
// ImagePrePullList is the images used in the current test suite. It should be initialized in test suite and
|
||||
// the images in the list should be pre-pulled in the test suite. Currently, this is only used by
|
||||
// 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,
|
||||
// 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
|
||||
// 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
|
||||
// been prepulled.
|
||||
c.ImagePullPolicy = v1.PullNever
|
||||
|
@ -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.
|
||||
if framework.TestContext.PrepullImages {
|
||||
klog.Infof("Pre-pulling images so that they are cached for the tests.")
|
||||
updateImageWhiteList()
|
||||
updateImageAllowList()
|
||||
err := PrePullAllImages()
|
||||
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
|
||||
}
|
||||
@ -279,7 +279,7 @@ func waitForNodeReady() {
|
||||
// update test context with node configuration.
|
||||
func updateTestContext() error {
|
||||
setExtraEnvs()
|
||||
updateImageWhiteList()
|
||||
updateImageAllowList()
|
||||
|
||||
client, err := getAPIServerClient()
|
||||
if err != nil {
|
||||
|
@ -61,16 +61,16 @@ var NodePrePullImageList = sets.NewString(
|
||||
"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
|
||||
// 2. the ones passed in from framework.TestContext.ExtraEnvs
|
||||
// So this function needs to be called after the extra envs are applied.
|
||||
func updateImageWhiteList() {
|
||||
// Union NodePrePullImageList and CommonImageWhiteList into the framework image pre-pull list.
|
||||
framework.ImageWhiteList = NodePrePullImageList.Union(commontest.PrePulledImages)
|
||||
func updateImageAllowList() {
|
||||
// Union NodePrePullImageList and PrePulledImages into the framework image pre-pull list.
|
||||
framework.ImagePrePullList = NodePrePullImageList.Union(commontest.PrePulledImages)
|
||||
// Images from extra envs
|
||||
framework.ImageWhiteList.Insert(getNodeProblemDetectorImage())
|
||||
framework.ImageWhiteList.Insert(getSRIOVDevicePluginImage())
|
||||
framework.ImagePrePullList.Insert(getNodeProblemDetectorImage())
|
||||
framework.ImagePrePullList.Insert(getSRIOVDevicePluginImage())
|
||||
}
|
||||
|
||||
func getNodeProblemDetectorImage() string {
|
||||
@ -149,7 +149,7 @@ func PrePullAllImages() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
images := framework.ImageWhiteList.List()
|
||||
images := framework.ImagePrePullList.List()
|
||||
klog.V(4).Infof("Pre-pulling images with %s %+v", puller.Name(), images)
|
||||
for _, image := range images {
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user