Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
knative-automation committed Jan 13, 2025
1 parent 34485e0 commit bd32234
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 53 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36
knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9
knative.dev/pkg v0.0.0-20250110150618-accfe3649188
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,8 @@ knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36 h1:iZ6CwYLo+y82MXlK7PoG/cnFE
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36 h1:j7/31r2d68tu3zVVxSSrEbuLqjGrgWzfzwY5+wXyISw=
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36/go.mod h1:jRH/sx6mwwuMVhvJgnzSaoYA1N4qaIkJa+zxEGtVA5I=
knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9 h1:b4S5OUBLwlbfC9Twr+4AfEcH7zK8CKUdjdyOTirfvoU=
knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9/go.mod h1:C1u0e6tMiEkqcKsurZn2wGTH6utcTbODFwJBPyZ56lA=
knative.dev/pkg v0.0.0-20250110150618-accfe3649188 h1:xM2blxCAN0VzKQPYqeq2jNBL7xN6Iyn1avs+Ib+ogaM=
knative.dev/pkg v0.0.0-20250110150618-accfe3649188/go.mod h1:C1u0e6tMiEkqcKsurZn2wGTH6utcTbODFwJBPyZ56lA=
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=
Expand Down
6 changes: 3 additions & 3 deletions vendor/knative.dev/pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ type ControllerOptions struct {
WorkQueueName string
Logger *zap.SugaredLogger
Reporter StatsReporter
RateLimiter workqueue.RateLimiter
RateLimiter workqueue.TypedRateLimiter[any]
Concurrency int
}

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

