diff --git a/test/e2e/performanceprofile/functests/5_latency_testing/5_latency_testing_suite_test.go b/test/e2e/performanceprofile/functests/5_latency_testing/5_latency_testing_suite_test.go index 80f1009e14..b8e878314f 100644 --- a/test/e2e/performanceprofile/functests/5_latency_testing/5_latency_testing_suite_test.go +++ b/test/e2e/performanceprofile/functests/5_latency_testing/5_latency_testing_suite_test.go @@ -80,7 +80,18 @@ var _ = BeforeSuite(func() { testlog.Errorf("cannot create the namespace: %v", err) } - ds, err := images.PrePull(context.TODO(), testclient.Client, images.Test(), prePullNamespace.Name, "cnf-tests") + var imagePullSecrets []corev1.LocalObjectReference + if pullSecretName := os.Getenv("CNF_IMAGE_PULL_AUTH"); pullSecretName != "" { + imagePullSecrets = []corev1.LocalObjectReference{ + { + Name: pullSecretName, + }, + } + testlog.TaggedInfof("Info", "Using image pull secret: %s", pullSecretName) + } else { + testlog.TaggedInfof("Info", "Environment '%s' is empty or not set", pullSecretName) + } + ds, err := images.PrePull(context.TODO(), testclient.Client, images.Test(), prePullNamespace.Name, "cnf-tests", imagePullSecrets) if err != nil { data, _ := json.Marshal(ds) // we can safely skip errors testlog.Infof("DaemonSet %s/%s image=%q status:\n%s", ds.Namespace, ds.Name, images.Test(), string(data)) diff --git a/test/e2e/performanceprofile/functests/utils/images/prepull.go b/test/e2e/performanceprofile/functests/utils/images/prepull.go index 8159a0842e..202ae27c00 100644 --- a/test/e2e/performanceprofile/functests/utils/images/prepull.go +++ b/test/e2e/performanceprofile/functests/utils/images/prepull.go @@ -34,7 +34,7 @@ func GetPullTimeout() (time.Duration, error) { } // PrePull makes sure the image is pre-pulled on the relevant nodes. -func PrePull(ctx context.Context, cli client.Client, pullSpec, namespace, tag string) (*appsv1.DaemonSet, error) { +func PrePull(ctx context.Context, cli client.Client, pullSpec, namespace, tag string, imagePullSecrets []corev1.LocalObjectReference) (*appsv1.DaemonSet, error) { name := PrePullPrefix + tag ds := appsv1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ @@ -54,6 +54,7 @@ func PrePull(ctx context.Context, cli client.Client, pullSpec, namespace, tag st }, }, Spec: corev1.PodSpec{ + ImagePullSecrets: imagePullSecrets, Containers: []corev1.Container{ { Name: "prepullcontainer",