Skip to content

Commit 945540c

Browse files
committed
Use DefaultAgentImage for the BuildFailureJob
Previously, the agent image configured in the controller's config was used for the BuildFailureJob. But customers could have configured this to be a private image. We don't want to copy the imagePullSecrets in as there could be an error in their formatting, and the failure job is designed to bubble up such errors to the job logs. So we use the default agent image which is guaranteed to be public.
1 parent 44c8310 commit 945540c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

internal/controller/scheduler/scheduler.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,17 @@ func (w *jobWrapper) BuildFailureJob(err error) (*batchv1.Job, error) {
501501
PodSpec: &corev1.PodSpec{
502502
Containers: []corev1.Container{
503503
{
504-
Image: w.cfg.Image,
504+
// the configured agent image may be private. If there is an error in specifying the
505+
// secrets for this image, we should still be able to run the failure job. So, we
506+
// bypass the potentially private image and use a public one. We could use a
507+
// thinner public image like `alpine:latest`, but it's generally unwise to depend
508+
// on an image that's not published by us.
509+
//
510+
// TODO: pin the version of the agent image and use that here.
511+
// Currently, DefaultAgentImage has a latest tag. That's not ideal as
512+
// a given version of agent stack-k8s may use different versions of the agent image over
513+
// time. We should consider using a specific version of the agent image here.
514+
Image: config.DefaultAgentImage,
505515
Command: []string{fmt.Sprintf("echo %q && exit 1", err.Error())},
506516
},
507517
},

0 commit comments

Comments
 (0)