diff --git a/go.mod b/go.mod index 759b5e794b..9a61f596f0 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( k8s.io/apimachinery v0.23.9 k8s.io/client-go v0.23.9 knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3 - knative.dev/networking v0.0.0-20220818010248-e51df7cdf571 - knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15 + knative.dev/networking v0.0.0-20221208211516-5f25a81cd43e + knative.dev/pkg v0.0.0-20221123011941-9d7bd235ceed ) require ( diff --git a/go.sum b/go.sum index ce51c8b153..d0f572dbe4 100644 --- a/go.sum +++ b/go.sum @@ -1135,10 +1135,10 @@ k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19V k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3 h1:umaeMRecA0g5g48L9tnEAkTBIitr9eKWMyJYo9YttAA= knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3/go.mod h1:t/azP8I/Cygaw+87O7rkAPrNRjCelmtfSzWzu/9TM7I= -knative.dev/networking v0.0.0-20220818010248-e51df7cdf571 h1:Lu/TsJjxg1p+2CMr2LNHEdEFBNHYjDoZv2f1QZoM8jg= -knative.dev/networking v0.0.0-20220818010248-e51df7cdf571/go.mod h1:m3ataWRwmbHjOY9sCFvcDWRNLVITxVl0fH0RxdCa4jE= -knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15 h1:GNmzHVaUo3zoi/wtIN71LPQaWy6DdoYzmb+GIq2s4fw= -knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15/go.mod h1:YLjXbkQLlGHok+u0FLfMbBHFzY9WGu3GHhnrptoAy8I= +knative.dev/networking v0.0.0-20221208211516-5f25a81cd43e h1:Ys3mJ0wYF+1OvdevtqACQX+HiHpZU4kVEE33/rNNzmI= +knative.dev/networking v0.0.0-20221208211516-5f25a81cd43e/go.mod h1:m3ataWRwmbHjOY9sCFvcDWRNLVITxVl0fH0RxdCa4jE= +knative.dev/pkg v0.0.0-20221123011941-9d7bd235ceed h1:Xk4DRdbRdI7Ky8vOGQK4S3nUHTRRpTjRMsK+9Zif94s= +knative.dev/pkg v0.0.0-20221123011941-9d7bd235ceed/go.mod h1:M+Amt1YZl5Nkl6+5FDFVIPaivsk2o5K/cIzOVq6Nsg0= 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= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/k8s.io/apimachinery/pkg/util/clock/clock.go b/vendor/k8s.io/apimachinery/pkg/util/clock/clock.go deleted file mode 100644 index 1a544d3b2e..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/util/clock/clock.go +++ /dev/null @@ -1,445 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package clock - -import ( - "sync" - "time" -) - -// PassiveClock allows for injecting fake or real clocks into code -// that needs to read the current time but does not support scheduling -// activity in the future. -type PassiveClock interface { - Now() time.Time - Since(time.Time) time.Duration -} - -// Clock allows for injecting fake or real clocks into code that -// needs to do arbitrary things based on time. -type Clock interface { - PassiveClock - After(time.Duration) <-chan time.Time - AfterFunc(time.Duration, func()) Timer - NewTimer(time.Duration) Timer - Sleep(time.Duration) - NewTicker(time.Duration) Ticker -} - -// RealClock really calls time.Now() -type RealClock struct{} - -// Now returns the current time. -func (RealClock) Now() time.Time { - return time.Now() -} - -// Since returns time since the specified timestamp. -func (RealClock) Since(ts time.Time) time.Duration { - return time.Since(ts) -} - -// After is the same as time.After(d). -func (RealClock) After(d time.Duration) <-chan time.Time { - return time.After(d) -} - -// AfterFunc is the same as time.AfterFunc(d, f). -func (RealClock) AfterFunc(d time.Duration, f func()) Timer { - return &realTimer{ - timer: time.AfterFunc(d, f), - } -} - -// NewTimer returns a new Timer. -func (RealClock) NewTimer(d time.Duration) Timer { - return &realTimer{ - timer: time.NewTimer(d), - } -} - -// NewTicker returns a new Ticker. -func (RealClock) NewTicker(d time.Duration) Ticker { - return &realTicker{ - ticker: time.NewTicker(d), - } -} - -// Sleep pauses the RealClock for duration d. -func (RealClock) Sleep(d time.Duration) { - time.Sleep(d) -} - -// FakePassiveClock implements PassiveClock, but returns an arbitrary time. -type FakePassiveClock struct { - lock sync.RWMutex - time time.Time -} - -// FakeClock implements Clock, but returns an arbitrary time. -type FakeClock struct { - FakePassiveClock - - // waiters are waiting for the fake time to pass their specified time - waiters []fakeClockWaiter -} - -type fakeClockWaiter struct { - targetTime time.Time - stepInterval time.Duration - skipIfBlocked bool - destChan chan time.Time - afterFunc func() -} - -// NewFakePassiveClock returns a new FakePassiveClock. -func NewFakePassiveClock(t time.Time) *FakePassiveClock { - return &FakePassiveClock{ - time: t, - } -} - -// NewFakeClock returns a new FakeClock -func NewFakeClock(t time.Time) *FakeClock { - return &FakeClock{ - FakePassiveClock: *NewFakePassiveClock(t), - } -} - -// Now returns f's time. -func (f *FakePassiveClock) Now() time.Time { - f.lock.RLock() - defer f.lock.RUnlock() - return f.time -} - -// Since returns time since the time in f. -func (f *FakePassiveClock) Since(ts time.Time) time.Duration { - f.lock.RLock() - defer f.lock.RUnlock() - return f.time.Sub(ts) -} - -// SetTime sets the time on the FakePassiveClock. -func (f *FakePassiveClock) SetTime(t time.Time) { - f.lock.Lock() - defer f.lock.Unlock() - f.time = t -} - -// After is the Fake version of time.After(d). -func (f *FakeClock) After(d time.Duration) <-chan time.Time { - f.lock.Lock() - defer f.lock.Unlock() - stopTime := f.time.Add(d) - ch := make(chan time.Time, 1) // Don't block! - f.waiters = append(f.waiters, fakeClockWaiter{ - targetTime: stopTime, - destChan: ch, - }) - return ch -} - -// AfterFunc is the Fake version of time.AfterFunc(d, callback). -func (f *FakeClock) AfterFunc(d time.Duration, cb func()) Timer { - f.lock.Lock() - defer f.lock.Unlock() - stopTime := f.time.Add(d) - ch := make(chan time.Time, 1) // Don't block! - - timer := &fakeTimer{ - fakeClock: f, - waiter: fakeClockWaiter{ - targetTime: stopTime, - destChan: ch, - afterFunc: cb, - }, - } - f.waiters = append(f.waiters, timer.waiter) - return timer -} - -// NewTimer is the Fake version of time.NewTimer(d). -func (f *FakeClock) NewTimer(d time.Duration) Timer { - f.lock.Lock() - defer f.lock.Unlock() - stopTime := f.time.Add(d) - ch := make(chan time.Time, 1) // Don't block! - timer := &fakeTimer{ - fakeClock: f, - waiter: fakeClockWaiter{ - targetTime: stopTime, - destChan: ch, - }, - } - f.waiters = append(f.waiters, timer.waiter) - return timer -} - -// NewTicker returns a new Ticker. -func (f *FakeClock) NewTicker(d time.Duration) Ticker { - f.lock.Lock() - defer f.lock.Unlock() - tickTime := f.time.Add(d) - ch := make(chan time.Time, 1) // hold one tick - f.waiters = append(f.waiters, fakeClockWaiter{ - targetTime: tickTime, - stepInterval: d, - skipIfBlocked: true, - destChan: ch, - }) - - return &fakeTicker{ - c: ch, - } -} - -// Step moves clock by Duration, notifies anyone that's called After, Tick, or NewTimer -func (f *FakeClock) Step(d time.Duration) { - f.lock.Lock() - defer f.lock.Unlock() - f.setTimeLocked(f.time.Add(d)) -} - -// SetTime sets the time on a FakeClock. -func (f *FakeClock) SetTime(t time.Time) { - f.lock.Lock() - defer f.lock.Unlock() - f.setTimeLocked(t) -} - -// Actually changes the time and checks any waiters. f must be write-locked. -func (f *FakeClock) setTimeLocked(t time.Time) { - f.time = t - newWaiters := make([]fakeClockWaiter, 0, len(f.waiters)) - for i := range f.waiters { - w := &f.waiters[i] - if !w.targetTime.After(t) { - - if w.skipIfBlocked { - select { - case w.destChan <- t: - default: - } - } else { - w.destChan <- t - } - - if w.afterFunc != nil { - w.afterFunc() - } - - if w.stepInterval > 0 { - for !w.targetTime.After(t) { - w.targetTime = w.targetTime.Add(w.stepInterval) - } - newWaiters = append(newWaiters, *w) - } - - } else { - newWaiters = append(newWaiters, f.waiters[i]) - } - } - f.waiters = newWaiters -} - -// HasWaiters returns true if After or AfterFunc has been called on f but not yet satisfied -// (so you can write race-free tests). -func (f *FakeClock) HasWaiters() bool { - f.lock.RLock() - defer f.lock.RUnlock() - return len(f.waiters) > 0 -} - -// Sleep pauses the FakeClock for duration d. -func (f *FakeClock) Sleep(d time.Duration) { - f.Step(d) -} - -// IntervalClock implements Clock, but each invocation of Now steps the clock forward the specified duration -type IntervalClock struct { - Time time.Time - Duration time.Duration -} - -// Now returns i's time. -func (i *IntervalClock) Now() time.Time { - i.Time = i.Time.Add(i.Duration) - return i.Time -} - -// Since returns time since the time in i. -func (i *IntervalClock) Since(ts time.Time) time.Duration { - return i.Time.Sub(ts) -} - -// After is currently unimplemented, will panic. -// TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) After(d time.Duration) <-chan time.Time { - panic("IntervalClock doesn't implement After") -} - -// AfterFunc is currently unimplemented, will panic. -// TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) AfterFunc(d time.Duration, cb func()) Timer { - panic("IntervalClock doesn't implement AfterFunc") -} - -// NewTimer is currently unimplemented, will panic. -// TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) NewTimer(d time.Duration) Timer { - panic("IntervalClock doesn't implement NewTimer") -} - -// NewTicker is currently unimplemented, will panic. -// TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) NewTicker(d time.Duration) Ticker { - panic("IntervalClock doesn't implement NewTicker") -} - -// Sleep is currently unimplemented; will panic. -func (*IntervalClock) Sleep(d time.Duration) { - panic("IntervalClock doesn't implement Sleep") -} - -// Timer allows for injecting fake or real timers into code that -// needs to do arbitrary things based on time. -type Timer interface { - C() <-chan time.Time - Stop() bool - Reset(d time.Duration) bool -} - -// realTimer is backed by an actual time.Timer. -type realTimer struct { - timer *time.Timer -} - -// C returns the underlying timer's channel. -func (r *realTimer) C() <-chan time.Time { - return r.timer.C -} - -// Stop calls Stop() on the underlying timer. -func (r *realTimer) Stop() bool { - return r.timer.Stop() -} - -// Reset calls Reset() on the underlying timer. -func (r *realTimer) Reset(d time.Duration) bool { - return r.timer.Reset(d) -} - -// fakeTimer implements Timer based on a FakeClock. -type fakeTimer struct { - fakeClock *FakeClock - waiter fakeClockWaiter -} - -// C returns the channel that notifies when this timer has fired. -func (f *fakeTimer) C() <-chan time.Time { - return f.waiter.destChan -} - -// Stop conditionally stops the timer. If the timer has neither fired -// nor been stopped then this call stops the timer and returns true, -// otherwise this call returns false. This is like time.Timer::Stop. -func (f *fakeTimer) Stop() bool { - f.fakeClock.lock.Lock() - defer f.fakeClock.lock.Unlock() - // The timer has already fired or been stopped, unless it is found - // among the clock's waiters. - stopped := false - oldWaiters := f.fakeClock.waiters - newWaiters := make([]fakeClockWaiter, 0, len(oldWaiters)) - seekChan := f.waiter.destChan - for i := range oldWaiters { - // Identify the timer's fakeClockWaiter by the identity of the - // destination channel, nothing else is necessarily unique and - // constant since the timer's creation. - if oldWaiters[i].destChan == seekChan { - stopped = true - } else { - newWaiters = append(newWaiters, oldWaiters[i]) - } - } - - f.fakeClock.waiters = newWaiters - - return stopped -} - -// Reset conditionally updates the firing time of the timer. If the -// timer has neither fired nor been stopped then this call resets the -// timer to the fake clock's "now" + d and returns true, otherwise -// it creates a new waiter, adds it to the clock, and returns true. -// -// It is not possible to return false, because a fake timer can be reset -// from any state (waiting to fire, already fired, and stopped). -// -// See the GoDoc for time.Timer::Reset for more context on why -// the return value of Reset() is not useful. -func (f *fakeTimer) Reset(d time.Duration) bool { - f.fakeClock.lock.Lock() - defer f.fakeClock.lock.Unlock() - waiters := f.fakeClock.waiters - seekChan := f.waiter.destChan - for i := range waiters { - if waiters[i].destChan == seekChan { - waiters[i].targetTime = f.fakeClock.time.Add(d) - return true - } - } - // No existing waiter, timer has already fired or been reset. - // We should still enable Reset() to succeed by creating a - // new waiter and adding it to the clock's waiters. - newWaiter := fakeClockWaiter{ - targetTime: f.fakeClock.time.Add(d), - destChan: seekChan, - } - f.fakeClock.waiters = append(f.fakeClock.waiters, newWaiter) - return true -} - -// Ticker defines the Ticker interface -type Ticker interface { - C() <-chan time.Time - Stop() -} - -type realTicker struct { - ticker *time.Ticker -} - -func (t *realTicker) C() <-chan time.Time { - return t.ticker.C -} - -func (t *realTicker) Stop() { - t.ticker.Stop() -} - -type fakeTicker struct { - c <-chan time.Time -} - -func (t *fakeTicker) C() <-chan time.Time { - return t.c -} - -func (t *fakeTicker) Stop() { -} diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/register.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/register.go index a56db83f95..65c1fdfe2d 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/register.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/fake/register.go @@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/vendor/knative.dev/networking/pkg/client/clientset/versioned/scheme/register.go b/vendor/knative.dev/networking/pkg/client/clientset/versioned/scheme/register.go index 1927729369..a853ca0fca 100644 --- a/vendor/knative.dev/networking/pkg/client/clientset/versioned/scheme/register.go +++ b/vendor/knative.dev/networking/pkg/client/clientset/versioned/scheme/register.go @@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/vendor/knative.dev/networking/pkg/config/config.go b/vendor/knative.dev/networking/pkg/config/config.go index 30580161a8..a05e43148d 100644 --- a/vendor/knative.dev/networking/pkg/config/config.go +++ b/vendor/knative.dev/networking/pkg/config/config.go @@ -20,7 +20,7 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" + "io" "net/url" "strings" "text/template" @@ -418,7 +418,7 @@ func checkTagTemplate(t *template.Template) error { Name: "foo", Tag: "v2", } - return t.Execute(ioutil.Discard, data) + return t.Execute(io.Discard, data) } // asLabelSelector returns a LabelSelector extracted from a given configmap key. diff --git a/vendor/knative.dev/networking/pkg/ingress/ingress.go b/vendor/knative.dev/networking/pkg/ingress/ingress.go index e0a9466943..5e24eecfa9 100644 --- a/vendor/knative.dev/networking/pkg/ingress/ingress.go +++ b/vendor/knative.dev/networking/pkg/ingress/ingress.go @@ -111,8 +111,9 @@ func ExpandedHosts(hosts sets.String) sets.String { // Validate that the Top Level Domain of a given hostname is valid. // Current checks: -// - not all digits -// - len < 64 +// - not all digits +// - len < 64 +// // Example: '1234' is an invalid TLD func isValidTopLevelDomain(domain string) bool { parts := strings.Split(domain, ".") diff --git a/vendor/knative.dev/networking/pkg/prober/prober.go b/vendor/knative.dev/networking/pkg/prober/prober.go index 6b216609aa..4ff7fb06ec 100644 --- a/vendor/knative.dev/networking/pkg/prober/prober.go +++ b/vendor/knative.dev/networking/pkg/prober/prober.go @@ -19,7 +19,7 @@ package prober import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "sync" "time" @@ -110,7 +110,7 @@ func Do(ctx context.Context, transport http.RoundTripper, target string, ops ... return false, fmt.Errorf("error roundtripping %s: %w", target, err) } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return false, fmt.Errorf("error reading body: %w", err) } diff --git a/vendor/knative.dev/networking/test/conformance/ingress/util.go b/vendor/knative.dev/networking/test/conformance/ingress/util.go index c99dc90fe0..c56fb8015e 100644 --- a/vendor/knative.dev/networking/test/conformance/ingress/util.go +++ b/vendor/knative.dev/networking/test/conformance/ingress/util.go @@ -29,7 +29,7 @@ import ( "encoding/pem" "errors" "fmt" - "io/ioutil" + "io" "math/big" "math/rand" "net" @@ -1134,7 +1134,7 @@ func RuntimeRequestWithExpectations(ctx context.Context, t *testing.T, client *h } if resp.StatusCode == http.StatusOK { - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { t.Error("Unable to read response body:", err) DumpResponse(ctx, t, resp) diff --git a/vendor/knative.dev/networking/test/test_images/runtime/handlers/cgroup.go b/vendor/knative.dev/networking/test/test_images/runtime/handlers/cgroup.go index 8bada7e15b..2eb57776e3 100644 --- a/vendor/knative.dev/networking/test/test_images/runtime/handlers/cgroup.go +++ b/vendor/knative.dev/networking/test/test_images/runtime/handlers/cgroup.go @@ -17,7 +17,6 @@ limitations under the License. package handlers import ( - "io/ioutil" "os" "strconv" "strings" @@ -46,7 +45,7 @@ func cgroups(paths ...string) []*types.Cgroup { continue } - bc, err := ioutil.ReadFile(path) + bc, err := os.ReadFile(path) if err != nil { cgroups = append(cgroups, &types.Cgroup{Name: path, Error: err.Error()}) continue @@ -61,7 +60,7 @@ func cgroups(paths ...string) []*types.Cgroup { // Try to write to the Cgroup. We expect this to fail as a cheap // method for read-only validation newValue := []byte{'9'} - err = ioutil.WriteFile(path, newValue, 0644) + err = os.WriteFile(path, newValue, 0644) if err != nil { cgroups = append(cgroups, &types.Cgroup{Name: path, Value: &ic, ReadOnly: &yes}) } else { diff --git a/vendor/knative.dev/networking/test/test_images/runtime/handlers/file_access_attempt.go b/vendor/knative.dev/networking/test/test_images/runtime/handlers/file_access_attempt.go index 1557a8916a..9824641631 100644 --- a/vendor/knative.dev/networking/test/test_images/runtime/handlers/file_access_attempt.go +++ b/vendor/knative.dev/networking/test/test_images/runtime/handlers/file_access_attempt.go @@ -17,7 +17,6 @@ limitations under the License. package handlers import ( - "io/ioutil" "os" "knative.dev/networking/test/types" @@ -66,7 +65,7 @@ func checkReadable(path string) error { } if file.IsDir() { - _, err := ioutil.ReadDir(path) + _, err := os.ReadDir(path) return err } @@ -91,7 +90,7 @@ func checkWritable(path string) error { } if file.IsDir() { - writeFile, err := ioutil.TempFile(path, "random") + writeFile, err := os.CreateTemp(path, "random") if writeFile != nil { os.Remove(writeFile.Name()) } diff --git a/vendor/knative.dev/networking/test/test_images/wsserver/echo.go b/vendor/knative.dev/networking/test/test_images/wsserver/echo.go index 36f3382f05..6ee60ac83b 100644 --- a/vendor/knative.dev/networking/test/test_images/wsserver/echo.go +++ b/vendor/knative.dev/networking/test/test_images/wsserver/echo.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package main import ( diff --git a/vendor/knative.dev/networking/test/util.go b/vendor/knative.dev/networking/test/util.go index 231c0092a5..5d09f86ae2 100644 --- a/vendor/knative.dev/networking/test/util.go +++ b/vendor/knative.dev/networking/test/util.go @@ -91,7 +91,6 @@ func ListenAndServeTLSGracefully(cert, key, addr string, handler func(w http.Res ListenAndServeTLSGracefullyWithHandler(cert, key, addr, http.HandlerFunc(handler)) } -// // ListenAndServeTLSGracefullyWithHandler creates an HTTPS server, listens on the defined address // and handles incoming requests with the given handler. // It blocks until SIGTERM is received and the underlying server has shutdown gracefully. diff --git a/vendor/knative.dev/pkg/apis/duck/verify.go b/vendor/knative.dev/pkg/apis/duck/verify.go index e3f5abab43..48675f93a4 100644 --- a/vendor/knative.dev/pkg/apis/duck/verify.go +++ b/vendor/knative.dev/pkg/apis/duck/verify.go @@ -31,10 +31,10 @@ type Populatable = ducktypes.Populatable // the provided Implementable duck type. It is expected that under the resource // definition implementing a particular "Fooable" that one would write: // -// type ConcreteResource struct { ... } +// type ConcreteResource struct { ... } // -// // Check that ConcreteResource properly implement Fooable. -// err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{}) +// // Check that ConcreteResource properly implement Fooable. +// err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{}) // // This will return an error if the duck typing is not satisfied. func VerifyType(instance interface{}, iface Implementable) error { diff --git a/vendor/knative.dev/pkg/apis/field_error.go b/vendor/knative.dev/pkg/apis/field_error.go index ddd4838af2..d4773d4aa9 100644 --- a/vendor/knative.dev/pkg/apis/field_error.go +++ b/vendor/knative.dev/pkg/apis/field_error.go @@ -83,11 +83,12 @@ var _ error = (*FieldError)(nil) // ViaField is used to propagate a validation error along a field access. // For example, if a type recursively validates its "spec" via: -// if err := foo.Spec.Validate(); err != nil { -// // Augment any field paths with the context that they were accessed -// // via "spec". -// return err.ViaField("spec") -// } +// +// if err := foo.Spec.Validate(); err != nil { +// // Augment any field paths with the context that they were accessed +// // via "spec". +// return err.ViaField("spec") +// } func (fe *FieldError) ViaField(prefix ...string) *FieldError { if fe == nil { return nil @@ -114,11 +115,12 @@ func (fe *FieldError) ViaField(prefix ...string) *FieldError { // ViaIndex is used to attach an index to the next ViaField provided. // For example, if a type recursively validates a parameter that has a collection: -// for i, c := range spec.Collection { -// if err := doValidation(c); err != nil { -// return err.ViaIndex(i).ViaField("collection") -// } -// } +// +// for i, c := range spec.Collection { +// if err := doValidation(c); err != nil { +// return err.ViaIndex(i).ViaField("collection") +// } +// } func (fe *FieldError) ViaIndex(index int) *FieldError { return fe.ViaField(asIndex(index)) } @@ -130,11 +132,12 @@ func (fe *FieldError) ViaFieldIndex(field string, index int) *FieldError { // ViaKey is used to attach a key to the next ViaField provided. // For example, if a type recursively validates a parameter that has a collection: -// for k, v := range spec.Bag { -// if err := doValidation(v); err != nil { -// return err.ViaKey(k).ViaField("bag") -// } -// } +// +// for k, v := range spec.Bag { +// if err := doValidation(v); err != nil { +// return err.ViaKey(k).ViaField("bag") +// } +// } func (fe *FieldError) ViaKey(key string) *FieldError { return fe.ViaField(asKey(key)) } @@ -145,7 +148,8 @@ func (fe *FieldError) ViaFieldKey(field, key string) *FieldError { } // At is a way to alter the level of the diagnostics held in this FieldError. -// ErrMissingField("foo").At(WarningLevel) +// +// ErrMissingField("foo").At(WarningLevel) func (fe *FieldError) At(l DiagnosticLevel) *FieldError { if fe == nil { return nil @@ -166,9 +170,10 @@ func (fe *FieldError) At(l DiagnosticLevel) *FieldError { } // Filter is a way to access the set of diagnostics having a particular level. -// if err := x.Validate(ctx).Filter(ErrorLevel); err != nil { -// return err -// } +// +// if err := x.Validate(ctx).Filter(ErrorLevel); err != nil { +// return err +// } func (fe *FieldError) Filter(l DiagnosticLevel) *FieldError { if fe == nil { return nil @@ -282,10 +287,11 @@ func asKey(key string) string { // flatten takes in a array of path components and looks for chances to flatten // objects that have index prefixes, examples: -// err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0] -// err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar -// err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar -// err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar +// +// err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0] +// err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar +// err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar +// err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar func flatten(path []string) string { var newPath []string for _, part := range path { diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go index 68ac8b4cba..4051e6a862 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/comment_parser.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -27,10 +27,10 @@ type CommentTag map[string][]string // ExtractCommentTags parses comments for lines of the form: // -// "marker" + "prefix" + ':' + "key=value,key2=value2". +// "marker" + "prefix" + ':' + "key=value,key2=value2". // -// In the following example the marker is '+' and the prefix is 'foo': -// +foo:key=value1,key2=value2,key=value3 +// In the following example the marker is '+' and the prefix is 'foo': +// +foo:key=value1,key2=value2,key=value3 // // Values are optional; empty map is the default. A tag can be specified more than // one time and all values are returned. If the resulting map has an entry for @@ -38,17 +38,19 @@ type CommentTag map[string][]string // // Example: if you pass "+" for 'marker', and the following lines are in // the comments: -// +foo:key=value1,key2=value2,key=value3 -// +bar +// +// +foo:key=value1,key2=value2,key=value3 +// +bar // // Then this function will return: -// map[string]map[string]string{ -// "foo":{ -// "key": []string{"value1", "value3"}, -// "key2": []string{"value2"} -// }, -// "bar": {}, -// } +// +// map[string]map[string]string{ +// "foo":{ +// "key": []string{"value1", "value3"}, +// "key2": []string{"value2"} +// }, +// "bar": {}, +// } // // Users are not expected to repeat values. func ExtractCommentTags(marker string, lines []string) CommentTags { diff --git a/vendor/knative.dev/pkg/configmap/doc.go b/vendor/knative.dev/pkg/configmap/doc.go index d861a3801f..5e9ab8990c 100644 --- a/vendor/knative.dev/pkg/configmap/doc.go +++ b/vendor/knative.dev/pkg/configmap/doc.go @@ -16,6 +16,6 @@ limitations under the License. // Package configmap exists to facilitate consuming Kubernetes ConfigMap // resources in various ways, including: -// - Watching them for changes over time, and -// - Loading them from a VolumeMount. +// - Watching them for changes over time, and +// - Loading them from a VolumeMount. package configmap diff --git a/vendor/knative.dev/pkg/configmap/load.go b/vendor/knative.dev/pkg/configmap/load.go index ee40fbf0cc..56ad1e4ab4 100644 --- a/vendor/knative.dev/pkg/configmap/load.go +++ b/vendor/knative.dev/pkg/configmap/load.go @@ -17,7 +17,6 @@ limitations under the License. package configmap import ( - "io/ioutil" "os" "path" "path/filepath" @@ -47,7 +46,7 @@ func Load(p string) (map[string]string, error) { if info.IsDir() { return nil } - b, err := ioutil.ReadFile(p) + b, err := os.ReadFile(p) if err != nil { return err } diff --git a/vendor/knative.dev/pkg/configmap/store.go b/vendor/knative.dev/pkg/configmap/store.go index ffe9ad8c68..375a474c26 100644 --- a/vendor/knative.dev/pkg/configmap/store.go +++ b/vendor/knative.dev/pkg/configmap/store.go @@ -35,7 +35,7 @@ type Logger interface { // Constructors is a map for specifying configmap names to // their function constructors // -// The values of this map must be functions with the definition +// # The values of this map must be functions with the definition // // func(*k8s.io/api/core/v1.ConfigMap) (... , error) // @@ -60,7 +60,7 @@ type UntypedStore struct { // NewUntypedStore creates an UntypedStore with given name, // Logger and Constructors // -// The Logger must not be nil +// # The Logger must not be nil // // The values in the Constructors map must be functions with // the definition diff --git a/vendor/knative.dev/pkg/configmap/testing/configmap.go b/vendor/knative.dev/pkg/configmap/testing/configmap.go index 909036892a..58cf9a21be 100644 --- a/vendor/knative.dev/pkg/configmap/testing/configmap.go +++ b/vendor/knative.dev/pkg/configmap/testing/configmap.go @@ -18,7 +18,7 @@ package testing import ( "fmt" - "io/ioutil" + "os" "strings" "testing" "unicode" @@ -45,7 +45,7 @@ func ConfigMapFromTestFile(t testing.TB, name string, allowed ...string) *corev1 func ConfigMapsFromTestFile(t testing.TB, name string, allowed ...string) (*corev1.ConfigMap, *corev1.ConfigMap) { t.Helper() - b, err := ioutil.ReadFile(fmt.Sprintf("testdata/%s.yaml", name)) + b, err := os.ReadFile(fmt.Sprintf("testdata/%s.yaml", name)) if err != nil { t.Fatal("ReadFile() =", err) } diff --git a/vendor/knative.dev/pkg/hash/doc.go b/vendor/knative.dev/pkg/hash/doc.go index 8b849cd3e1..5595336ad6 100644 --- a/vendor/knative.dev/pkg/hash/doc.go +++ b/vendor/knative.dev/pkg/hash/doc.go @@ -16,12 +16,12 @@ limitations under the License. // Package hash contains various Knative specific hashing utilities. // -// - ChooseSubset is a consistent hashing/mapping function providing -// a consistent selection of N keys from M (N<=M) keys for a given -// target. -// - BucketSet is a bucketer library which uses ChooseSubset under the -// the hood in order to implement consistent mapping between keys and -// set of buckets, identified by unique names. Compared to basic bucket -// implementation which just does hash%num_buckets, when the number of -// buckets change only a small subset of keys are supposed to migrate. +// - ChooseSubset is a consistent hashing/mapping function providing +// a consistent selection of N keys from M (N<=M) keys for a given +// target. +// - BucketSet is a bucketer library which uses ChooseSubset under the +// the hood in order to implement consistent mapping between keys and +// set of buckets, identified by unique names. Compared to basic bucket +// implementation which just does hash%num_buckets, when the number of +// buckets change only a small subset of keys are supposed to migrate. package hash diff --git a/vendor/knative.dev/pkg/injection/doc.go b/vendor/knative.dev/pkg/injection/doc.go index db5495d815..960674dead 100644 --- a/vendor/knative.dev/pkg/injection/doc.go +++ b/vendor/knative.dev/pkg/injection/doc.go @@ -22,84 +22,84 @@ limitations under the License. // interesting. The first is in the context of implementations of // `controller.Reconciler` being wrapped in a `*controller.Impl`: // -// import ( -// // Simply linking this triggers the injection of the informer, which links -// // the factory triggering its injection, and which links the client, -// // triggering its injection. All you need to know is that it works :) -// deployinformer "knative.dev/pkg/injection/informers/kubeinformers/appsv1/deployment" -// "knative.dev/pkg/injection" -// ) +// import ( +// // Simply linking this triggers the injection of the informer, which links +// // the factory triggering its injection, and which links the client, +// // triggering its injection. All you need to know is that it works :) +// deployinformer "knative.dev/pkg/injection/informers/kubeinformers/appsv1/deployment" +// "knative.dev/pkg/injection" +// ) // -// func NewController(ctx context.Context) *controller.Impl { -// deploymentInformer := deployinformer.Get(ctx) -// // Pass deploymentInformer.Lister() to Reconciler -// ... -// // Set up events on deploymentInformer.Informer() -// ... -// } +// func NewController(ctx context.Context) *controller.Impl { +// deploymentInformer := deployinformer.Get(ctx) +// // Pass deploymentInformer.Lister() to Reconciler +// ... +// // Set up events on deploymentInformer.Informer() +// ... +// } // // Then in `package main` the entire controller process can be set up via: // -// package main +// package main // -// import ( -// // The set of controllers this controller process runs. -// // Linking these will register their transitive dependencies, after -// // which the shared main can set up the rest. -// "github.com/knative/foo/pkg/reconciler/matt" -// "github.com/knative/foo/pkg/reconciler/scott" -// "github.com/knative/foo/pkg/reconciler/ville" -// "github.com/knative/foo/pkg/reconciler/dave" +// import ( +// // The set of controllers this controller process runs. +// // Linking these will register their transitive dependencies, after +// // which the shared main can set up the rest. +// "github.com/knative/foo/pkg/reconciler/matt" +// "github.com/knative/foo/pkg/reconciler/scott" +// "github.com/knative/foo/pkg/reconciler/ville" +// "github.com/knative/foo/pkg/reconciler/dave" // -// // This defines the shared main for injected controllers. -// "knative.dev/pkg/injection/sharedmain" -// ) +// // This defines the shared main for injected controllers. +// "knative.dev/pkg/injection/sharedmain" +// ) // -// func main() { -// sharedmain.Main("mycomponent", -// // We pass in the list of controllers to construct, and that's it! -// // If we forget to add this, go will complain about the unused import. -// matt.NewController, -// scott.NewController, -// ville.NewController, -// dave.NewController, -// ) -// } +// func main() { +// sharedmain.Main("mycomponent", +// // We pass in the list of controllers to construct, and that's it! +// // If we forget to add this, go will complain about the unused import. +// matt.NewController, +// scott.NewController, +// ville.NewController, +// dave.NewController, +// ) +// } // // If you want to adapt the above to run the controller within a single // namespace, you can instead do something like: // -// package main +// package main // -// import ( -// // The set of controllers this controller process runs. -// // Linking these will register their transitive dependencies, after -// // which the shared main can set up the rest. -// "github.com/knative/foo/pkg/reconciler/matt" -// "github.com/knative/foo/pkg/reconciler/scott" -// "github.com/knative/foo/pkg/reconciler/ville" -// "github.com/knative/foo/pkg/reconciler/dave" +// import ( +// // The set of controllers this controller process runs. +// // Linking these will register their transitive dependencies, after +// // which the shared main can set up the rest. +// "github.com/knative/foo/pkg/reconciler/matt" +// "github.com/knative/foo/pkg/reconciler/scott" +// "github.com/knative/foo/pkg/reconciler/ville" +// "github.com/knative/foo/pkg/reconciler/dave" // -// // This defines the shared main for injected controllers. -// "knative.dev/pkg/injection/sharedmain" +// // This defines the shared main for injected controllers. +// "knative.dev/pkg/injection/sharedmain" // -// // These are used to set up the context. -// "knative.dev/pkg/injection" -// "knative.dev/pkg/signals" -// ) +// // These are used to set up the context. +// "knative.dev/pkg/injection" +// "knative.dev/pkg/signals" +// ) // -// func main() { -// // Scope the shared informer factories to the provided namespace. -// ctx := injection.WithNamespace(signals.NewContext(), "the-namespace") +// func main() { +// // Scope the shared informer factories to the provided namespace. +// ctx := injection.WithNamespace(signals.NewContext(), "the-namespace") // -// // Use our initial context when setting up the controllers. -// sharedmain.MainWithContext(ctx, "mycomponent", -// // We pass in the list of controllers to construct, and that's it! -// // If we forget to add this, go will complain about the unused import. -// matt.NewController, -// scott.NewController, -// ville.NewController, -// dave.NewController, -// ) -// } +// // Use our initial context when setting up the controllers. +// sharedmain.MainWithContext(ctx, "mycomponent", +// // We pass in the list of controllers to construct, and that's it! +// // If we forget to add this, go will complain about the unused import. +// matt.NewController, +// scott.NewController, +// ville.NewController, +// dave.NewController, +// ) +// } package injection diff --git a/vendor/knative.dev/pkg/injection/injection.go b/vendor/knative.dev/pkg/injection/injection.go index d8cefc9fbe..f06e06f179 100644 --- a/vendor/knative.dev/pkg/injection/injection.go +++ b/vendor/knative.dev/pkg/injection/injection.go @@ -34,9 +34,11 @@ import ( // // Typical integration: // ```go -// ctx, startInformers := injection.EnableInjectionOrDie(signals.NewContext(), nil) -// ... start watches with informers, if required ... -// startInformers() +// +// ctx, startInformers := injection.EnableInjectionOrDie(signals.NewContext(), nil) +// ... start watches with informers, if required ... +// startInformers() +// // ``` func EnableInjectionOrDie(ctx context.Context, cfg *rest.Config) (context.Context, func()) { if ctx == nil { diff --git a/vendor/knative.dev/pkg/logging/object_encoders.go b/vendor/knative.dev/pkg/logging/object_encoders.go index ee14737cee..9a30f8aab1 100644 --- a/vendor/knative.dev/pkg/logging/object_encoders.go +++ b/vendor/knative.dev/pkg/logging/object_encoders.go @@ -29,9 +29,12 @@ import ( // StringSet returns a marshaler for the set of strings. // To use this in sugared logger do: +// // logger.Infow("Revision State", zap.Object("healthy", logging.StringSet(healthySet)), // zap.Object("unhealthy", logging.StringSet(unhealthySet))) +// // To use with non-sugared logger do: +// // logger.Info("Revision State", zap.Object("healthy", logging.StringSet(healthySet)), // zap.Object("unhealthy", logging.StringSet(unhealthySet))) func StringSet(s sets.String) zapcore.ObjectMarshalerFunc { diff --git a/vendor/knative.dev/pkg/metrics/prometheus_exporter.go b/vendor/knative.dev/pkg/metrics/prometheus_exporter.go index b5b39d9fce..621ffcbea3 100644 --- a/vendor/knative.dev/pkg/metrics/prometheus_exporter.go +++ b/vendor/knative.dev/pkg/metrics/prometheus_exporter.go @@ -20,6 +20,7 @@ import ( "net/http" "strconv" "sync" + "time" prom "contrib.go.opencensus.io/exporter/prometheus" "go.opencensus.io/resource" @@ -41,7 +42,7 @@ func (emptyPromExporter) ExportView(viewData *view.Data) { // a signal to enrich the internal Meters with Resource information. } -//nolint: unparam // False positive of flagging the second result of this function unused. +// nolint: unparam // False positive of flagging the second result of this function unused. func newPrometheusExporter(config *metricsConfig, logger *zap.SugaredLogger) (view.Exporter, ResourceExporterFactory, error) { e, err := prom.NewExporter(prom.Options{Namespace: config.component}) if err != nil { @@ -82,9 +83,11 @@ func startNewPromSrv(e *prom.Exporter, host string, port int) *http.Server { if curPromSrv != nil { curPromSrv.Close() } + //nolint:gosec curPromSrv = &http.Server{ - Addr: host + ":" + strconv.Itoa(port), - Handler: sm, + Addr: host + ":" + strconv.Itoa(port), + Handler: sm, + ReadHeaderTimeout: 60 * time.Second, } return curPromSrv } diff --git a/vendor/knative.dev/pkg/metrics/resource_view.go b/vendor/knative.dev/pkg/metrics/resource_view.go index 236fd588ba..69e4ab435d 100644 --- a/vendor/knative.dev/pkg/metrics/resource_view.go +++ b/vendor/knative.dev/pkg/metrics/resource_view.go @@ -29,7 +29,7 @@ import ( "go.opencensus.io/stats" "go.opencensus.io/stats/view" "go.opencensus.io/tag" - "k8s.io/apimachinery/pkg/util/clock" + "k8s.io/utils/clock" ) type storedViews struct { @@ -53,7 +53,7 @@ type meters struct { meters map[string]*meterExporter factory ResourceExporterFactory lock sync.Mutex - clock clock.Clock + clock clock.WithTicker ticker clock.Ticker tickerStopChan chan struct{} } @@ -65,7 +65,7 @@ var ( resourceViews = storedViews{} allMeters = meters{ meters: map[string]*meterExporter{"": &defaultMeter}, - clock: clock.Clock(clock.RealClock{}), + clock: clock.RealClock{}, } cleanupOnce = new(sync.Once) diff --git a/vendor/knative.dev/pkg/network/error_handler.go b/vendor/knative.dev/pkg/network/error_handler.go index 7637664893..d0b6beedc6 100644 --- a/vendor/knative.dev/pkg/network/error_handler.go +++ b/vendor/knative.dev/pkg/network/error_handler.go @@ -17,8 +17,8 @@ limitations under the License. package network import ( - "io/ioutil" "net/http" + "os" "go.uber.org/zap" ) @@ -36,7 +36,7 @@ func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Req } func readSockStat(logger *zap.SugaredLogger) string { - b, err := ioutil.ReadFile("/proc/net/sockstat") + b, err := os.ReadFile("/proc/net/sockstat") if err != nil { logger.Errorw("Unable to read sockstat", zap.Error(err)) return "" diff --git a/vendor/knative.dev/pkg/network/h2c.go b/vendor/knative.dev/pkg/network/h2c.go index 6cc0fa733d..b8f2d8c266 100644 --- a/vendor/knative.dev/pkg/network/h2c.go +++ b/vendor/knative.dev/pkg/network/h2c.go @@ -28,6 +28,7 @@ import ( // NewServer returns a new HTTP Server with HTTP2 handler. func NewServer(addr string, h http.Handler) *http.Server { + //nolint:gosec // https://github.com/knative/pkg/issues/2632 h1s := &http.Server{ Addr: addr, Handler: h2c.NewHandler(h, &http2.Server{}), diff --git a/vendor/knative.dev/pkg/network/handlers/drain.go b/vendor/knative.dev/pkg/network/handlers/drain.go index 5eee2ea42e..3b2f28a077 100644 --- a/vendor/knative.dev/pkg/network/handlers/drain.go +++ b/vendor/knative.dev/pkg/network/handlers/drain.go @@ -196,7 +196,7 @@ func (d *Drainer) resetTimer() { d.Lock() defer d.Unlock() - if d.timer.Stop() { + if d.timer != nil && d.timer.Stop() { d.timer.Reset(d.QuietPeriod) } } diff --git a/vendor/knative.dev/pkg/network/handlers/error.go b/vendor/knative.dev/pkg/network/handlers/error.go index e45d2fa030..fd3b1c1b27 100644 --- a/vendor/knative.dev/pkg/network/handlers/error.go +++ b/vendor/knative.dev/pkg/network/handlers/error.go @@ -20,5 +20,6 @@ import "knative.dev/pkg/network" // Error sets up a handler suitable for use with the ErrorHandler field on // httputil's reverse proxy, which logs /proc/net/sockstat data. +// //nolint:staticcheck // We actually want to mirror this. var Error = network.ErrorHandler diff --git a/vendor/knative.dev/pkg/profiling/server.go b/vendor/knative.dev/pkg/profiling/server.go index 9d61c0981f..526385f05e 100644 --- a/vendor/knative.dev/pkg/profiling/server.go +++ b/vendor/knative.dev/pkg/profiling/server.go @@ -110,6 +110,7 @@ func NewServer(handler http.Handler) *http.Server { port = strconv.Itoa(ProfilingPort) } + //nolint:gosec // https://github.com/knative/pkg/issues/2632 return &http.Server{ Addr: ":" + port, Handler: handler, diff --git a/vendor/knative.dev/pkg/reconciler/retry.go b/vendor/knative.dev/pkg/reconciler/retry.go index 1a50406b1e..2c6cfd612e 100644 --- a/vendor/knative.dev/pkg/reconciler/retry.go +++ b/vendor/knative.dev/pkg/reconciler/retry.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Veroute.on 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/vendor/knative.dev/pkg/reconciler/testing/hooks.go b/vendor/knative.dev/pkg/reconciler/testing/hooks.go index f60d6ebeda..c89be34a0f 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/hooks.go +++ b/vendor/knative.dev/pkg/reconciler/testing/hooks.go @@ -44,7 +44,7 @@ CreateHookFunc is a function for handling a Create hook. Its runtime.Object parameter will be the Kubernetes resource created. The resource can be cast to its actual type like this: - pod := obj.(*v1.Pod) + pod := obj.(*v1.Pod) A return value of true marks the hook as completed. Returning false allows the hook to run again when the next resource of the requested type is @@ -57,7 +57,7 @@ UpdateHookFunc is a function for handling an update hook. its runtime.Object parameter will be the Kubernetes resource updated. The resource can be cast to its actual type like this: - pod := obj.(*v1.Pod) + pod := obj.(*v1.Pod) A return value of true marks the hook as completed. Returning false allows the hook to run again when the next resource of the requested type is diff --git a/vendor/knative.dev/pkg/reconciler/testing/reactions.go b/vendor/knative.dev/pkg/reconciler/testing/reactions.go index d66b41a71e..c6d960b998 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/reactions.go +++ b/vendor/knative.dev/pkg/reconciler/testing/reactions.go @@ -28,15 +28,18 @@ import ( // InduceFailure is used in conjunction with TableTest's WithReactors field. // Tests that want to induce a failure in a row of a TableTest would add: -// WithReactors: []clientgotesting.ReactionFunc{ -// // Makes calls to create revisions return an error. -// InduceFailure("create", "revisions"), -// }, +// +// WithReactors: []clientgotesting.ReactionFunc{ +// // Makes calls to create revisions return an error. +// InduceFailure("create", "revisions"), +// }, +// // Or to target a subresource, say a patch to InMemoryChannel.Status, you would add: -// WithReactors: []clientgotesting.ReactionFunc{ -// // Makes calls to patch inmemorychannels status subresource return an error. -// InduceFailure("patch", "inmemorychannels/status"), -// }, +// +// WithReactors: []clientgotesting.ReactionFunc{ +// // Makes calls to patch inmemorychannels status subresource return an error. +// InduceFailure("patch", "inmemorychannels/status"), +// }, func InduceFailure(verb, resource string) clientgotesting.ReactionFunc { return func(action clientgotesting.Action) (handled bool, ret runtime.Object, err error) { if !action.Matches(verb, resource) { diff --git a/vendor/knative.dev/pkg/reconciler/testing/sorter.go b/vendor/knative.dev/pkg/reconciler/testing/sorter.go index 2c1e91923d..a55286f7b5 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/sorter.go +++ b/vendor/knative.dev/pkg/reconciler/testing/sorter.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/vendor/knative.dev/pkg/test/ingress/ingress.go b/vendor/knative.dev/pkg/test/ingress/ingress.go index fc9f9a19c8..8de4052c75 100644 --- a/vendor/knative.dev/pkg/test/ingress/ingress.go +++ b/vendor/knative.dev/pkg/test/ingress/ingress.go @@ -35,8 +35,10 @@ const ( // GetIngressEndpoint gets the ingress public IP or hostname. // address - is the endpoint to which we should actually connect. // portMap - translates the request's port to the port on address to which the caller -// should connect. This is used when the resolution to address goes through some -// sort of port-mapping, e.g. Kubernetes node ports. +// +// should connect. This is used when the resolution to address goes through some +// sort of port-mapping, e.g. Kubernetes node ports. +// // err - an error when address/portMap cannot be established. func GetIngressEndpoint(ctx context.Context, kubeClientset kubernetes.Interface, endpointOverride string) (address string, portMap func(string) string, err error) { ingressName := istioIngressName diff --git a/vendor/knative.dev/pkg/test/spoof/spoof.go b/vendor/knative.dev/pkg/test/spoof/spoof.go index 147a64adc7..789d4bd68b 100644 --- a/vendor/knative.dev/pkg/test/spoof/spoof.go +++ b/vendor/knative.dev/pkg/test/spoof/spoof.go @@ -23,7 +23,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" "net/http" "net/url" @@ -188,7 +187,7 @@ func (sc *SpoofingClient) Poll(req *http.Request, inState ResponseChecker, check } defer rawResp.Body.Close() - body, err := ioutil.ReadAll(rawResp.Body) + body, err := io.ReadAll(rawResp.Body) if err != nil { return true, err } diff --git a/vendor/knative.dev/pkg/test/zipkin/doc.go b/vendor/knative.dev/pkg/test/zipkin/doc.go index c4464f4596..81c15343f6 100644 --- a/vendor/knative.dev/pkg/test/zipkin/doc.go +++ b/vendor/knative.dev/pkg/test/zipkin/doc.go @@ -33,9 +33,8 @@ This package exposes following methods: A general flow for a Test Suite to use Zipkin Tracing support is as follows: - 1. Call SetupZipkinTracing(kubernetes.Interface) in TestMain. - 2. Use SpoofingClient to make HTTP requests. - 3. Call CleanupZipkinTracingSetup on cleanup after tests are executed. - + 1. Call SetupZipkinTracing(kubernetes.Interface) in TestMain. + 2. Use SpoofingClient to make HTTP requests. + 3. Call CleanupZipkinTracingSetup on cleanup after tests are executed. */ package zipkin diff --git a/vendor/knative.dev/pkg/test/zipkin/util.go b/vendor/knative.dev/pkg/test/zipkin/util.go index 5e9cb5feb4..f22efa4418 100644 --- a/vendor/knative.dev/pkg/test/zipkin/util.go +++ b/vendor/knative.dev/pkg/test/zipkin/util.go @@ -22,7 +22,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "strconv" @@ -110,9 +110,10 @@ func SetupZipkinTracingFromConfigTracingOrFail(ctx context.Context, t testing.TB } // SetupZipkinTracing sets up zipkin tracing which involves: -// 1. Setting up port-forwarding from localhost to zipkin pod on the cluster -// (pid of the process doing Port-Forward is stored in a global variable). -// 2. Enable AlwaysSample config for tracing for the SpoofingClient. +// 1. Setting up port-forwarding from localhost to zipkin pod on the cluster +// (pid of the process doing Port-Forward is stored in a global variable). +// 2. Enable AlwaysSample config for tracing for the SpoofingClient. +// // The zipkin deployment must have the label app=zipkin func SetupZipkinTracing(ctx context.Context, kubeClientset kubernetes.Interface, logf logging.FormatLogger, zipkinRemotePort int, zipkinNamespace string) (err error) { setupOnce.Do(func() { @@ -152,13 +153,13 @@ func SetupZipkinTracingOrFail(ctx context.Context, t testing.TB, kubeClientset k // CleanupZipkinTracingSetup cleans up the Zipkin tracing setup on the machine. This involves killing the process performing port-forward. // This should be called exactly once in TestMain. Likely in the form: // -// func TestMain(m *testing.M) { -// os.Exit(func() int { -// // Any setup required for the tests. -// defer zipkin.CleanupZipkinTracingSetup(logger) -// return m.Run() -// }()) -// } +// func TestMain(m *testing.M) { +// os.Exit(func() int { +// // Any setup required for the tests. +// defer zipkin.CleanupZipkinTracingSetup(logger) +// return m.Run() +// }()) +// } func CleanupZipkinTracingSetup(logf logging.FormatLogger) { teardownOnce.Do(func() { // Because CleanupZipkinTracingSetup only runs once, make sure that now that it has been @@ -226,7 +227,7 @@ func jsonTrace(traceID string) ([]model.SpanModel, error) { } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return empty, err } diff --git a/vendor/knative.dev/pkg/webhook/webhook.go b/vendor/knative.dev/pkg/webhook/webhook.go index ffb806ee0b..ff5533bcef 100644 --- a/vendor/knative.dev/pkg/webhook/webhook.go +++ b/vendor/knative.dev/pkg/webhook/webhook.go @@ -208,6 +208,7 @@ func (wh *Webhook) Run(stop <-chan struct{}) error { QuietPeriod: wh.Options.GracePeriod, } + //nolint:gosec // https://github.com/knative/pkg/issues/2632 server := &http.Server{ Handler: drainer, Addr: fmt.Sprint(":", wh.Options.Port), diff --git a/vendor/modules.txt b/vendor/modules.txt index 264cac91ef..47589def27 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -511,7 +511,6 @@ k8s.io/apimachinery/pkg/runtime/serializer/versioning k8s.io/apimachinery/pkg/selection k8s.io/apimachinery/pkg/types k8s.io/apimachinery/pkg/util/cache -k8s.io/apimachinery/pkg/util/clock k8s.io/apimachinery/pkg/util/diff k8s.io/apimachinery/pkg/util/errors k8s.io/apimachinery/pkg/util/framer @@ -892,7 +891,7 @@ k8s.io/utils/trace # knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3 ## explicit; go 1.17 knative.dev/hack -# knative.dev/networking v0.0.0-20220818010248-e51df7cdf571 +# knative.dev/networking v0.0.0-20221208211516-5f25a81cd43e ## explicit; go 1.18 knative.dev/networking/config knative.dev/networking/pkg @@ -942,7 +941,7 @@ knative.dev/networking/test/test_images/runtime/handlers knative.dev/networking/test/test_images/timeout knative.dev/networking/test/test_images/wsserver knative.dev/networking/test/types -# knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15 +# knative.dev/pkg v0.0.0-20221123011941-9d7bd235ceed ## explicit; go 1.18 knative.dev/pkg/apis knative.dev/pkg/apis/duck