diff --git a/go.mod b/go.mod index 30608dcac..ee142676c 100644 --- a/go.mod +++ b/go.mod @@ -38,9 +38,9 @@ require ( k8s.io/component-base v0.33.4 k8s.io/klog/v2 v2.130.1 k8s.io/kubernetes v1.33.4 - k8s.io/mount-utils v0.33.4 + k8s.io/mount-utils v0.34.0 k8s.io/pod-security-admission v0.31.1 - k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 + k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250701013630-7cd6c31d3f88 sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.8.4 sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.7.2 diff --git a/go.sum b/go.sum index 1bd616c78..907887266 100644 --- a/go.sum +++ b/go.sum @@ -473,12 +473,12 @@ k8s.io/kubelet v0.33.4 h1:+sbpLmSq+Y8DF/OQeyw75OpuiF60tvlYcmc/yjN+nl4= k8s.io/kubelet v0.33.4/go.mod h1:wboarviFRQld5rzZUjTliv7x00YVx+YhRd/p1OahX7Y= k8s.io/kubernetes v1.33.4 h1:T1d5FLUYm3/KyUeV7YJhKTR980zHCHb7K2xhCSo3lE8= k8s.io/kubernetes v1.33.4/go.mod h1:nrt8sldmckKz2fCZhgRX3SKfS2e+CzXATPv6ITNkU00= -k8s.io/mount-utils v0.33.4 h1:o83Qx0AgY5JDYhFV6gAYfSy+GAPIuPqSKdEqac5lxqo= -k8s.io/mount-utils v0.33.4/go.mod h1:1JR4rKymg8B8bCPo618hpSAdrpO6XLh0Acqok/xVwPE= +k8s.io/mount-utils v0.34.0 h1:f2QzKU8ZLz5cJ/TmRRZnfAVJ8EPsF+FT1I6pP/HA4gk= +k8s.io/mount-utils v0.34.0/go.mod h1:MIjjYlqJ0ziYQg0MO09kc9S96GIcMkhF/ay9MncF0GA= k8s.io/pod-security-admission v0.33.4 h1:adSwY7a/Q4Eoj+uCUfav90xRe6mB8waF0HAZ4gZeWD0= k8s.io/pod-security-admission v0.33.4/go.mod h1:K+4JaqBz5yqE7TXf3g5zEiBLcu9RdW2BjTWydFEror4= -k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 h1:jgJW5IePPXLGB8e/1wvd0Ich9QE97RvvF3a8J3fP/Lg= -k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/cloud-provider-azure v1.29.1-0.20250701013630-7cd6c31d3f88 h1:eddjZcKg198nRlNL6mcUu2//6Rrq90BxJSCEmrTCYlU= diff --git a/vendor/k8s.io/mount-utils/README.md b/vendor/k8s.io/mount-utils/README.md index ee7c8e89a..02a46dd89 100644 --- a/vendor/k8s.io/mount-utils/README.md +++ b/vendor/k8s.io/mount-utils/README.md @@ -1,3 +1,8 @@ +> ⚠️ **This is an automatically published [staged repository](https://git.k8s.io/kubernetes/staging#external-repository-staging-area) for Kubernetes**. +> Contributions, including issues and pull requests, should be made to the main Kubernetes repository: [https://github.com/kubernetes/kubernetes](https://github.com/kubernetes/kubernetes). +> This repository is read-only for importing, and not used for direct contributions. +> See [CONTRIBUTING.md](./CONTRIBUTING.md) for more details. + ## Purpose This repository defines an interface to mounting filesystems to be consumed by diff --git a/vendor/k8s.io/mount-utils/mount.go b/vendor/k8s.io/mount-utils/mount.go index 0bd91ee61..1fdae6903 100644 --- a/vendor/k8s.io/mount-utils/mount.go +++ b/vendor/k8s.io/mount-utils/mount.go @@ -100,7 +100,7 @@ type MounterForceUnmounter interface { } // MountPoint represents a single line in /proc/mounts or /etc/fstab. -type MountPoint struct { // nolint: golint +type MountPoint struct { Device string Path string Type string @@ -109,7 +109,7 @@ type MountPoint struct { // nolint: golint Pass int } -type MountErrorType string // nolint: golint +type MountErrorType string const ( FilesystemMismatch MountErrorType = "FilesystemMismatch" @@ -120,7 +120,7 @@ const ( UnknownMountError MountErrorType = "UnknownMountError" ) -type MountError struct { // nolint: golint +type MountError struct { Type MountErrorType Message string } diff --git a/vendor/k8s.io/mount-utils/mount_helper_unix.go b/vendor/k8s.io/mount-utils/mount_helper_unix.go index 1c603dca7..6c74eb9ca 100644 --- a/vendor/k8s.io/mount-utils/mount_helper_unix.go +++ b/vendor/k8s.io/mount-utils/mount_helper_unix.go @@ -71,7 +71,7 @@ func IsCorruptedMnt(err error) bool { } // MountInfo represents a single line in /proc//mountinfo. -type MountInfo struct { // nolint: golint +type MountInfo struct { // Unique ID for the mount (maybe reused after umount). ID int // The ID of the parent mount (or of self for the root of this mount namespace's mount tree). diff --git a/vendor/k8s.io/utils/buffer/ring_growing.go b/vendor/k8s.io/utils/buffer/ring_growing.go index 77243575c..0f6d31d3e 100644 --- a/vendor/k8s.io/utils/buffer/ring_growing.go +++ b/vendor/k8s.io/utils/buffer/ring_growing.go @@ -16,31 +16,57 @@ limitations under the License. package buffer +// defaultRingSize defines the default ring size if not specified +const defaultRingSize = 16 + +// RingGrowingOptions sets parameters for [RingGrowing] and +// [TypedRingGrowing]. +type RingGrowingOptions struct { + // InitialSize is the number of pre-allocated elements in the + // initial underlying storage buffer. + InitialSize int +} + // RingGrowing is a growing ring buffer. // Not thread safe. -type RingGrowing struct { - data []interface{} +// +// Deprecated: Use TypedRingGrowing[any] instead. +type RingGrowing = TypedRingGrowing[any] + +// NewRingGrowing constructs a new RingGrowing instance with provided parameters. +// +// Deprecated: Use NewTypedRingGrowing[any] instead. +func NewRingGrowing(initialSize int) *RingGrowing { + return NewTypedRingGrowing[any](RingGrowingOptions{InitialSize: initialSize}) +} + +// TypedRingGrowing is a growing ring buffer. +// The zero value has an initial size of 0 and is ready to use. +// Not thread safe. +type TypedRingGrowing[T any] struct { + data []T n int // Size of Data beg int // First available element readable int // Number of data items available } -// NewRingGrowing constructs a new RingGrowing instance with provided parameters. -func NewRingGrowing(initialSize int) *RingGrowing { - return &RingGrowing{ - data: make([]interface{}, initialSize), - n: initialSize, +// NewTypedRingGrowing constructs a new TypedRingGrowing instance with provided parameters. +func NewTypedRingGrowing[T any](opts RingGrowingOptions) *TypedRingGrowing[T] { + return &TypedRingGrowing[T]{ + data: make([]T, opts.InitialSize), + n: opts.InitialSize, } } // ReadOne reads (consumes) first item from the buffer if it is available, otherwise returns false. -func (r *RingGrowing) ReadOne() (data interface{}, ok bool) { +func (r *TypedRingGrowing[T]) ReadOne() (data T, ok bool) { if r.readable == 0 { - return nil, false + return } r.readable-- element := r.data[r.beg] - r.data[r.beg] = nil // Remove reference to the object to help GC + var zero T + r.data[r.beg] = zero // Remove reference to the object to help GC if r.beg == r.n-1 { // Was the last element r.beg = 0 @@ -51,11 +77,14 @@ func (r *RingGrowing) ReadOne() (data interface{}, ok bool) { } // WriteOne adds an item to the end of the buffer, growing it if it is full. -func (r *RingGrowing) WriteOne(data interface{}) { +func (r *TypedRingGrowing[T]) WriteOne(data T) { if r.readable == r.n { // Time to grow newN := r.n * 2 - newData := make([]interface{}, newN) + if newN == 0 { + newN = defaultRingSize + } + newData := make([]T, newN) to := r.beg + r.readable if to <= r.n { copy(newData, r.data[r.beg:to]) @@ -72,11 +101,70 @@ func (r *RingGrowing) WriteOne(data interface{}) { } // Len returns the number of items in the buffer. -func (r *RingGrowing) Len() int { +func (r *TypedRingGrowing[T]) Len() int { return r.readable } // Cap returns the capacity of the buffer. -func (r *RingGrowing) Cap() int { +func (r *TypedRingGrowing[T]) Cap() int { return r.n } + +// RingOptions sets parameters for [Ring]. +type RingOptions struct { + // InitialSize is the number of pre-allocated elements in the + // initial underlying storage buffer. + InitialSize int + // NormalSize is the number of elements to allocate for new storage + // buffers once the Ring is consumed and + // can shrink again. + NormalSize int +} + +// Ring is a dynamically-sized ring buffer which can grow and shrink as-needed. +// The zero value has an initial size and normal size of 0 and is ready to use. +// Not thread safe. +type Ring[T any] struct { + growing TypedRingGrowing[T] + normalSize int // Limits the size of the buffer that is kept for reuse. Read-only. +} + +// NewRing constructs a new Ring instance with provided parameters. +func NewRing[T any](opts RingOptions) *Ring[T] { + return &Ring[T]{ + growing: *NewTypedRingGrowing[T](RingGrowingOptions{InitialSize: opts.InitialSize}), + normalSize: opts.NormalSize, + } +} + +// ReadOne reads (consumes) first item from the buffer if it is available, +// otherwise returns false. When the buffer has been totally consumed and has +// grown in size beyond its normal size, it shrinks down to its normal size again. +func (r *Ring[T]) ReadOne() (data T, ok bool) { + element, ok := r.growing.ReadOne() + + if r.growing.readable == 0 && r.growing.n > r.normalSize { + // The buffer is empty. Reallocate a new buffer so the old one can be + // garbage collected. + r.growing.data = make([]T, r.normalSize) + r.growing.n = r.normalSize + r.growing.beg = 0 + } + + return element, ok +} + +// WriteOne adds an item to the end of the buffer, growing it if it is full. +func (r *Ring[T]) WriteOne(data T) { + r.growing.WriteOne(data) +} + +// Len returns the number of items in the buffer. +func (r *Ring[T]) Len() int { + return r.growing.Len() +} + +// Cap returns the capacity of the buffer. +func (r *Ring[T]) Cap() int { + return r.growing.Cap() +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 687bc7f4f..30e812298 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1676,14 +1676,14 @@ k8s.io/kubernetes/test/utils/kubeconfig k8s.io/kubernetes/third_party/forked/golang/expansion k8s.io/kubernetes/third_party/forked/libcontainer/apparmor k8s.io/kubernetes/third_party/forked/libcontainer/utils -# k8s.io/mount-utils v0.33.4 +# k8s.io/mount-utils v0.34.0 ## explicit; go 1.24.0 k8s.io/mount-utils # k8s.io/pod-security-admission v0.31.1 => k8s.io/pod-security-admission v0.33.4 ## explicit; go 1.24.0 k8s.io/pod-security-admission/api k8s.io/pod-security-admission/policy -# k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 +# k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 ## explicit; go 1.18 k8s.io/utils/buffer k8s.io/utils/clock