Skip to content

podvm: Fix payload image override #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2024
Merged
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
11 changes: 7 additions & 4 deletions controllers/image_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,13 @@ func (r *ImageGenerator) createJobFromFile(jobFileName string) (*batchv1.Job, er
// If RELATED_PODVM_PAYLOAD_IMAGE environment variable is set, use it
// Otherwise, use the default podvm payload image
// There is only one initContainer in the job, so we don't need to check the container name
podvmPayloadImage := os.Getenv("RELATED_IMAGE_PODVM_PAYLOAD")
if podvmPayloadImage != "" {
igLogger.Info("Using podvm payload image from environment variable", "image", podvmPayloadImage)
job.Spec.Template.Spec.InitContainers[0].Image = podvmPayloadImage
// The initContainer is only used for the create job "osc-podvm-create-job.yaml"
if jobFileName == "osc-podvm-create-job.yaml" {
podvmPayloadImage := os.Getenv("RELATED_IMAGE_PODVM_PAYLOAD")
if podvmPayloadImage != "" {
igLogger.Info("Using podvm payload image from environment variable", "image", podvmPayloadImage)
job.Spec.Template.Spec.InitContainers[0].Image = podvmPayloadImage
}
}

return job, nil
Expand Down