-
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
Activator Header Fixes #2047
Activator Header Fixes #2047
Conversation
Holding for verification /hold |
/test pull-knative-serving-integration-tests
…On Mon, Sep 17, 2018 at 21:14 Knative Prow Robot ***@***.***> wrote:
@dprotaso <https://github.com/dprotaso>: The following test *failed*, say
/retest to rerun them all:
Test name Commit Details Rerun command
pull-knative-serving-integration-tests 55d5545
<55d5545>
link
<https://gubernator.knative.dev/build/knative-prow/pr-logs/pull/knative_serving/2047/pull-knative-serving-integration-tests/1041851527704088578/> /test
pull-knative-serving-integration-tests
Full PR test history
<https://gubernator.knative.dev/pr/knative_serving/2047>. Your PR
dashboard <https://gubernator.knative.dev/pr/dprotaso>.
Instructions for interacting with me using PR comments are available here
<https://git.k8s.io/community/contributors/guide/pull-requests.md>. If
you have questions or suggestions related to my behavior, please file an
issue against the kubernetes/test-infra
<https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:>
repository. I understand the commands that are listed here
<https://go.k8s.io/bot-commands>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2047 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABIgjrNRBkMx4m6XvGLfzXBgGk--O6xks5ucEjzgaJpZM4Ws-Tp>
.
|
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 not sure this actually fixes #2046 since that issue is about confusion inside of the activator if an external entity sets these headers. This fixes the case where a service would forward the request as-is (and thus act as an external entity setting these headers), correct?
pkg/activator/handler/handler.go
Outdated
|
||
for _, h := range headersToRemove { | ||
if r.Header.Get(h) != "" { | ||
r.Header.Del(h) |
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 think you can omit the surrounding if
since Del
will delegate to delete
which is a noop if nothing is there to delete.
pkg/activator/handler/handler.go
Outdated
} | ||
|
||
orig := p.Director | ||
p.Director = func(r *http.Request) { |
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.
For my own understanding: Is it not possible to just drop the headers from the incoming request? Is it done this way to keep the incoming request object intact so other methods can happily use the headers just like today?
pkg/activator/handler/handler.go
Outdated
activator.ConfigurationHeader, | ||
activator.RevisionHeaderName, | ||
activator.RevisionHeaderNamespace, | ||
} |
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.
Should this be a global constant/variable to avoid reallocations?
It's not the external entity (ie. outside the service mesh) setting the header - it's the virtual service. I would say that's another related issue. Ideally we need the ingress to prune these header when they come from outside the mesh.
Actually - this requires changes to the queue proxy. I'll update the PR to include that |
55d5545
to
871d657
Compare
/assign @markusthoemmes |
871d657
to
6f02de4
Compare
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.
Implementation is LGTM, got some nits in the comments.
pkg/activator/util/header.go
Outdated
activator.RevisionHeaderNamespace, | ||
} | ||
|
||
func SetupHeaderPruning(p *httputil.ReverseProxy) { |
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.
Please add a comment.
pkg/activator/util/header.go
Outdated
} | ||
} | ||
|
||
func GetLastHeaderValue(r *http.Request, key string) string { |
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.
Please add a comment.
Should we narrow the interface to pass in r.Headers
vs. passing in the whole request?
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 was debating about that - it's obvious from the test that it should receive http.Header - i just chose to ignore it.
I'll make the change
Testing with this PR, the chain of functions that failed previously will now scale from zero as expected. |
6f02de4
to
674b7e1
Compare
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
Nice one, great tests! 🎉
674b7e1
to
ef109d6
Compare
@markusthoemmes sorry made a minor style change
to
|
/hold cancel |
/lgtm |
/test pull-knative-serving-integration-tests |
2 similar comments
/test pull-knative-serving-integration-tests |
/test pull-knative-serving-integration-tests |
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
pkg/activator/util/header.go
Outdated
} | ||
|
||
// SetupHeaderPruning will cause the http.ReverseProxy | ||
// to no forward activator headers |
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.
Nit: ... to no[t] forward ...
/assign @mattmoor |
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 |
/consent
…On Tue, Sep 18, 2018 at 18:47 Knative Prow Robot ***@***.***> wrote:
[APPROVALNOTIFIER] This PR is *NOT APPROVED*
This pull-request has been approved by: *dprotaso
<#2047#>*, *josephburnett
<#2047 (review)>*
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: *mattmoor*
If they are not already assigned, you can assign the PR to them by writing /assign
@mattmoor in a comment when ready.
The full list of commands accepted by this bot can be found here
<https://go.k8s.io/bot-commands>.
The pull request process is described here
<https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process>
Needs approval from an approver in each of these files:
- *OWNERS <https://github.com/knative/serving/blob/master/OWNERS>*
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2047 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABIgp9S4w2aABbV7bE3EJsPe47FCbDMks5ucXfzgaJpZM4Ws-Tp>
.
|
/consent |
We need an admin to merge this. I will talk to @isdal |
c913ba3
to
1d6f042
Compare
CLAs look good, thanks! |
The following is the coverage report on pkg/.
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, josephburnett, 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 |
Fixes #2046