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

Conversation

babugeet
Copy link
Contributor

@babugeet babugeet commented Jun 7, 2024

Signed-off-by: babugeet abhinandhbg@gmail.com

Fixes #

#7963

Proposed Changes

Adding the mount path as Environment variable for container of pod spawned by the Job

Signed-off-by: babugeet <abhinandhbg@gmail.com>
@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 7, 2024
Copy link

knative-prow bot commented Jun 7, 2024

Welcome @babugeet! It looks like this is your first PR to knative/eventing 🎉

Copy link

knative-prow bot commented Jun 7, 2024

Hi @babugeet. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow bot requested review from Cali0707 and creydr June 7, 2024 11:21
Comment on lines 316 to 319
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

@Cali0707 Cali0707 requested a review from pierDipi June 7, 2024 15:51
Signed-off-by: "babugeet <abhinandhbg@gmail.com>"
Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @babugeet !

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 7, 2024
Copy link

knative-prow bot commented Jun 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: babugeet, Cali0707

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 7, 2024
@Cali0707
Copy link
Member

Cali0707 commented Jun 7, 2024

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 7, 2024
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 67.73%. Comparing base (9d11598) to head (673bc3a).
Report is 1 commits behind head on main.

Files Patch % Lines
cmd/jobsink/main.go 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7968      +/-   ##
==========================================
- Coverage   67.76%   67.73%   -0.03%     
==========================================
  Files         354      354              
  Lines       16505    16512       +7     
==========================================
  Hits        11184    11184              
- Misses       4632     4639       +7     
  Partials      689      689              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@knative-prow knative-prow bot merged commit 844dcbf into knative:main Jun 7, 2024
35 of 36 checks passed
@pierDipi
Copy link
Member

pierDipi commented Jun 12, 2024

Thanks @babugeet for this! would you mind updating the documentation page to mention this new feature too ? https://github.com/knative/docs/blob/main/docs/eventing/sinks/job-sink.md

Comment on lines +318 to +321
job.Spec.Template.Spec.Containers[i].Env = append(job.Spec.Template.Spec.Containers[i].Env, corev1.EnvVar{
Name: "K_EVENT_PATH",
Value: mountPathName,
})
Copy link
Member

@pierDipi pierDipi Jun 12, 2024

Choose a reason for hiding this comment

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

This is an edge case but we need to check if the env variable is already defined or not here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it was not mentioned, when existing code was checked

@babugeet
Copy link
Contributor Author

babugeet commented Jun 12, 2024

Thanks @babugeet for this! would you mind updating the documentation page to mention this new feature too ? https://github.com/knative/docs/blob/main/docs/eventing/sinks/job-sink.md

Sure. Will raise a new PR for it. Can you pls share any similar sample release note PR, if you have handy

@babugeet
Copy link
Contributor Author

Thanks @babugeet for this! would you mind updating the documentation page to mention this new feature too ? https://github.com/knative/docs/blob/main/docs/eventing/sinks/job-sink.md

Sure. Will raise a new PR for it. Can you pls share any similar sample release note PR, if you have handy

@Cali0707 can you pls help me to get a sample relase not PR

@Cali0707
Copy link
Member

@babugeet the original docs for this feature comes from: knative/docs#6005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants