🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@Ahmed-Elgamel
Copy link

@Ahmed-Elgamel Ahmed-Elgamel commented Jul 21, 2025

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Avoid creating a new request object everytime when making an http probe instead the worker just constructs the request once and every http probe uses the same request object

Which issue(s) this PR is related to:

Fixes #115939

Special notes for your reviewer:

I am open to any modification to my approach for request reuse.

My implemntation was as follows:

  1. created a new object that will store the request object
  2. The worker when making an http probe will create a new request (if none was created) or use the same request that was created earlier
  3. For all the probing fucntions, I modified them to accept a new argument, which is the request object ---it can be null (old behavior) or have a value that was provided by the worker (the reused request object)

If there’s a better approach or anything you’d like me to change, I’m happy to do so.

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 21, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot
Copy link
Contributor

Welcome @Ahmed-Elgamel!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @Ahmed-Elgamel. Thanks for your PR.

I'm waiting for a kubernetes 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 21, 2025
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 21, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ahmed-Elgamel
Once this PR has been reviewed and has the lgtm label, please assign derekwaynecarr 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

@pacoxu
Copy link
Member

pacoxu commented Jul 22, 2025

/cc @aojea @SergeyKanzhelev
per your comments #115939 (comment)

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

this is new approach that introduces the least amount of changes at once. Many previous attempts were a lot of refactoring at once.

I like this, even though I believe more refactoring is needed in this package.

Please keep working on it - add some unit tests and clean up logging. We should come back to it very early in 1.35, once we done with 1.34

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 29, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Sep 14, 2025
…ame request without everytime constructing a new request object
- Remove the fallback HTTP request creation logic in the prober file
- Remove the request object null check since the http probing fuction (runProbe) will not be called if the worker failed to create the http request object and the worker will keep on trying again
- Improve error logging
Initialize httpProbeRequestHolder for HTTP probes in newWorker function
The holder is created with empty podIP initially, which will be
set dynamically during probe execution (in worker loop).

This approach handles cases where:
- Pod is created but not yet scheduled to a node (no IP available)
- Pod IP changes during pod lifecycle (rescheduling, network changes)
- Pod IP becomes available after worker creation

The podIP is intentionally left empty in newWorker because:
1. Pod may not be scheduled to a node yet when worker is created
2. Pod IP can change during pod lifecycle
3. Dynamic IP assignment in worker loop ensures current IP is always used (next step)

Next step: Handle pod IP changes in worker loop by updating/resetting
the httpProbeRequestHolder when IP changes are detected.
Reset/Invalidate cached HTTP request when pod IP changes to ensure probes
always use the current pod IP address. This handles pod rescheduling
and network configuration changes during the pod lifecycle.
@Ahmed-Elgamel Ahmed-Elgamel force-pushed the http-probe-request-reuse branch from c4b5de2 to 1e44895 Compare September 28, 2025 09:52
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Sep 28, 2025
@Ahmed-Elgamel
Copy link
Author

I have rebased against master and removed merge commits. Ready for another review.

@Ahmed-Elgamel
Copy link
Author

/auto-cc

@matthyx
Copy link
Contributor

matthyx commented Oct 16, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot 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 Oct 16, 2025
@Ahmed-Elgamel
Copy link
Author

/test pull-kubernetes-unit-windows-master

@Ahmed-Elgamel
Copy link
Author

Is the pull-kubernetes-unit-windows-master test supposed to fail? I think there is an issue with the CI environment that is being setup because I thought something was wrong with my unit test case. Also, I refactored the unit test case for better readability.

@Ahmed-Elgamel
Copy link
Author

@SergeyKanzhelev @haircommander will this pr be merged or is there review to be done on it still?

@Ahmed-Elgamel
Copy link
Author

I’m wondering if this change is not planned for v1.35, could someone share what went wrong / what could be improved in this PR so I can learn and do better next time?
I’d appreciate any feedback .
Thanks!

@matthyx
Copy link
Contributor

matthyx commented Oct 23, 2025

@Ahmed-Elgamel we are not into code freeze yet, I think @SergeyKanzhelev can still merge it.
I'm also wondering why this Windows job fails...

@Ahmed-Elgamel
Copy link
Author

/test pull-kubernetes-unit-windows-master

@k8s-ci-robot
Copy link
Contributor

@Ahmed-Elgamel: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-unit-windows-master f2a3066 link false /test pull-kubernetes-unit-windows-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 5, 2025
@SergeyKanzhelev
Copy link
Member

rebase, squash commits. And I also hoped for some review with lgtm on this. We are close to code freeze again, so likely this will miss the deadline again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Development

Successfully merging this pull request may close these issues.

Reuse the http request object for http probes

6 participants