upgrade to latest dependencies (#386)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2020-11-17 05:15:52 -08:00 committed by GitHub
parent ee88f74454
commit cc6e7612ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 6 deletions

2
go.mod
View File

@ -18,7 +18,7 @@ require (
k8s.io/code-generator v0.18.8
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
knative.dev/hack v0.0.0-20201112185459-01a34c573bd8
knative.dev/pkg v0.0.0-20201112201059-93fedf141385
knative.dev/pkg v0.0.0-20201117020252-ab1a398f669c
)
replace (

6
go.sum
View File

@ -1129,12 +1129,10 @@ k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7MpmSnvtrOieolJKoE=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/hack v0.0.0-20201103151104-3d5abc3a0075 h1:YAgWplKIy4O5e3F5vUUECmXAAyZ0M5ymo6fCt1jeZhs=
knative.dev/hack v0.0.0-20201103151104-3d5abc3a0075/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20201112185459-01a34c573bd8 h1:RNbZsAjhswBPtl4C5C5gEFX5/GfWIOZQxfYD9DhkHdY=
knative.dev/hack v0.0.0-20201112185459-01a34c573bd8/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20201112201059-93fedf141385 h1:DcYWVnDpcvKZR/Rh+8X2Qkq89jbBo6yLNV1qBifovBk=
knative.dev/pkg v0.0.0-20201112201059-93fedf141385/go.mod h1:5vNHKNtZtzlNeNrcDoUtZIn+dma/8DjmpjfdHiwoQyM=
knative.dev/pkg v0.0.0-20201117020252-ab1a398f669c h1:dMBwabvusJrldjzIj4lces/96SnVgFXV7Kpv9z9fiCI=
knative.dev/pkg v0.0.0-20201117020252-ab1a398f669c/go.mod h1:4kXxEyYWdNk3pUR6/cx/ToMKG/dAJvEpDYUfV5RYHeU=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

View File

@ -17,6 +17,7 @@ limitations under the License.
package network
import (
"fmt"
"net/http"
"strings"
"time"
@ -54,6 +55,16 @@ const (
// included in request metrics.
ProbeHeaderName = "K-Network-Probe"
// ProbeHeaderValue is the value of a header that can be added to
// requests to probe the knative networking layer. Requests
// with `K-Network-Probe` this value will not be passed to the user
// container or included in request metrics.
ProbeHeaderValue = "probe"
// HashHeaderName is the name of an internal header that Ingress controller
// uses to find out which version of the networking config is deployed.
HashHeaderName = "K-Network-Hash"
// Since K8s 1.8, prober requests have
// User-Agent = "kube-probe/{major-version}.{minor-version}".
KubeProbeUAPrefix = "kube-probe/"
@ -68,3 +79,19 @@ func IsKubeletProbe(r *http.Request) bool {
return strings.HasPrefix(r.Header.Get("User-Agent"), KubeProbeUAPrefix) ||
r.Header.Get(KubeletProbeHeaderName) != ""
}
// IsKProbe returns true if the request is a knatvie probe.
func IsKProbe(r *http.Request) bool {
return r.Header.Get(ProbeHeaderName) == ProbeHeaderValue
}
// ServeKProbe serve KProbe requests.
func ServeKProbe(w http.ResponseWriter, r *http.Request) {
hh := r.Header.Get(HashHeaderName)
if hh == "" {
http.Error(w, fmt.Sprintf("a probe request must contain a non-empty %q header", HashHeaderName), http.StatusBadRequest)
return
}
w.Header().Set(HashHeaderName, hh)
w.WriteHeader(http.StatusOK)
}

2
vendor/modules.txt vendored
View File

@ -742,7 +742,7 @@ k8s.io/utils/trace
# knative.dev/hack v0.0.0-20201112185459-01a34c573bd8
## explicit
knative.dev/hack
# knative.dev/pkg v0.0.0-20201112201059-93fedf141385
# knative.dev/pkg v0.0.0-20201117020252-ab1a398f669c
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck