Skip to content
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

Adding mount path as env variable in container #7968

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions cmd/jobsink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
MountPath: "/etc/jobsink-event",
})
}
job.Spec.Template.Spec.Containers[i].Env = append(job.Spec.Template.Spec.Containers[i].Env, corev1.EnvVar{
Name: "K_EVENT_PATH",
Value: "/etc/jobsink-event",
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value you are using here isn't guaranteed to be correct. If you look at the logic above, a different volume mount may be chosen (which could have a different mount path)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cali0707 : i have updated the logic,
If the Volume mount already exists, the code is taking the volume mount path from the job
If the Volume mount is not there, the code is taking the defined mount path

}

found := false
Expand Down