diff --git a/go.mod b/go.mod index 26b8d871f..5c6d82356 100644 --- a/go.mod +++ b/go.mod @@ -11,8 +11,8 @@ require ( k8s.io/client-go v0.27.6 k8s.io/code-generator v0.27.6 k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f - knative.dev/hack v0.0.0-20231201014241-7030d5bf584d - knative.dev/pkg v0.0.0-20240108071142-697d66936c81 + knative.dev/hack v0.0.0-20240108153050-3ea694d6dad7 + knative.dev/pkg v0.0.0-20240108152118-de3e9cc204c9 ) require ( diff --git a/go.sum b/go.sum index a315642fe..6fa09c119 100644 --- a/go.sum +++ b/go.sum @@ -673,10 +673,10 @@ k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5F k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/hack v0.0.0-20231201014241-7030d5bf584d h1:IqXY770znXS9tLJDEh+OUcLMgtIFslSxqao3uplpUlY= -knative.dev/hack v0.0.0-20231201014241-7030d5bf584d/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= -knative.dev/pkg v0.0.0-20240108071142-697d66936c81 h1:GRQr115uedAIFF6oKSnGO5zzOGx+BFyWFNiWbQAsDdU= -knative.dev/pkg v0.0.0-20240108071142-697d66936c81/go.mod h1:YzKN/kzcJPhL+Z4fwuzbaiEnRLIbYvOiZUuCWFJ7PRA= +knative.dev/hack v0.0.0-20240108153050-3ea694d6dad7 h1:mICurlRke2mlKP3LmyWYQYl6KZe80rYP5+ag9w2HQLA= +knative.dev/hack v0.0.0-20240108153050-3ea694d6dad7/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= +knative.dev/pkg v0.0.0-20240108152118-de3e9cc204c9 h1:4nsTvrgApGtLTt6Gpo7ulJS03pBI+wSJ8+EOwVamDx0= +knative.dev/pkg v0.0.0-20240108152118-de3e9cc204c9/go.mod h1:YzKN/kzcJPhL+Z4fwuzbaiEnRLIbYvOiZUuCWFJ7PRA= 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/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go b/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go index 167db244f..16d3ae2e5 100644 --- a/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go +++ b/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go @@ -346,14 +346,14 @@ func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLo // updateFinalizersFiltered will update the Finalizers of the resource. // TODO: this method could be generic and sync all finalizers. For now it only // updates defaultFinalizerName or its override. -func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.Image, desiredFinalizers sets.String) (*v1alpha1.Image, error) { +func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.Image, desiredFinalizers sets.Set[string]) (*v1alpha1.Image, error) { // Don't modify the informers copy. existing := resource.DeepCopy() var finalizers []string // If there's nothing to update, just return. - existingFinalizers := sets.NewString(existing.Finalizers...) + existingFinalizers := sets.New[string](existing.Finalizers...) if desiredFinalizers.Has(r.finalizerName) { if existingFinalizers.Has(r.finalizerName) { @@ -369,7 +369,7 @@ func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource } // Remove the finalizer. existingFinalizers.Delete(r.finalizerName) - finalizers = existingFinalizers.List() + finalizers = sets.List(existingFinalizers) } mergePatch := map[string]interface{}{ @@ -403,7 +403,7 @@ func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource * return resource, nil } - finalizers := sets.NewString(resource.Finalizers...) + finalizers := sets.New[string](resource.Finalizers...) // If this resource is not being deleted, mark the finalizer. if resource.GetDeletionTimestamp().IsZero() { @@ -422,7 +422,7 @@ func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1. return resource, nil } - finalizers := sets.NewString(resource.Finalizers...) + finalizers := sets.New[string](resource.Finalizers...) if reconcileEvent != nil { var event *reconciler.ReconcilerEvent diff --git a/vendor/knative.dev/hack/codegen-library.sh b/vendor/knative.dev/hack/codegen-library.sh index 0f21d457e..5f713dd43 100644 --- a/vendor/knative.dev/hack/codegen-library.sh +++ b/vendor/knative.dev/hack/codegen-library.sh @@ -32,4 +32,5 @@ export CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/k8s.i export KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/knative.dev/pkg 2>/dev/null || echo "${REPO_ROOT_DIR}")} [ -x ${CODEGEN_PKG}/generate-groups.sh ] || chmod +x ${CODEGEN_PKG}/generate-groups.sh +[ -x ${CODEGEN_PKG}/generate-internal-groups.sh ] || chmod +x ${CODEGEN_PKG}/generate-internal-groups.sh [ -x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh ] || chmod +x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go index f27c15633..0f9e4d0a6 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go @@ -156,11 +156,11 @@ func (g *reconcilerReconcilerGenerator) GenerateType(c *generator.Context, t *ty }), "setsNewString": c.Universe.Function(types.Name{ Package: "k8s.io/apimachinery/pkg/util/sets", - Name: "NewString", + Name: "New[string]", }), "setsString": c.Universe.Type(types.Name{ Package: "k8s.io/apimachinery/pkg/util/sets", - Name: "String", + Name: "Set[string]", }), "controllerOptions": c.Universe.Type(types.Name{ Package: "knative.dev/pkg/controller", @@ -630,7 +630,7 @@ func (r *reconcilerImpl) updateFinalizersFiltered(ctx {{.contextContext|raw}}, r } // Remove the finalizer. existingFinalizers.Delete(r.finalizerName) - finalizers = existingFinalizers.List() + finalizers = sets.List(existingFinalizers) } mergePatch := map[string]interface{}{ diff --git a/vendor/knative.dev/pkg/configmap/parse.go b/vendor/knative.dev/pkg/configmap/parse.go index e733e3838..d8caba3c3 100644 --- a/vendor/knative.dev/pkg/configmap/parse.go +++ b/vendor/knative.dev/pkg/configmap/parse.go @@ -165,15 +165,15 @@ func AsDuration(key string, target *time.Duration) ParseFunc { } } -// AsStringSet parses the value at key as a sets.String (split by ',') into the target, if it exists. -func AsStringSet(key string, target *sets.String) ParseFunc { +// AsStringSet parses the value at key as a sets.Set[string] (split by ',') into the target, if it exists. +func AsStringSet(key string, target *sets.Set[string]) ParseFunc { return func(data map[string]string) error { if raw, ok := data[key]; ok { splitted := strings.Split(raw, ",") for i, v := range splitted { splitted[i] = strings.TrimSpace(v) } - *target = sets.NewString(splitted...) + *target = sets.New[string](splitted...) } return nil } diff --git a/vendor/knative.dev/pkg/hash/bucketer.go b/vendor/knative.dev/pkg/hash/bucketer.go index 6da0cb30c..4e97efec8 100644 --- a/vendor/knative.dev/pkg/hash/bucketer.go +++ b/vendor/knative.dev/pkg/hash/bucketer.go @@ -38,7 +38,7 @@ type BucketSet struct { // mu guards buckets. mu sync.RWMutex // All the bucket names. Needed for building hash universe. - buckets sets.String + buckets sets.Set[string] } // Bucket implements reconciler.Bucket and wraps around BuketSet @@ -59,7 +59,7 @@ func newCache() *lru.Cache { // NewBucketSet creates a new bucket set with the given universe // of bucket names. -func NewBucketSet(bucketList sets.String) *BucketSet { +func NewBucketSet(bucketList sets.Set[string]) *BucketSet { return &BucketSet{ cache: newCache(), buckets: bucketList, @@ -106,7 +106,7 @@ func (bs *BucketSet) Owner(key string) string { } // Returns a single element from the set. -func GetAny(s sets.String) (string, bool) { +func GetAny(s sets.Set[string]) (string, bool) { for key := range s { return key, true } @@ -124,11 +124,11 @@ func (bs *BucketSet) BucketList() []string { bs.mu.RLock() defer bs.mu.RUnlock() - return bs.buckets.List() + return sets.List(bs.buckets) } // Update updates the universe of buckets. -func (bs *BucketSet) Update(newB sets.String) { +func (bs *BucketSet) Update(newB sets.Set[string]) { bs.mu.Lock() defer bs.mu.Unlock() // In theory we can iterate over the map and diff --git a/vendor/knative.dev/pkg/hash/hash.go b/vendor/knative.dev/pkg/hash/hash.go index 1c4c5352f..ae2969acd 100644 --- a/vendor/knative.dev/pkg/hash/hash.go +++ b/vendor/knative.dev/pkg/hash/hash.go @@ -60,8 +60,8 @@ type hashData struct { step int } -func (hd *hashData) fromIndexSet(s sets.Int) sets.String { - ret := make(sets.String, len(s)) +func (hd *hashData) fromIndexSet(s sets.Set[int]) sets.Set[string] { + ret := make(sets.Set[string], len(s)) for v := range s { ret.Insert(hd.nameForHIndex(v)) } @@ -72,14 +72,14 @@ func (hd *hashData) nameForHIndex(hi int) string { return hd.nameLookup[hd.hashPool[hi]] } -func buildHashes(in sets.String, target string) *hashData { +func buildHashes(in sets.Set[string], target string) *hashData { // Any one changing this function must execute // `go test -run=TestOverlay -count=200`. // This is to ensure there is no regression in the selection // algorithm. // Sorted list to ensure consistent results every time. - from := in.List() + from := sets.List(in) // Write in two pieces, so we don't allocate temp string which is sum of both. buf := bytes.NewBufferString(target) buf.WriteString(startSalt) @@ -126,7 +126,7 @@ func buildHashes(in sets.String, target string) *hashData { // ChooseSubset is an internal function and presumes sanitized inputs. // TODO(vagababov): once initial impl is ready, think about how to cache // the prepared data. -func ChooseSubset(from sets.String, n int, target string) sets.String { +func ChooseSubset(from sets.Set[string], n int, target string) sets.Set[string] { if n >= len(from) { return from } @@ -140,7 +140,7 @@ func ChooseSubset(from sets.String, n int, target string) sets.String { // 2.1. While that index is already selected pick next index // 3. Advance angle by `step` // 4. Goto 1. - selection := sets.NewInt() + selection := sets.New[int]() angle := hashData.start hpl := len(hashData.hashPool) for len(selection) < n { diff --git a/vendor/knative.dev/pkg/leaderelection/context.go b/vendor/knative.dev/pkg/leaderelection/context.go index f52733ea3..b0122b84a 100644 --- a/vendor/knative.dev/pkg/leaderelection/context.go +++ b/vendor/knative.dev/pkg/leaderelection/context.go @@ -190,7 +190,7 @@ func newStandardBuckets(queueName string, cc ComponentConfig) []reconciler.Bucke return standardBucketName(i, queueName, cc) } } - names := make(sets.String, cc.Buckets) + names := make(sets.Set[string], cc.Buckets) for i := uint32(0); i < cc.Buckets; i++ { names.Insert(ln(i)) } @@ -237,7 +237,7 @@ func NewStatefulSetBucketAndSet(buckets int) (reconciler.Bucket, *hash.BucketSet ssc.StatefulSetID.ordinal, buckets) } - names := make(sets.String, buckets) + names := make(sets.Set[string], buckets) for i := 0; i < buckets; i++ { names.Insert(statefulSetPodDNS(i, ssc)) } diff --git a/vendor/knative.dev/pkg/logging/object_encoders.go b/vendor/knative.dev/pkg/logging/object_encoders.go index 9a30f8aab..de750c259 100644 --- a/vendor/knative.dev/pkg/logging/object_encoders.go +++ b/vendor/knative.dev/pkg/logging/object_encoders.go @@ -37,7 +37,7 @@ import ( // // logger.Info("Revision State", zap.Object("healthy", logging.StringSet(healthySet)), // zap.Object("unhealthy", logging.StringSet(unhealthySet))) -func StringSet(s sets.String) zapcore.ObjectMarshalerFunc { +func StringSet(s sets.Set[string]) zapcore.ObjectMarshalerFunc { return func(enc zapcore.ObjectEncoder) error { enc.AddString("keys", strings.Join(s.UnsortedList(), ",")) return nil diff --git a/vendor/modules.txt b/vendor/modules.txt index 0a8217365..b9ec37d94 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -693,10 +693,10 @@ k8s.io/utils/net k8s.io/utils/pointer k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/hack v0.0.0-20231201014241-7030d5bf584d +# knative.dev/hack v0.0.0-20240108153050-3ea694d6dad7 ## explicit; go 1.18 knative.dev/hack -# knative.dev/pkg v0.0.0-20240108071142-697d66936c81 +# knative.dev/pkg v0.0.0-20240108152118-de3e9cc204c9 ## explicit; go 1.18 knative.dev/pkg/apis knative.dev/pkg/apis/duck