Skip to content

Commit 0714fc0

Browse files
Merge pull request #1402 from mrniranjan/enable_auth_prepull
OCPBUGS-62836: E2E: Pass pull secret path to pull cnf-tests
2 parents 4f59455 + 6ab3f1c commit 0714fc0

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

test/e2e/performanceprofile/functests/5_latency_testing/5_latency_testing_suite_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,18 @@ var _ = BeforeSuite(func() {
8080
testlog.Errorf("cannot create the namespace: %v", err)
8181
}
8282

83-
ds, err := images.PrePull(context.TODO(), testclient.Client, images.Test(), prePullNamespace.Name, "cnf-tests")
83+
var imagePullSecrets []corev1.LocalObjectReference
84+
if pullSecretName := os.Getenv("CNF_IMAGE_PULL_AUTH"); pullSecretName != "" {
85+
imagePullSecrets = []corev1.LocalObjectReference{
86+
{
87+
Name: pullSecretName,
88+
},
89+
}
90+
testlog.TaggedInfof("Info", "Using image pull secret: %s", pullSecretName)
91+
} else {
92+
testlog.TaggedInfof("Info", "Environment '%s' is empty or not set", pullSecretName)
93+
}
94+
ds, err := images.PrePull(context.TODO(), testclient.Client, images.Test(), prePullNamespace.Name, "cnf-tests", imagePullSecrets)
8495
if err != nil {
8596
data, _ := json.Marshal(ds) // we can safely skip errors
8697
testlog.Infof("DaemonSet %s/%s image=%q status:\n%s", ds.Namespace, ds.Name, images.Test(), string(data))

test/e2e/performanceprofile/functests/utils/images/prepull.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func GetPullTimeout() (time.Duration, error) {
3434
}
3535

3636
// PrePull makes sure the image is pre-pulled on the relevant nodes.
37-
func PrePull(ctx context.Context, cli client.Client, pullSpec, namespace, tag string) (*appsv1.DaemonSet, error) {
37+
func PrePull(ctx context.Context, cli client.Client, pullSpec, namespace, tag string, imagePullSecrets []corev1.LocalObjectReference) (*appsv1.DaemonSet, error) {
3838
name := PrePullPrefix + tag
3939
ds := appsv1.DaemonSet{
4040
ObjectMeta: metav1.ObjectMeta{
@@ -54,6 +54,7 @@ func PrePull(ctx context.Context, cli client.Client, pullSpec, namespace, tag st
5454
},
5555
},
5656
Spec: corev1.PodSpec{
57+
ImagePullSecrets: imagePullSecrets,
5758
Containers: []corev1.Container{
5859
{
5960
Name: "prepullcontainer",

0 commit comments

Comments
 (0)