Skip to content

Prepare queue healthHandler for optional aggressive retries - #4649

Merged
knative-prow-robot merged 5 commits into
knative:masterfrom
joshrider:queue-health
Jul 9, 2019
Merged

knative-prow-robot merged 5 commits into
knative:masterfrom
joshrider:queue-health

Conversation

@joshrider

Copy link
Copy Markdown
Contributor

Co-authored-by: Shash Reddy [email protected]

Support #4014
One of many parts, spun out from #4600

Proposed 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


@googlebot

Copy link
Copy Markdown

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 cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no Indicates the PR's author has not signed the CLA. label Jul 8, 2019
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 8, 2019

@knative-prow-robot knative-prow-robot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@joshrider: 1 warning.

Details

In response to this:

Co-authored-by: Shash Reddy [email protected]

Support #4014
One of many parts, spun out from #4600

Proposed 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.

Comment thread pkg/queue/health/probe.go Resolved
Comment thread cmd/queue/main.go Resolved
Comment thread cmd/queue/main.go Resolved
Comment thread pkg/queue/health/health_state.go Resolved
Comment thread pkg/queue/health/probe.go Resolved
Comment thread 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)

Copy link
Copy Markdown
Contributor

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?

@shashwathi shashwathi Jul 8, 2019 •

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well:

  1. Scheme can be just assigned (no need to sprintf)
  2. Host is just config.Host + ":" + config.Port.String() (no need to sprintf)
  3. you don't have to deal with validating slashes "/" (you don't currently, so in fact a wrong URL can be built)

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

Comment thread pkg/queue/health/probe.go Resolved
Comment thread pkg/queue/health/probe.go Resolved
Comment thread pkg/queue/health/probe.go Resolved
Comment thread pkg/queue/health/probe.go Resolved
@shashwathi

Copy link
Copy Markdown
Contributor

@vagababov : Addressed your comments. Ready for another review 👍

Comment thread pkg/queue/health/probe.go Resolved
Comment thread pkg/queue/health/probe.go Outdated
}

if !IsHTTPProbeReady(res) {
return errors.New("HTTP probe did not respond Ready")

Copy link
Copy Markdown
Contributor

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 🤔

@vagababov vagababov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mostly cosmetic from me.


switch {
case h.IsAlive():
case isNotAggressive && h.IsAlive():

Copy link
Copy Markdown
Contributor

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 :)

Copy link
Copy Markdown
Contributor Author

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 🤔

Comment thread cmd/queue/main.go Outdated
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*/))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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*/))

Comment thread pkg/queue/health/probe.go Outdated
Timeout: config.Timeout,
}
url := url.URL{
Scheme: fmt.Sprintf("%s", config.Scheme),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Scheme: fmt.Sprintf("%s", config.Scheme),
Scheme: string(config.Scheme),

@mattmoor mattmoor left a comment

Copy link
Copy Markdown
Contributor

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

@joshrider

Copy link
Copy Markdown
Contributor Author

On the case 👍

Comment thread pkg/queue/health/probe.go Resolved
Comment thread pkg/queue/health/probe.go Resolved
Comment thread pkg/queue/health/probe_test.go Resolved
@knative-metrics-robot

Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/queue/health/probe.go 100.0% 90.9% -9.1

@mattmoor

mattmoor commented Jul 9, 2019

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 9, 2019
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[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

Details 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

@mattmoor mattmoor added cla: yes Indicates the PR's author has signed the CLA. and removed cla: no Indicates the PR's author has not signed the CLA. labels Jul 9, 2019
@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2019
@googlebot

Copy link
Copy Markdown

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.

@knative-prow-robot
knative-prow-robot merged commit 82596a8 into knative:master Jul 9, 2019
@joshrider
joshrider deleted the queue-health branch August 6, 2019 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/networking cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants