Skip to content

Commit 8ec3399

Browse files
upgrade to latest dependencies (#927)
bumping knative.dev/pkg 83cd52e...accfe36: > accfe36 Satisfy linter (# 3132) > b4ff2c1 run dependabot workflow only on dependabot branches (# 3133) Signed-off-by: Knative Automation <[email protected]>
1 parent 34485e0 commit 8ec3399

File tree

8 files changed

+62
-53
lines changed

8 files changed

+62
-53
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8
1212
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36
1313
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36
14-
knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9
14+
knative.dev/pkg v0.0.0-20250110150618-accfe3649188
1515
)
1616

1717
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,8 @@ knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36 h1:iZ6CwYLo+y82MXlK7PoG/cnFE
701701
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
702702
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36 h1:j7/31r2d68tu3zVVxSSrEbuLqjGrgWzfzwY5+wXyISw=
703703
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36/go.mod h1:jRH/sx6mwwuMVhvJgnzSaoYA1N4qaIkJa+zxEGtVA5I=
704-
knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9 h1:b4S5OUBLwlbfC9Twr+4AfEcH7zK8CKUdjdyOTirfvoU=
705-
knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9/go.mod h1:C1u0e6tMiEkqcKsurZn2wGTH6utcTbODFwJBPyZ56lA=
704+
knative.dev/pkg v0.0.0-20250110150618-accfe3649188 h1:xM2blxCAN0VzKQPYqeq2jNBL7xN6Iyn1avs+Ib+ogaM=
705+
knative.dev/pkg v0.0.0-20250110150618-accfe3649188/go.mod h1:C1u0e6tMiEkqcKsurZn2wGTH6utcTbODFwJBPyZ56lA=
706706
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
707707
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
708708
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

vendor/knative.dev/pkg/controller/controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,15 @@ type ControllerOptions struct {
228228
WorkQueueName string
229229
Logger *zap.SugaredLogger
230230
Reporter StatsReporter
231-
RateLimiter workqueue.RateLimiter
231+
RateLimiter workqueue.TypedRateLimiter[any]
232232
Concurrency int
233233
}
234234

235235
// NewContext instantiates an instance of our controller that will feed work to the
236236
// provided Reconciler as it is enqueued.
237237
func NewContext(ctx context.Context, r Reconciler, options ControllerOptions) *Impl {
238238
if options.RateLimiter == nil {
239-
options.RateLimiter = workqueue.DefaultControllerRateLimiter()
239+
options.RateLimiter = workqueue.DefaultTypedControllerRateLimiter[any]()
240240
}
241241
if options.Reporter == nil {
242242
options.Reporter = MustNewStatsReporter(options.WorkQueueName, options.Logger)
@@ -263,7 +263,7 @@ func NewContext(ctx context.Context, r Reconciler, options ControllerOptions) *I
263263
}
264264

265265
// WorkQueue permits direct access to the work queue.
266-
func (c *Impl) WorkQueue() workqueue.RateLimitingInterface {
266+
func (c *Impl) WorkQueue() workqueue.TypedRateLimitingInterface[any] {
267267
return c.workQueue
268268
}
269269

vendor/knative.dev/pkg/controller/two_lane_queue.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ import "k8s.io/client-go/util/workqueue"
2323
// -- slow queue (slowLane queue), whose contents are processed if fast queue has no items.
2424
// All the default methods operate on the fast queue, unless noted otherwise.
2525
type twoLaneQueue struct {
26-
workqueue.RateLimitingInterface
27-
slowLane workqueue.RateLimitingInterface
26+
workqueue.TypedRateLimitingInterface[any]
27+
slowLane workqueue.TypedRateLimitingInterface[any]
2828
// consumerQueue is necessary to ensure that we're not reconciling
2929
// the same object at the exact same time (e.g. if it had been enqueued
3030
// in both fast and slow and is the only object there).
31-
consumerQueue workqueue.Interface
31+
consumerQueue workqueue.TypedInterface[any]
3232

3333
name string
3434

@@ -37,9 +37,9 @@ type twoLaneQueue struct {
3737
}
3838

3939
// Creates a new twoLaneQueue.
40-
func newTwoLaneWorkQueue(name string, rl workqueue.RateLimiter) *twoLaneQueue {
40+
func newTwoLaneWorkQueue(name string, rl workqueue.TypedRateLimiter[any]) *twoLaneQueue {
4141
tlq := &twoLaneQueue{
42-
RateLimitingInterface: workqueue.NewNamedRateLimitingQueue(
42+
TypedRateLimitingInterface: workqueue.NewNamedRateLimitingQueue(
4343
rl,
4444
name+"-fast",
4545
),
@@ -55,12 +55,12 @@ func newTwoLaneWorkQueue(name string, rl workqueue.RateLimiter) *twoLaneQueue {
5555
// Run consumer thread.
5656
go tlq.runConsumer()
5757
// Run producer threads.
58-
go process(tlq.RateLimitingInterface, tlq.fastChan)
58+
go process(tlq.TypedRateLimitingInterface, tlq.fastChan)
5959
go process(tlq.slowLane, tlq.slowChan)
6060
return tlq
6161
}
6262

63-
func process(q workqueue.Interface, ch chan interface{}) {
63+
func process(q workqueue.TypedInterface[any], ch chan interface{}) {
6464
// Sender closes the channel
6565
defer close(ch)
6666
for {
@@ -125,7 +125,7 @@ func (tlq *twoLaneQueue) runConsumer() {
125125
// Shutdown implements workqueue.Interface.
126126
// Shutdown shuts down both queues.
127127
func (tlq *twoLaneQueue) ShutDown() {
128-
tlq.RateLimitingInterface.ShutDown()
128+
tlq.TypedRateLimitingInterface.ShutDown()
129129
tlq.slowLane.ShutDown()
130130
}
131131

@@ -147,10 +147,10 @@ func (tlq *twoLaneQueue) Get() (interface{}, bool) {
147147
// Len returns the sum of lengths.
148148
// NB: actual _number_ of unique object might be less than this sum.
149149
func (tlq *twoLaneQueue) Len() int {
150-
return tlq.RateLimitingInterface.Len() + tlq.slowLane.Len() + tlq.consumerQueue.Len()
150+
return tlq.TypedRateLimitingInterface.Len() + tlq.slowLane.Len() + tlq.consumerQueue.Len()
151151
}
152152

153153
// SlowLane gives direct access to the slow queue.
154-
func (tlq *twoLaneQueue) SlowLane() workqueue.RateLimitingInterface {
154+
func (tlq *twoLaneQueue) SlowLane() workqueue.TypedRateLimitingInterface[any] {
155155
return tlq.slowLane
156156
}

vendor/knative.dev/pkg/hash/hash.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535

3636
// universe represents the possible range of angles [0, universe).
3737
// We want to have universe divide total range evenly to reduce bias.
38-
universe = (1 << 11)
38+
universe uint64 = (1 << 11)
3939
)
4040

4141
// computeAngle returns a uint64 number which represents
@@ -51,13 +51,13 @@ func computeHash(n []byte, h hash.Hash64) uint64 {
5151

5252
type hashData struct {
5353
// The set of all hashes for fast lookup and to name mapping
54-
nameLookup map[int]string
54+
nameLookup map[uint64]string
5555
// Sorted set of hashes for selection algorithm.
56-
hashPool []int
56+
hashPool []uint64
5757
// start angle
58-
start int
58+
start uint64
5959
// step angle
60-
step int
60+
step uint64
6161
}
6262

6363
func (hd *hashData) fromIndexSet(s sets.Set[int]) sets.Set[string] {
@@ -85,29 +85,29 @@ func buildHashes(in sets.Set[string], target string) *hashData {
8585
buf.WriteString(startSalt)
8686
hasher := fnv.New64a()
8787
hd := &hashData{
88-
nameLookup: make(map[int]string, len(from)),
89-
hashPool: make([]int, len(from)),
90-
start: int(computeHash(buf.Bytes(), hasher) % universe),
88+
nameLookup: make(map[uint64]string, len(from)),
89+
hashPool: make([]uint64, len(from)),
90+
start: computeHash(buf.Bytes(), hasher) % universe,
9191
}
9292
buf.Truncate(len(target)) // Discard the angle salt.
9393
buf.WriteString(stepSalt)
94-
hd.step = int(computeHash(buf.Bytes(), hasher) % universe)
94+
hd.step = computeHash(buf.Bytes(), hasher) % universe
9595

9696
for i, f := range from {
9797
buf.Reset() // This retains the storage.
9898
// Make unique sets for every target.
9999
buf.WriteString(f)
100100
buf.WriteString(target)
101101
h := computeHash(buf.Bytes(), hasher)
102-
hs := int(h % universe)
102+
hs := h % universe
103103
// Two values slotted to the same bucket.
104104
// On average should happen with 1/universe probability.
105105
_, ok := hd.nameLookup[hs]
106106
for ok {
107107
// Feed the hash as salt.
108108
buf.WriteString(strconv.FormatUint(h, 16 /*append hex strings for shortness*/))
109109
h = computeHash(buf.Bytes(), hasher)
110-
hs = int(h % universe)
110+
hs = h % universe
111111
_, ok = hd.nameLookup[hs]
112112
}
113113

vendor/knative.dev/pkg/metrics/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func prometheusPort() (int, error) {
232232
return defaultPrometheusPort, nil
233233
}
234234

235-
pp, err := strconv.ParseUint(ppStr, 10, 16)
235+
pp, err := strconv.ParseInt(ppStr, 10, 16)
236236
if err != nil {
237237
return -1, fmt.Errorf("the environment variable %q could not be parsed as a port number: %w",
238238
prometheusPortEnvName, err)

vendor/knative.dev/pkg/metrics/memstats.go

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package metrics
1919
import (
2020
"context"
2121
"log"
22+
"math"
2223
"runtime"
2324
"time"
2425

@@ -379,76 +380,76 @@ func (msp *MemStatsProvider) Start(ctx context.Context, period time.Duration) {
379380
ms := runtime.MemStats{}
380381
runtime.ReadMemStats(&ms)
381382
if msp.Alloc != nil {
382-
Record(ctx, msp.Alloc.M(int64(ms.Alloc)))
383+
Record(ctx, msp.Alloc.M(safeint64(ms.Alloc)))
383384
}
384385
if msp.TotalAlloc != nil {
385-
Record(ctx, msp.TotalAlloc.M(int64(ms.TotalAlloc)))
386+
Record(ctx, msp.TotalAlloc.M(safeint64(ms.TotalAlloc)))
386387
}
387388
if msp.Sys != nil {
388-
Record(ctx, msp.Sys.M(int64(ms.Sys)))
389+
Record(ctx, msp.Sys.M(safeint64(ms.Sys)))
389390
}
390391
if msp.Lookups != nil {
391-
Record(ctx, msp.Lookups.M(int64(ms.Lookups)))
392+
Record(ctx, msp.Lookups.M(safeint64(ms.Lookups)))
392393
}
393394
if msp.Mallocs != nil {
394-
Record(ctx, msp.Mallocs.M(int64(ms.Mallocs)))
395+
Record(ctx, msp.Mallocs.M(safeint64(ms.Mallocs)))
395396
}
396397
if msp.Frees != nil {
397-
Record(ctx, msp.Frees.M(int64(ms.Frees)))
398+
Record(ctx, msp.Frees.M(safeint64(ms.Frees)))
398399
}
399400
if msp.HeapAlloc != nil {
400-
Record(ctx, msp.HeapAlloc.M(int64(ms.HeapAlloc)))
401+
Record(ctx, msp.HeapAlloc.M(safeint64(ms.HeapAlloc)))
401402
}
402403
if msp.HeapSys != nil {
403-
Record(ctx, msp.HeapSys.M(int64(ms.HeapSys)))
404+
Record(ctx, msp.HeapSys.M(safeint64(ms.HeapSys)))
404405
}
405406
if msp.HeapIdle != nil {
406-
Record(ctx, msp.HeapIdle.M(int64(ms.HeapIdle)))
407+
Record(ctx, msp.HeapIdle.M(safeint64(ms.HeapIdle)))
407408
}
408409
if msp.HeapInuse != nil {
409-
Record(ctx, msp.HeapInuse.M(int64(ms.HeapInuse)))
410+
Record(ctx, msp.HeapInuse.M(safeint64(ms.HeapInuse)))
410411
}
411412
if msp.HeapReleased != nil {
412-
Record(ctx, msp.HeapReleased.M(int64(ms.HeapReleased)))
413+
Record(ctx, msp.HeapReleased.M(safeint64(ms.HeapReleased)))
413414
}
414415
if msp.HeapObjects != nil {
415-
Record(ctx, msp.HeapObjects.M(int64(ms.HeapObjects)))
416+
Record(ctx, msp.HeapObjects.M(safeint64(ms.HeapObjects)))
416417
}
417418
if msp.StackInuse != nil {
418-
Record(ctx, msp.StackInuse.M(int64(ms.StackInuse)))
419+
Record(ctx, msp.StackInuse.M(safeint64(ms.StackInuse)))
419420
}
420421
if msp.StackSys != nil {
421-
Record(ctx, msp.StackSys.M(int64(ms.StackSys)))
422+
Record(ctx, msp.StackSys.M(safeint64(ms.StackSys)))
422423
}
423424
if msp.MSpanInuse != nil {
424-
Record(ctx, msp.MSpanInuse.M(int64(ms.MSpanInuse)))
425+
Record(ctx, msp.MSpanInuse.M(safeint64(ms.MSpanInuse)))
425426
}
426427
if msp.MSpanSys != nil {
427-
Record(ctx, msp.MSpanSys.M(int64(ms.MSpanSys)))
428+
Record(ctx, msp.MSpanSys.M(safeint64(ms.MSpanSys)))
428429
}
429430
if msp.MCacheInuse != nil {
430-
Record(ctx, msp.MCacheInuse.M(int64(ms.MCacheInuse)))
431+
Record(ctx, msp.MCacheInuse.M(safeint64(ms.MCacheInuse)))
431432
}
432433
if msp.MCacheSys != nil {
433-
Record(ctx, msp.MCacheSys.M(int64(ms.MCacheSys)))
434+
Record(ctx, msp.MCacheSys.M(safeint64(ms.MCacheSys)))
434435
}
435436
if msp.BuckHashSys != nil {
436-
Record(ctx, msp.BuckHashSys.M(int64(ms.BuckHashSys)))
437+
Record(ctx, msp.BuckHashSys.M(safeint64(ms.BuckHashSys)))
437438
}
438439
if msp.GCSys != nil {
439-
Record(ctx, msp.GCSys.M(int64(ms.GCSys)))
440+
Record(ctx, msp.GCSys.M(safeint64(ms.GCSys)))
440441
}
441442
if msp.OtherSys != nil {
442-
Record(ctx, msp.OtherSys.M(int64(ms.OtherSys)))
443+
Record(ctx, msp.OtherSys.M(safeint64(ms.OtherSys)))
443444
}
444445
if msp.NextGC != nil {
445-
Record(ctx, msp.NextGC.M(int64(ms.NextGC)))
446+
Record(ctx, msp.NextGC.M(safeint64(ms.NextGC)))
446447
}
447448
if msp.LastGC != nil {
448-
Record(ctx, msp.LastGC.M(int64(ms.LastGC)))
449+
Record(ctx, msp.LastGC.M(safeint64(ms.LastGC)))
449450
}
450451
if msp.PauseTotalNs != nil {
451-
Record(ctx, msp.PauseTotalNs.M(int64(ms.PauseTotalNs)))
452+
Record(ctx, msp.PauseTotalNs.M(safeint64(ms.PauseTotalNs)))
452453
}
453454
if msp.NumGC != nil {
454455
Record(ctx, msp.NumGC.M(int64(ms.NumGC)))
@@ -549,3 +550,11 @@ func (msp *MemStatsProvider) DefaultViews() (views []*view.View) {
549550
}
550551
return
551552
}
553+
554+
func safeint64(val uint64) int64 {
555+
if val > math.MaxInt64 {
556+
return math.MaxInt64
557+
}
558+
559+
return int64(val)
560+
}

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ knative.dev/hack/schema/commands
878878
knative.dev/hack/schema/docs
879879
knative.dev/hack/schema/registry
880880
knative.dev/hack/schema/schema
881-
# knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9
881+
# knative.dev/pkg v0.0.0-20250110150618-accfe3649188
882882
## explicit; go 1.22.7
883883
knative.dev/pkg/apis
884884
knative.dev/pkg/apis/duck

0 commit comments

Comments
 (0)