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
Add the async probing function to the prober library. #3986
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vagababov: 0 warnings.
In response to this:
This will be used from the KPA and Activator
/lint
Proposed Changes
- add async prober function
- unit tests
/cc @mattmoor
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/test-infra repository.
/test pull-knative-serving-integration-tests |
pkg/network/prober/prober.go
Outdated
return | ||
} | ||
m.keys.Insert(target) | ||
m.doAsync(ctx, target, headerValue, done, period, timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried that the semantics of this passing heterogeneous done
functions is very strange. :(
I think I'd be comfortable with the set-based approach if the done
function is setup when the Manager
is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? We don't depend on the callback to clean the state it is explicitly setup by us in the doAsync
?
if err != nil { | ||
return false, err | ||
} | ||
return st == http.StatusOK && body == activator.Name, nil | ||
return success, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just return prober.Do(...)
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
certainly. 🤦♂
// call is discarded. If the request is accepted, Offer returns true. | ||
// Otherwise Offer starts a goroutine that periodically executes | ||
// `Do`, until timeout is reached, the probe succeeds, or fails with an error. | ||
// In the end the callback is invoked with the provided `arg` and probing results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is assumed that the opaque
arg
is consistent for a giventarget
and we will coalesce concurrentOffer
invocations ontarget
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added to the Done
definition.
// Otherwise Offer starts a goroutine that periodically executes | ||
// `Do`, until timeout is reached, the probe succeeds, or fails with an error. | ||
// In the end the callback is invoked with the provided `arg` and probing results. | ||
func (m *Manager) Offer(ctx context.Context, target, headerValue string, arg interface{}, period, timeout time.Duration) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "Offer"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we offer system to make a probe, since the system can reject doing it -- it's not Do
:)
The following is the coverage report on pkg/.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, vagababov 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 |
This will be used from the KPA and Activator
/lint
Proposed Changes
/cc @mattmoor