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

removed ctx from datastore struct #641

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nirrozenbaum
Copy link
Contributor

instead added ctx to one function that required it which is more aligned with best practices.

instead added ctx to one function that required it which is more aligned with best practices.

Signed-off-by: Nir Rozenbaum <[email protected]>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 2, 2025
@k8s-ci-robot k8s-ci-robot requested review from ahg-g and kfswain April 2, 2025 12:21
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: nirrozenbaum
Once this PR has been reviewed and has the lgtm label, please assign sergeykanzhelev for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

netlify bot commented Apr 2, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 4bb3be3
🔍 Latest deploy log https://app.netlify.com/sites/gateway-api-inference-extension/deploys/67ed2bdb531509000887d092
😎 Deploy Preview https://deploy-preview-641--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 2, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Apr 2, 2025

The existing logic is intentional. We need the parent context because it is used to start a metrics probing goroutine that should continue to live beyond the life of the reconcile event that triggered its creation.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 2, 2025
@nirrozenbaum
Copy link
Contributor Author

nirrozenbaum commented Apr 2, 2025

can you point me to the code you’re referring to?
reconcile event also gets context (in controller-runtime) and that can be used in a new go routine.
in general, best practice for context usage is to usually propagate the context between functions rather than saving in struct.

@ahg-g
Copy link
Contributor

ahg-g commented Apr 6, 2025

My point is that the context that is created as part of the pod reconcile even is short lived, it is live span is related to that of the event. The metrics probing thread on the other hand is supposed to live longer than the pod reconcile event that triggered the creation of the metrics probing thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants