Skip to content

Commit d0d8b91

Browse files
knative-automationdprotasodsimansk
authored
[release-1.21] Upgrade to latest dependencies (#9097)
* upgrade to latest dependencies bumping knative.dev/pkg 4a022ed...011b23b: > 011b23b Limit the webhook request body size to 3MiB (# 3364) > 9b08ba8 fix compilation (# 3361) > 39109c9 Fix memory leak in expired matchers (# 3359) > 18c5d58 [release-1.21] Add network/tls package for TLS configuration (# 3337) bumping knative.dev/hack/schema bf6758c...c985ed3: > c985ed3 [release-1.21] Add env var to pass extra flag to license check (# 471) > e37ec67 Bump go-licenses to v2.0.1 release (# 468) bumping knative.dev/reconciler-test 4301404...75d4763: > 75d4763 Retry on transient K8s API errors in poll loops (# 892) > 9971c46 Fix DNS issue (# 894) > 03f8d11 Align downstream tests with common pattern (# 887) > 330ffb2 Fix port conflict in forwarder by disabling metrics server (# 867) > 5329fa2 fix: Ignore schema error correctly (# 866) > 6f2fbd7 Fix eventhub forwarder wait for service (# 862) bumping knative.dev/hack bf6758c...c985ed3: > c985ed3 [release-1.21] Add env var to pass extra flag to license check (# 471) > e37ec67 Bump go-licenses to v2.0.1 release (# 468) Signed-off-by: Knative Automation <automation@knative.team> * fix compilation * Fix tests --------- Signed-off-by: Knative Automation <automation@knative.team> Co-authored-by: Dave Protasowski <dprotaso@gmail.com> Co-authored-by: David Simansky <dsimansk@redhat.com>
1 parent c9f4c44 commit d0d8b91

14 files changed

Lines changed: 324 additions & 76 deletions

File tree

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ require (
4949
k8s.io/client-go v0.34.3
5050
k8s.io/code-generator v0.34.3
5151
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
52-
knative.dev/hack v0.0.0-20260120115810-bf6758cba446
53-
knative.dev/hack/schema v0.0.0-20260120115810-bf6758cba446
54-
knative.dev/pkg v0.0.0-20260120122510-4a022ed9999a
55-
knative.dev/reconciler-test v0.0.0-20260120140419-4301404c03ce
52+
knative.dev/hack v0.0.0-20260420222011-c985ed3cefe8
53+
knative.dev/hack/schema v0.0.0-20260420222011-c985ed3cefe8
54+
knative.dev/pkg v0.0.0-20260531000007-011b23bf6dfe
55+
knative.dev/reconciler-test v0.0.0-20260424102515-75d476349613
5656
sigs.k8s.io/randfill v1.0.0
5757
sigs.k8s.io/yaml v1.6.0
5858
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,14 +1092,14 @@ k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOP
10921092
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts=
10931093
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y=
10941094
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
1095-
knative.dev/hack v0.0.0-20260120115810-bf6758cba446 h1:Y8raYHIuAL9/gUKGYD9/dD+EqUTmrpqVDowzfUVSlGs=
1096-
knative.dev/hack v0.0.0-20260120115810-bf6758cba446/go.mod h1:L5RzHgbvam0u8QFHfzCX6MKxu/a/gIGEdaRBqNiVbl0=
1097-
knative.dev/hack/schema v0.0.0-20260120115810-bf6758cba446 h1:V7TW1ZOZObhVcDuN04tYvCfCjvvikv1qZR/6lcp6g4Q=
1098-
knative.dev/hack/schema v0.0.0-20260120115810-bf6758cba446/go.mod h1:KkibP1IazICP5ClxwN5D26LDSygsqbYnVGuGFTsHNOQ=
1099-
knative.dev/pkg v0.0.0-20260120122510-4a022ed9999a h1:9f29OTA7w/iVIX6PS6yveVVzNbcUS74eQfchVe8o2/4=
1100-
knative.dev/pkg v0.0.0-20260120122510-4a022ed9999a/go.mod h1:Tz3GoxcNC5vH3Zo//cW3mnHL474u+Y1wbsUIZ11p8No=
1101-
knative.dev/reconciler-test v0.0.0-20260120140419-4301404c03ce h1:pIQCFDsDTRkzrJZDTs2laryYOI6VpcnGF5zezL0NXOw=
1102-
knative.dev/reconciler-test v0.0.0-20260120140419-4301404c03ce/go.mod h1:FUaadFiniAaqqBp/D2g2cO/FUABVR8W4yZd2azDzp7I=
1095+
knative.dev/hack v0.0.0-20260420222011-c985ed3cefe8 h1:IrUBuFRxzqUm+f//hY6XGPzXozcoXD/dSsqcid84/Eg=
1096+
knative.dev/hack v0.0.0-20260420222011-c985ed3cefe8/go.mod h1:L5RzHgbvam0u8QFHfzCX6MKxu/a/gIGEdaRBqNiVbl0=
1097+
knative.dev/hack/schema v0.0.0-20260420222011-c985ed3cefe8 h1:E/dKOJvgjHiL5OtiPuX8Z9K3myWUHntMH9NWzR8SIzw=
1098+
knative.dev/hack/schema v0.0.0-20260420222011-c985ed3cefe8/go.mod h1:KkibP1IazICP5ClxwN5D26LDSygsqbYnVGuGFTsHNOQ=
1099+
knative.dev/pkg v0.0.0-20260531000007-011b23bf6dfe h1:Qu7Nt4pvpZ7wfoc7qP0BNsVfMECObzAerv5xD1Ml42s=
1100+
knative.dev/pkg v0.0.0-20260531000007-011b23bf6dfe/go.mod h1:Tz3GoxcNC5vH3Zo//cW3mnHL474u+Y1wbsUIZ11p8No=
1101+
knative.dev/reconciler-test v0.0.0-20260424102515-75d476349613 h1:LB7Jowx8eVwJKlMmHn0FkIk8NyeFiC0b1q/yTAjThrE=
1102+
knative.dev/reconciler-test v0.0.0-20260424102515-75d476349613/go.mod h1:FUaadFiniAaqqBp/D2g2cO/FUABVR8W4yZd2azDzp7I=
11031103
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
11041104
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
11051105
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

test/upgrade/prober/wathola/config/reader_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ address = 'http://default-broker.event-example.svc.cluster.local/
6161
})
6262

6363
// then
64-
assert.Contains(t, errors, "[toml: literal strings cannot have new lines]")
64+
assert.Contains(t, errors, "toml: literal strings cannot have new lines")
6565
}
6666

6767
func TestReadIfNotPresent(t *testing.T) {
@@ -139,7 +139,7 @@ func withConfigContents(t *testing.T, content string, fn func()) {
139139
t.Helper()
140140
configFile := ensureConfigFileNotPresent(t)
141141
data := []byte(content)
142-
assert.NoError(t, os.WriteFile(configFile, data, 0644))
142+
assert.NoError(t, os.WriteFile(configFile, data, 0o644))
143143
defer func() { assert.NoError(t, os.RemoveAll(configFile)) }()
144144
fn()
145145
}
@@ -150,7 +150,7 @@ func withErrorsCaptured(t *testing.T, fn func()) []string {
150150
defer func() { logFatal = origLogFatal }()
151151
var errors []string
152152
logFatal = func(args ...interface{}) {
153-
errors = append(errors, fmt.Sprint(args))
153+
errors = append(errors, fmt.Sprint(args...))
154154
}
155155
fn()
156156
return errors

vendor/knative.dev/hack/library.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ if [[ ! -v GOPATH ]]; then
3535
fi
3636
fi
3737

38+
# Pinned tool versions
39+
readonly GUM_VERSION="v0.14.1"
40+
readonly GOTESTSUM_VERSION="v1.13.0"
41+
readonly GOTESTFMT_VERSION="v2.5.0"
42+
readonly TERMINAL_TO_HTML_VERSION="v3.10.0"
43+
readonly GO_LICENSES_VERSION="v2.0.1"
44+
3845
# Useful environment variables
3946
[[ -v PROW_JOB_ID ]] && IS_PROW=1 || IS_PROW=0
4047
readonly IS_PROW
@@ -265,7 +272,7 @@ function gum_banner() {
265272

266273
# Simple info banner for logging purposes.
267274
function gum_style() {
268-
go_run github.com/charmbracelet/gum@v0.14.1 style "$@"
275+
go_run "github.com/charmbracelet/gum@${GUM_VERSION}" style "$@"
269276
}
270277

271278
# Checks whether the given function exists.
@@ -588,7 +595,7 @@ function report_go_test() {
588595
logfile="${logfile/.xml/.jsonl}"
589596
echo "Running go test with args: ${go_test_args[*]}"
590597
local gotest_retcode=0
591-
go_run gotest.tools/gotestsum@v1.13.0 \
598+
go_run "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
592599
--format "${GO_TEST_VERBOSITY:-testname}" \
593600
--junitfile "${xml}" \
594601
--junitfile-testsuite-name relative \
@@ -601,14 +608,14 @@ function report_go_test() {
601608
echo "Test log (JSONL) written to ${logfile}"
602609

603610
ansilog="${logfile/.jsonl/-ansi.log}"
604-
go_run github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.5.0 \
611+
go_run "github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@${GOTESTFMT_VERSION}" \
605612
-input "${logfile}" \
606613
-showteststatus \
607614
-nofail > "$ansilog"
608615
echo "Test log (ANSI) written to ${ansilog}"
609616

610617
htmllog="${logfile/.jsonl/.html}"
611-
go_run github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@v3.10.0 \
618+
go_run "github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@${TERMINAL_TO_HTML_VERSION}" \
612619
--preview < "$ansilog" > "$htmllog"
613620
echo "Test log (HTML) written to ${htmllog}"
614621

@@ -921,10 +928,10 @@ function run_kntest() {
921928
}
922929

923930
# Run go-licenses to check for forbidden licenses.
931+
# Extra flags can be passed via the GO_LICENSES_FLAGS environment variable.
924932
function check_licenses() {
925-
# Check that we don't have any forbidden licenses.
926-
go_run github.com/google/go-licenses@v1.6.0 \
927-
check "${REPO_ROOT_DIR}/..." || \
933+
go_run "github.com/google/go-licenses/v2@${GO_LICENSES_VERSION}" \
934+
check ${GO_LICENSES_FLAGS:-} "${REPO_ROOT_DIR}/..." || \
928935
{ echo "--- FAIL: go-licenses failed the license check"; return 1; }
929936
}
930937

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
Copyright 2026 The Knative Authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package tls
18+
19+
import (
20+
cryptotls "crypto/tls"
21+
"fmt"
22+
"os"
23+
"strings"
24+
)
25+
26+
// Environment variable name suffixes for TLS configuration.
27+
// Use with a prefix to namespace them, e.g. "WEBHOOK_" + MinVersionEnvKey
28+
// reads the WEBHOOK_TLS_MIN_VERSION variable.
29+
const (
30+
MinVersionEnvKey = "TLS_MIN_VERSION"
31+
MaxVersionEnvKey = "TLS_MAX_VERSION"
32+
CipherSuitesEnvKey = "TLS_CIPHER_SUITES"
33+
CurvePreferencesEnvKey = "TLS_CURVE_PREFERENCES"
34+
)
35+
36+
// DefaultConfigFromEnv returns a tls.Config with secure defaults.
37+
// The prefix is prepended to each standard env-var suffix;
38+
// for example with prefix "WEBHOOK_" the function reads
39+
// WEBHOOK_TLS_MIN_VERSION, WEBHOOK_TLS_MAX_VERSION, etc.
40+
func DefaultConfigFromEnv(prefix string) (*cryptotls.Config, error) {
41+
cfg := &cryptotls.Config{
42+
MinVersion: cryptotls.VersionTLS13,
43+
}
44+
45+
if v := os.Getenv(prefix + MinVersionEnvKey); v != "" {
46+
ver, err := parseVersion(v)
47+
if err != nil {
48+
return nil, fmt.Errorf("invalid %s%s %q: %w", prefix, MinVersionEnvKey, v, err)
49+
}
50+
cfg.MinVersion = ver
51+
}
52+
53+
if v := os.Getenv(prefix + MaxVersionEnvKey); v != "" {
54+
ver, err := parseVersion(v)
55+
if err != nil {
56+
return nil, fmt.Errorf("invalid %s%s %q: %w", prefix, MaxVersionEnvKey, v, err)
57+
}
58+
cfg.MaxVersion = ver
59+
}
60+
61+
if v := os.Getenv(prefix + CipherSuitesEnvKey); v != "" {
62+
suites, err := parseCipherSuites(v)
63+
if err != nil {
64+
return nil, fmt.Errorf("invalid %s%s: %w", prefix, CipherSuitesEnvKey, err)
65+
}
66+
cfg.CipherSuites = suites
67+
}
68+
69+
if v := os.Getenv(prefix + CurvePreferencesEnvKey); v != "" {
70+
curves, err := parseCurvePreferences(v)
71+
if err != nil {
72+
return nil, fmt.Errorf("invalid %s%s: %w", prefix, CurvePreferencesEnvKey, err)
73+
}
74+
cfg.CurvePreferences = curves
75+
}
76+
77+
return cfg, nil
78+
}
79+
80+
// parseVersion converts a TLS version string to the corresponding
81+
// crypto/tls constant. Accepted values are "1.2" and "1.3".
82+
func parseVersion(v string) (uint16, error) {
83+
switch v {
84+
case "1.2":
85+
return cryptotls.VersionTLS12, nil
86+
case "1.3":
87+
return cryptotls.VersionTLS13, nil
88+
default:
89+
return 0, fmt.Errorf("unsupported TLS version %q: must be %q or %q", v, "1.2", "1.3")
90+
}
91+
}
92+
93+
// parseCipherSuites parses a comma-separated list of TLS cipher-suite names
94+
// (e.g. "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384")
95+
// into a slice of cipher-suite IDs. Names must match those returned by
96+
// crypto/tls.CipherSuiteName.
97+
func parseCipherSuites(s string) ([]uint16, error) {
98+
lookup := cipherSuiteLookup()
99+
parts := strings.Split(s, ",")
100+
suites := make([]uint16, 0, len(parts))
101+
102+
for _, name := range parts {
103+
name = strings.TrimSpace(name)
104+
if name == "" {
105+
continue
106+
}
107+
id, ok := lookup[name]
108+
if !ok {
109+
return nil, fmt.Errorf("unknown cipher suite %q", name)
110+
}
111+
suites = append(suites, id)
112+
}
113+
114+
return suites, nil
115+
}
116+
117+
// parseCurvePreferences parses a comma-separated list of elliptic-curve names
118+
// (e.g. "X25519,CurveP256") into a slice of crypto/tls.CurveID values.
119+
// Both Go constant names (CurveP256) and standard names (P-256) are accepted.
120+
func parseCurvePreferences(s string) ([]cryptotls.CurveID, error) {
121+
parts := strings.Split(s, ",")
122+
curves := make([]cryptotls.CurveID, 0, len(parts))
123+
124+
for _, name := range parts {
125+
name = strings.TrimSpace(name)
126+
if name == "" {
127+
continue
128+
}
129+
id, ok := curvesByName[name]
130+
if !ok {
131+
return nil, fmt.Errorf("unknown curve %q", name)
132+
}
133+
curves = append(curves, id)
134+
}
135+
136+
return curves, nil
137+
}
138+
139+
func cipherSuiteLookup() map[string]uint16 {
140+
m := make(map[string]uint16)
141+
for _, cs := range cryptotls.CipherSuites() {
142+
m[cs.Name] = cs.ID
143+
}
144+
return m
145+
}
146+
147+
var curvesByName = map[string]cryptotls.CurveID{
148+
"CurveP256": cryptotls.CurveP256,
149+
"CurveP384": cryptotls.CurveP384,
150+
"CurveP521": cryptotls.CurveP521,
151+
"X25519": cryptotls.X25519,
152+
"X25519MLKEM768": cryptotls.X25519MLKEM768,
153+
"P-256": cryptotls.CurveP256,
154+
"P-384": cryptotls.CurveP384,
155+
"P-521": cryptotls.CurveP521,
156+
}

vendor/knative.dev/pkg/tracker/enqueue.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ func (i *impl) GetObservers(obj interface{}) []types.NamespacedName {
277277
keys = append(keys, key)
278278
}
279279
}
280-
if len(s) == 0 {
281-
delete(i.exact, ref)
280+
if len(ms) == 0 {
281+
delete(i.inexact, ref)
282282
}
283283
}
284284

@@ -309,7 +309,7 @@ func (i *impl) OnDeletedObserver(obj interface{}) {
309309
for ref, matchers := range i.inexact {
310310
delete(matchers, key)
311311
if len(matchers) == 0 {
312-
delete(i.exact, ref)
312+
delete(i.inexact, ref)
313313
}
314314
}
315315
}

vendor/knative.dev/pkg/webhook/env.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ func SecretNameFromEnv(defaultSecretName string) string {
7272
return secret
7373
}
7474

75+
// Deprecated: Use knative.dev/pkg/network/tls.DefaultConfigFromEnv instead.
76+
// TLS configuration is now read automatically inside webhook.New via the shared tls package.
7577
func TLSMinVersionFromEnv(defaultTLSMinVersion uint16) uint16 {
7678
switch tlsMinVersion := os.Getenv(tlsMinVersionEnvKey); tlsMinVersion {
7779
case "1.2":

0 commit comments

Comments
 (0)