// WorkQueue permits direct access to the work queue.
func (c *Impl) WorkQueue() workqueue.RateLimitingInterface {
func (c *Impl) WorkQueue() workqueue.TypedRateLimitingInterface[any] {
return c.workQueue
}

Expand Down
20 changes: 10 additions & 10 deletions vendor/knative.dev/pkg/controller/two_lane_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import "k8s.io/client-go/util/workqueue"
// -- slow queue (slowLane queue), whose contents are processed if fast queue has no items.
// All the default methods operate on the fast queue, unless noted otherwise.
type twoLaneQueue struct {
workqueue.RateLimitingInterface
slowLane workqueue.RateLimitingInterface
workqueue.TypedRateLimitingInterface[any]
slowLane workqueue.TypedRateLimitingInterface[any]
// consumerQueue is necessary to ensure that we're not reconciling
// the same object at the exact same time (e.g. if it had been enqueued
// in both fast and slow and is the only object there).
consumerQueue workqueue.Interface
consumerQueue workqueue.TypedInterface[any]

name string

Expand All @@ -37,9 +37,9 @@ type twoLaneQueue struct {
}

// Creates a new twoLaneQueue.
func newTwoLaneWorkQueue(name string, rl workqueue.RateLimiter) *twoLaneQueue {
func newTwoLaneWorkQueue(name string, rl workqueue.TypedRateLimiter[any]) *twoLaneQueue {
tlq := &twoLaneQueue{
RateLimitingInterface: workqueue.NewNamedRateLimitingQueue(
TypedRateLimitingInterface: workqueue.NewNamedRateLimitingQueue(
rl,
name+"-fast",
),
Expand All @@ -55,12 +55,12 @@ func newTwoLaneWorkQueue(name string, rl workqueue.RateLimiter) *twoLaneQueue {
// Run consumer thread.
go tlq.runConsumer()
// Run producer threads.
go process(tlq.RateLimitingInterface, tlq.fastChan)
go process(tlq.TypedRateLimitingInterface, tlq.fastChan)
go process(tlq.slowLane, tlq.slowChan)
return tlq
}

func process(q workqueue.Interface, ch chan interface{}) {
func process(q workqueue.TypedInterface[any], ch chan interface{}) {
// Sender closes the channel
defer close(ch)
for {
Expand Down Expand Up @@ -125,7 +125,7 @@ func (tlq *twoLaneQueue) runConsumer() {
// Shutdown implements workqueue.Interface.
// Shutdown shuts down both queues.
func (tlq *twoLaneQueue) ShutDown() {
tlq.RateLimitingInterface.ShutDown()
tlq.TypedRateLimitingInterface.ShutDown()
tlq.slowLane.ShutDown()
}

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

// SlowLane gives direct access to the slow queue.
func (tlq *twoLaneQueue) SlowLane() workqueue.RateLimitingInterface {
func (tlq *twoLaneQueue) SlowLane() workqueue.TypedRateLimitingInterface[any] {
return tlq.slowLane
}
22 changes: 11 additions & 11 deletions vendor/knative.dev/pkg/hash/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (

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

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

type hashData struct {
// The set of all hashes for fast lookup and to name mapping
nameLookup map[int]string
nameLookup map[uint64]string
// Sorted set of hashes for selection algorithm.
hashPool []int
hashPool []uint64
// start angle
start int
start uint64
// step angle
step int
step uint64
}

func (hd *hashData) fromIndexSet(s sets.Set[int]) sets.Set[string] {
Expand Down Expand Up @@ -85,29 +85,29 @@ func buildHashes(in sets.Set[string], target string) *hashData {
buf.WriteString(startSalt)
hasher := fnv.New64a()
hd := &hashData{
nameLookup: make(map[int]string, len(from)),
hashPool: make([]int, len(from)),
start: int(computeHash(buf.Bytes(), hasher) % universe),
nameLookup: make(map[uint64]string, len(from)),
hashPool: make([]uint64, len(from)),
start: computeHash(buf.Bytes(), hasher) % universe,
}
buf.Truncate(len(target)) // Discard the angle salt.
buf.WriteString(stepSalt)
hd.step = int(computeHash(buf.Bytes(), hasher) % universe)
hd.step = computeHash(buf.Bytes(), hasher) % universe

for i, f := range from {
buf.Reset() // This retains the storage.
// Make unique sets for every target.
buf.WriteString(f)
buf.WriteString(target)
h := computeHash(buf.Bytes(), hasher)
hs := int(h % universe)
hs := h % universe
// Two values slotted to the same bucket.
// On average should happen with 1/universe probability.
_, ok := hd.nameLookup[hs]
for ok {
// Feed the hash as salt.
buf.WriteString(strconv.FormatUint(h, 16 /*append hex strings for shortness*/))
h = computeHash(buf.Bytes(), hasher)
hs = int(h % universe)
hs = h % universe
_, ok = hd.nameLookup[hs]
}

Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/metrics/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func prometheusPort() (int, error) {
return defaultPrometheusPort, nil
}

pp, err := strconv.ParseUint(ppStr, 10, 16)
pp, err := strconv.ParseInt(ppStr, 10, 16)
if err != nil {
return -1, fmt.Errorf("the environment variable %q could not be parsed as a port number: %w",
prometheusPortEnvName, err)
Expand Down
57 changes: 33 additions & 24 deletions vendor/knative.dev/pkg/metrics/memstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package metrics
import (
"context"
"log"
"math"
"runtime"
"time"

Expand Down Expand Up @@ -379,76 +380,76 @@ func (msp *MemStatsProvider) Start(ctx context.Context, period time.Duration) {
ms := runtime.MemStats{}
runtime.ReadMemStats(&ms)
if msp.Alloc != nil {
Record(ctx, msp.Alloc.M(int64(ms.Alloc)))
Record(ctx, msp.Alloc.M(safeint64(ms.Alloc)))
}
if msp.TotalAlloc != nil {
Record(ctx, msp.TotalAlloc.M(int64(ms.TotalAlloc)))
Record(ctx, msp.TotalAlloc.M(safeint64(ms.TotalAlloc)))
}
if msp.Sys != nil {
Record(ctx, msp.Sys.M(int64(ms.Sys)))
Record(ctx, msp.Sys.M(safeint64(ms.Sys)))
}
if msp.Lookups != nil {
Record(ctx, msp.Lookups.M(int64(ms.Lookups)))
Record(ctx, msp.Lookups.M(safeint64(ms.Lookups)))
}
if msp.Mallocs != nil {
Record(ctx, msp.Mallocs.M(int64(ms.Mallocs)))
Record(ctx, msp.Mallocs.M(safeint64(ms.Mallocs)))
}
if msp.Frees != nil {
Record(ctx, msp.Frees.M(int64(ms.Frees)))
Record(ctx, msp.Frees.M(safeint64(ms.Frees)))
}
if msp.HeapAlloc != nil {
Record(ctx, msp.HeapAlloc.M(int64(ms.HeapAlloc)))
Record(ctx, msp.HeapAlloc.M(safeint64(ms.HeapAlloc)))
}
if msp.HeapSys != nil {
Record(ctx, msp.HeapSys.M(int64(ms.HeapSys)))
Record(ctx, msp.HeapSys.M(safeint64(ms.HeapSys)))
}
if msp.HeapIdle != nil {
Record(ctx, msp.HeapIdle.M(int64(ms.HeapIdle)))
Record(ctx, msp.HeapIdle.M(safeint64(ms.HeapIdle)))
}
if msp.HeapInuse != nil {
Record(ctx, msp.HeapInuse.M(int64(ms.HeapInuse)))
Record(ctx, msp.HeapInuse.M(safeint64(ms.HeapInuse)))
}
if msp.HeapReleased != nil {
Record(ctx, msp.HeapReleased.M(int64(ms.HeapReleased)))
Record(ctx, msp.HeapReleased.M(safeint64(ms.HeapReleased)))
}
if msp.HeapObjects != nil {
Record(ctx, msp.HeapObjects.M(int64(ms.HeapObjects)))
Record(ctx, msp.HeapObjects.M(safeint64(ms.HeapObjects)))
}
if msp.StackInuse != nil {
Record(ctx, msp.StackInuse.M(int64(ms.StackInuse)))
Record(ctx, msp.StackInuse.M(safeint64(ms.StackInuse)))
}
if msp.StackSys != nil {
Record(ctx, msp.StackSys.M(int64(ms.StackSys)))
Record(ctx, msp.StackSys.M(safeint64(ms.StackSys)))
}
if msp.MSpanInuse != nil {
Record(ctx, msp.MSpanInuse.M(int64(ms.MSpanInuse)))
Record(ctx, msp.MSpanInuse.M(safeint64(ms.MSpanInuse)))
}
if msp.MSpanSys != nil {
Record(ctx, msp.MSpanSys.M(int64(ms.MSpanSys)))
Record(ctx, msp.MSpanSys.M(safeint64(ms.MSpanSys)))
}
if msp.MCacheInuse != nil {
Record(ctx, msp.MCacheInuse.M(int64(ms.MCacheInuse)))
Record(ctx, msp.MCacheInuse.M(safeint64(ms.MCacheInuse)))
}
if msp.MCacheSys != nil {
Record(ctx, msp.MCacheSys.M(int64(ms.MCacheSys)))
Record(ctx, msp.MCacheSys.M(safeint64(ms.MCacheSys)))
}
if msp.BuckHashSys != nil {
Record(ctx, msp.BuckHashSys.M(int64(ms.BuckHashSys)))
Record(ctx, msp.BuckHashSys.M(safeint64(ms.BuckHashSys)))
}
if msp.GCSys != nil {
Record(ctx, msp.GCSys.M(int64(ms.GCSys)))
Record(ctx, msp.GCSys.M(safeint64(ms.GCSys)))
}
if msp.OtherSys != nil {
Record(ctx, msp.OtherSys.M(int64(ms.OtherSys)))
Record(ctx, msp.OtherSys.M(safeint64(ms.OtherSys)))
}
if msp.NextGC != nil {
Record(ctx, msp.NextGC.M(int64(ms.NextGC)))
Record(ctx, msp.NextGC.M(safeint64(ms.NextGC)))
}
if msp.LastGC != nil {
Record(ctx, msp.LastGC.M(int64(ms.LastGC)))
Record(ctx, msp.LastGC.M(safeint64(ms.LastGC)))
}
if msp.PauseTotalNs != nil {
Record(ctx, msp.PauseTotalNs.M(int64(ms.PauseTotalNs)))
Record(ctx, msp.PauseTotalNs.M(safeint64(ms.PauseTotalNs)))
}
if msp.NumGC != nil {
Record(ctx, msp.NumGC.M(int64(ms.NumGC)))
Expand Down Expand Up @@ -549,3 +550,11 @@ func (msp *MemStatsProvider) DefaultViews() (views []*view.View) {
}
return
}

func safeint64(val uint64) int64 {
if val > math.MaxInt64 {
return math.MaxInt64
}

return int64(val)
}
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ knative.dev/hack/schema/commands
knative.dev/hack/schema/docs
knative.dev/hack/schema/registry
knative.dev/hack/schema/schema
# knative.dev/pkg v0.0.0-20250109201817-83cd52ed87d9
# knative.dev/pkg v0.0.0-20250110150618-accfe3649188
## explicit; go 1.22.7
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
Expand Down

0 comments on commit bd32234

Please sign in to comment.