-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Prepare queue healthHandler for optional aggressive retries #4649
Conversation
Co-authored-by: Shash Reddy <[email protected]>
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
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.
@joshrider: 1 warning.
In response to this:
Co-authored-by: Shash Reddy [email protected]
Support #4014
One of many parts, spun out from #4600Proposed Changes
- Update queue health package to include TCP and HTTP retries and pave way for user-defined readinessProbes from the queue-proxy.
- Following PRs will use this package.
Release Note
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.
Co-authored-by: Shash Reddy <[email protected]>
pkg/queue/health/probe.go
Outdated
}, | ||
Timeout: config.Timeout, | ||
} | ||
url := fmt.Sprintf("%s://%s:%d%s", config.Scheme, config.Host, config.Port.IntValue(), config.Path) |
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 not construct url.URL
object and then use its String
method?
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.
If we build url.URL object then would we end up with something like below
url := url.URL{
Scheme: fmt.Sprintf("%s", config.Scheme),
Host: fmt.Sprintf("%s:%d", config.Host, config.Port.IntValue()),
Path: config.Path,
}
Not sure if we gain anything by making building URL object.
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.
Well:
- Scheme can be just assigned (no need to sprintf)
- Host is just
config.Host + ":" + config.Port.String()
(no need to sprintf) - you don't have to deal with validating slashes "/" (you don't currently, so in fact a wrong URL can be built)
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.
Scheme can be just assigned (no need to sprintf)
config.Scheme is not string type so that needs to be converted.
I agree with the rest so I will update
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.
URIScheme
is string
alias. So just string(config.Scheme) will do.
@vagababov : Addressed your comments. Ready for another review 👍 |
pkg/queue/health/probe.go
Outdated
} | ||
|
||
if !IsHTTPProbeReady(res) { | ||
return errors.New("HTTP probe did not respond Ready") |
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.
Feels like this should include the status code 🤔
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.
Mostly cosmetic from me.
@@ -95,7 +97,7 @@ func (h *State) HealthHandler(prober func() bool) func(w http.ResponseWriter, r | |||
} | |||
|
|||
switch { | |||
case h.IsAlive(): | |||
case isNotAggressive && h.IsAlive(): |
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 kind of envisioned the change to be !isAggressive
here. But I guess this works also :)
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.
will brainstorm a more descriptive name and update in future 🤔
cmd/queue/main.go
Outdated
@@ -249,7 +253,8 @@ func handler(reqChan chan queue.ReqEvent, breaker *queue.Breaker, handler http.H | |||
// Sets up /health and /wait-for-drain endpoints. | |||
func createAdminHandlers() *http.ServeMux { | |||
mux := http.NewServeMux() | |||
mux.HandleFunc(requestQueueHealthPath, healthState.HealthHandler(probeUserContainer)) | |||
// TODO(@joshrider): temporary change while waiting on other PRs to merge (See #4014) | |||
mux.HandleFunc(requestQueueHealthPath, healthState.HealthHandler(probeUserContainer, true /*isNotAggressive is set to true to piggyback on previous success and not aggressively retry everytime*/)) |
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.
mux.HandleFunc(requestQueueHealthPath, healthState.HealthHandler(probeUserContainer, true /*isNotAggressive is set to true to piggyback on previous success and not aggressively retry everytime*/)) | |
mux.HandleFunc(requestQueueHealthPath, healthState.HealthHandler(probeUserContainer, true /*isNotAggressive*/)) |
pkg/queue/health/probe.go
Outdated
Timeout: config.Timeout, | ||
} | ||
url := url.URL{ | ||
Scheme: fmt.Sprintf("%s", config.Scheme), |
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.
Scheme: fmt.Sprintf("%s", config.Scheme), | |
Scheme: string(config.Scheme), |
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.
Couple comments still inline seem relevant
On the case 👍 |
Co-authored-by: Shash Reddy <[email protected]>
The following is the coverage report on pkg/.
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: joshrider, mattmoor 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 |
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
Co-authored-by: Shash Reddy [email protected]
Support #4014
One of many parts, spun out from #4600
Proposed Changes
Release Note