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

HTTP probes do not recognize change of IP #535

Closed
ls692 opened this issue Sep 19, 2023 · 2 comments
Closed

HTTP probes do not recognize change of IP #535

ls692 opened this issue Sep 19, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ls692
Copy link
Collaborator

ls692 commented Sep 19, 2023

Describe the bug
If a probe target VM is recreated quickly enough and ends up with a new probe IP, HTTP probe still uses the old IP.

Cloudprober Version
All versions of cloudprober are affected.

Context
HTTP probes use endpoint.Key() to determine targets that are active and ones need to be recreated
https://github.com/cloudprober/cloudprober/blob/master/probes/http/http.go#L524

endpoint,Key() is defined as Name + labels, excluding IP. https://github.com/cloudprober/cloudprober/blob/master/targets/endpoint/endpoint.go#L41

So if only VM IP changes, we end up reusing the same target but keep probing the old IP.

One simple fix is to modify endpoint.Key() to use the endpoint IP too. I will do some digging to see if that causes other complications. If so, another quickfix is to modify http.go to append IP to endpoint.Key().

@ls692 ls692 added the bug Something isn't working label Sep 19, 2023
@manugarg
Copy link
Contributor

Hi Lenin 👋 😄 ,

Great find. I think this bug must have existed since Oct, 2022, when we started switching to the model of storing IPs in the endpoint struct itself, instead of asking the "targets" to resolve it.

I think modifying endpoint.Key() to include IP should be okay.

@ls692 ls692 self-assigned this Sep 20, 2023
ls692 added a commit to ls692/cloudprober that referenced this issue Sep 20, 2023
HTTP probes use endpoint key as identifier to decide when to recreate
probes. During VM recreations, it is possible for VM name to stay the
same but VM IP changes. By adding IP to key, we ensure that in such
cases, HTTP probes are recreated.
@manugarg manugarg added this to the v0.13.0 milestone Sep 20, 2023
manugarg pushed a commit that referenced this issue Sep 22, 2023
HTTP probes use endpoint key as identifier to decide when to recreate
probes. During VM recreations, it is possible for VM name to stay the
same but VM IP changes. By adding IP to key, we ensure that in such
cases, HTTP probes are recreated.
@manugarg
Copy link
Contributor

Thanks @ls692 for fixing this in #538.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants