Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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",
Expand Down