Add common probe path in autoscaler, networking and activator#7445
Add common probe path in autoscaler, networking and activator#7445knative-prow-robot merged 6 commits intoknative:masterfrom
Conversation
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
|
/assign @vagababov |
|
|
||
| httpDest := url.URL{ | ||
| Scheme: "http", | ||
| Host: fmt.Sprintf("%s:%d", svc, port), |
There was a problem hiding this comment.
| Host: fmt.Sprintf("%s:%d", svc, port), | |
| Host: svc + ":" + strconv.Itoa(port), |
There was a problem hiding this comment.
I'd also recommend doing
u, _ := url.Parse(fmt.Sprintf("http://%s:%d/", svc, port))
u.Path = path.Join(u.Path, probePath)
return u.String()
perhaps with error handling, but we kind of know it won't fail here...
There was a problem hiding this comment.
But why "u.Path = path.Join(u.Path, probePath)" since we already know u.Path should be empty by definition in above line
There was a problem hiding this comment.
Is it empty? Or is it "/"? Your path does it have "/" prefix or not. This takes care of all the cases.
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
test/config/security/policy.yaml
Outdated
| @@ -46,4 +46,6 @@ spec: | |||
| - excludedPaths: | |||
| - prefix: /metrics | |||
| - prefix: /_internal/knative/activator/probe | |||
There was a problem hiding this comment.
Is there value in having different paths?
There was a problem hiding this comment.
I actually have no idea, and was wondering too if everything will work with a common path. @tcnghia @vagababov ?
There was a problem hiding this comment.
we don't check paths. But if we're going generic, then we should pick a generic name :)
There was a problem hiding this comment.
Having a single path probably makes more sense because it makes writing policies easier and it is more future proof (when we add or remove components).
There was a problem hiding this comment.
Makes sense. Should the common path be something that we expect customer services won't have in their their application logic? Or can it be very short like "\probe". I had assumed that we had a complicated name with "_knative\internal..." to reduce chances of collision with customer service paths
There was a problem hiding this comment.
@yolocs do you have a recommendation here?
May be something like /healthz would work. Also, if we allow this to be customized then our customers can avoid a collision even for shorter paths.
There was a problem hiding this comment.
Given we intercept the request it is of less importance if it matches (still a problem if the network rule matches).
But having something like /__probe__ should mostly work.
There was a problem hiding this comment.
I would prefer /healthz as it seems like pretty common path for health check. My thinking is for something default, it's better to meet most common path. If a user runs into a conflict, the config is there for them to override.
There was a problem hiding this comment.
As @vagababov said, the path can be anything, so let's use something simple and if possible that is somewhat "standard" in the Kubernetes world. /healthz seems appropriate.
pkg/network/status/status.go
Outdated
| return dialContext(ctx, network, net.JoinHostPort(item.podIP, item.podPort)) | ||
| }} | ||
|
|
||
| probeUrl, _ := url.Parse(item.url.String()) |
There was a problem hiding this comment.
Please add a comment that it's safe to ignore the error because this is a "deepCopy" of the URL. Maybe even put it into it's own deepCopy(in *url.URL) *url.URL function for clarity?
There was a problem hiding this comment.
Made changes in new commit
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
Unable to apply comments to the following files:
pkg/network/status/status.go
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
Co-Authored-By: Matt Moore <mattmoor@vmware.com>
|
you can avoid those errors by installing autoformat on save for whatever editor you're using, unless it's pico or something :) |
|
The following jobs failed:
Failed non-flaky tests preventing automatic retry of pull-knative-serving-unit-tests: |
Co-Authored-By: Victor Agababov <vagababov@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: shreejad, vagababov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
The following is the coverage report on the affected files.
|
Autoscaler, activator and KIngres Prober commonly use the probe path `/healthz`, but they defined it in each package. This patch adds const value for ProbePath and use it from them. Related to knative#7445
* Use common const value for probe path Autoscaler, activator and KIngres Prober commonly use the probe path `/healthz`, but they defined it in each package. This patch adds const value for ProbePath and use it from them. Related to #7445 * Fix lint error
Fixes #5918