Skip to content

Commit

Permalink
[release-1.11] sync with upstream (#489)
Browse files Browse the repository at this point in the history
* [release-1.11] fix securityContext for Knative Service Pod (user-container and queue-proxy) (knative#14378)

* add seccompProfile to queue container security context

* run as non root by default

* update tests to expect new default run as nonroot

---------

Co-authored-by: Clay Kauzlaric <ckauzlaric@vmware.com>

* Leave a comment which will trigger a new dot release (knative#14500)

* [release-1.11] bump x/net to v0.17 (knative#14516)

* [release-1.11] bump x/net to v1.17

* Re-generate test/config/tls/cert-secret.yaml (knative#14324)

* Run hack/update-codegen.sh --upgrade --release 1.11

* Bound buffer for reading stats (knative#14542)

Co-authored-by: Evan Anderson <evan.k.anderson@gmail.com>

---------

Co-authored-by: Knative Prow Robot <automation+prow-robot@knative.team>
Co-authored-by: Clay Kauzlaric <ckauzlaric@vmware.com>
Co-authored-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
Co-authored-by: Evan Anderson <evan.k.anderson@gmail.com>
  • Loading branch information
5 people committed Oct 20, 2023
1 parent daa44ca commit b504942
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/autoscaler/metrics/http_scrape_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ func statFromProto(body io.Reader) (Stat, error) {
b := pool.Get().(*bytes.Buffer)
b.Reset()
defer pool.Put(b)
_, err := b.ReadFrom(body)
// 6 8-byte fields (+2 bytes marshalling), one hostname, 20 bytes extra space
r := io.LimitedReader{R: body, N: 6*10 + 256 + 20}
_, err := b.ReadFrom(&r)
if err != nil {
return emptyStat, fmt.Errorf("reading body failed: %w", err)
}
Expand Down
15 changes: 15 additions & 0 deletions pkg/autoscaler/metrics/http_scrape_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@ func TestHTTPScrapeClientScrapeProtoErrorCases(t *testing.T) {
responseCode: http.StatusOK,
responseType: "text/html",
expectedErr: errUnsupportedMetricType.Error(),
}, {
name: "LongStat",
responseCode: http.StatusOK,
responseType: "application/protobuf",
stat: Stat{
// We don't expect PodName to be 600 characters long
PodName: strings.Repeat("a123456789", 60),
AverageConcurrentRequests: 1.1,
AverageProxiedConcurrentRequests: 1.1,
RequestCount: 33.2,
ProxiedRequestCount: 33.2,
ProcessUptime: 12345.678,
Timestamp: 1697431278,
},
expectedErr: "unmarshalling failed: unexpected EOF",
}}

for _, test := range testCases {
Expand Down

0 comments on commit b504942

Please sign in to comment.