diff --git a/test/e2e/performanceprofile/functests/1_performance/cpu_management.go b/test/e2e/performanceprofile/functests/1_performance/cpu_management.go index fb59cbc37e..fe4536da93 100644 --- a/test/e2e/performanceprofile/functests/1_performance/cpu_management.go +++ b/test/e2e/performanceprofile/functests/1_performance/cpu_management.go @@ -3,6 +3,7 @@ package __performance import ( "context" "fmt" + "os" "regexp" "strconv" "strings" @@ -537,6 +538,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { Context("Crio Annotations", func() { var testpod *corev1.Pod var allTestpods map[types.UID]*corev1.Pod + var busyCpusImage string annotations := map[string]string{ "cpu-load-balancing.crio.io": "disable", "cpu-quota.crio.io": "disable", @@ -544,7 +546,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { BeforeAll(func() { var err error allTestpods = make(map[types.UID]*corev1.Pod) - + busyCpusImage = busyCpuImageEnv() testpod = getTestPodWithAnnotations(annotations, smtLevel) // workaround for https://github.com/kubernetes/kubernetes/issues/107074 // until https://github.com/kubernetes/kubernetes/pull/120661 lands @@ -576,7 +578,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { By("Starting the pod") testpod.Spec.NodeSelector = testutils.NodeSelectorLabels - testpod.Spec.Containers[0].Image = "quay.io/ocp-edge-qe/busycpus" + testpod.Spec.Containers[0].Image = busyCpusImage testpod.Spec.Containers[0].Resources.Limits[corev1.ResourceCPU] = resource.MustParse("2") err = testclient.Client.Create(context.TODO(), testpod) Expect(err).ToNot(HaveOccurred()) @@ -951,3 +953,20 @@ func checkSchedulingDomains(workerRTNode *corev1.Node, podCpus cpuset.CPUSet, te }).WithTimeout(2*time.Minute).WithPolling(5*time.Second).ShouldNot(HaveOccurred(), errMsg) } + +// busyCpuImageEnv return busycpus image used for crio quota annotations test +// This is required for running tests on disconnected environment where images are mirrored +// in private registries. +func busyCpuImageEnv() string { + qeImageRegistry := os.Getenv("IMAGE_REGISTRY") + busyCpusImage := os.Getenv("BUSY_CPUS_IMAGE") + + if busyCpusImage == "" { + busyCpusImage = "busycpus" + } + + if qeImageRegistry == "" { + qeImageRegistry = "quay.io/ocp-edge-qe/" + } + return fmt.Sprintf("%s%s", qeImageRegistry, busyCpusImage) +}