Skip to content

Commit fd0c445

Browse files
authoredJul 4, 2024
Merge pull request #425 from bpradipt/fix-delete-job
podvm: Fix payload image override
2 parents 89236e2 + 9698aa8 commit fd0c445

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎controllers/image_generator.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,13 @@ func (r *ImageGenerator) createJobFromFile(jobFileName string) (*batchv1.Job, er
311311
// If RELATED_PODVM_PAYLOAD_IMAGE environment variable is set, use it
312312
// Otherwise, use the default podvm payload image
313313
// There is only one initContainer in the job, so we don't need to check the container name
314-
podvmPayloadImage := os.Getenv("RELATED_IMAGE_PODVM_PAYLOAD")
315-
if podvmPayloadImage != "" {
316-
igLogger.Info("Using podvm payload image from environment variable", "image", podvmPayloadImage)
317-
job.Spec.Template.Spec.InitContainers[0].Image = podvmPayloadImage
314+
// The initContainer is only used for the create job "osc-podvm-create-job.yaml"
315+
if jobFileName == "osc-podvm-create-job.yaml" {
316+
podvmPayloadImage := os.Getenv("RELATED_IMAGE_PODVM_PAYLOAD")
317+
if podvmPayloadImage != "" {
318+
igLogger.Info("Using podvm payload image from environment variable", "image", podvmPayloadImage)
319+
job.Spec.Template.Spec.InitContainers[0].Image = podvmPayloadImage
320+
}
318321
}
319322

320323
return job, nil

0 commit comments

Comments
 (0)
Please sign in to comment.