From 46c2d1a6c5a28099bb9d1ed80025ea42c54cc8b4 Mon Sep 17 00:00:00 2001 From: Knative Automation Date: Wed, 26 Jun 2024 01:40:20 +0000 Subject: [PATCH] upgrade to latest dependencies bumping knative.dev/pkg 339c22b...ee1db86: > ee1db86 Update linter config and address lint warnings/failures (# 3068) > 26bc7b4 Register AuthenticatableType in schema (# 3069) > 8535fcc gofumpt the repo (# 3067) > fc0720b [logstream] test polling should use a different context (# 3066) > 51dec91 drop test-infra code (# 3065) > b5bb12c drop unused OWNERS files and update script (# 3064) > 915c009 drop google/s2a-go (# 3062) > cd0e61e drop mako (# 3060) > fe2597a drop eventing kafka from downstream tests - repo is archived (# 3061) > b94232c Bump cloud.google.com/go/storage from 1.41.0 to 1.42.0 (# 3057) bumping google.golang.org/genproto/googleapis/api d264139...ef581f9: > ef581f9 chore(all): update all (# 1132) > 5315273 chore(all): update all (# 1131) > a332354 chore(all): auto-regenerate .pb.go files (# 1130) Signed-off-by: Knative Automation --- go.mod | 6 ++-- go.sum | 8 ++--- vendor/knative.dev/pkg/apis/condition_set.go | 6 ++-- vendor/knative.dev/pkg/apis/convert.go | 2 -- vendor/knative.dev/pkg/apis/deprecated.go | 2 +- .../pkg/apis/duck/v1/addressable_types.go | 6 ++-- .../pkg/apis/duck/v1/destination.go | 4 +-- .../pkg/apis/duck/v1/knative_reference.go | 1 - .../pkg/apis/duck/v1/kresource_type.go | 2 +- .../knative.dev/pkg/apis/duck/v1/register.go | 2 ++ .../pkg/apis/duck/v1/source_types.go | 2 +- .../pkg/apis/duck/v1/status_types.go | 1 - vendor/knative.dev/pkg/apis/duck/verify.go | 6 ++-- vendor/knative.dev/pkg/apis/kind2resource.go | 5 ++-- .../codegen/cmd/injection-gen/args/args.go | 8 ++--- .../cmd/injection-gen/generators/packages.go | 8 +---- vendor/knative.dev/pkg/configmap/example.go | 6 ++-- vendor/knative.dev/pkg/configmap/filter.go | 8 ++--- vendor/knative.dev/pkg/configmap/store.go | 4 +-- .../knative.dev/pkg/controller/controller.go | 29 +++++++------------ .../pkg/controller/stats_reporter.go | 1 - .../pkg/environment/client_config.go | 1 - .../{update-k8s-deps.sh => format-code.sh} | 10 ++----- vendor/knative.dev/pkg/injection/informers.go | 2 +- vendor/knative.dev/pkg/kmeta/names.go | 3 +- .../knative.dev/pkg/leaderelection/context.go | 10 +++---- vendor/knative.dev/pkg/logging/config.go | 3 +- vendor/knative.dev/pkg/metrics/config.go | 8 ++--- vendor/knative.dev/pkg/metrics/exporter.go | 3 +- vendor/knative.dev/pkg/metrics/metrics.go | 4 +-- .../pkg/metrics/opencensus_exporter.go | 4 ++- .../pkg/metrics/prometheus_exporter.go | 3 +- .../knative.dev/pkg/metrics/resource_view.go | 27 ++++++++++------- vendor/knative.dev/pkg/network/h2c.go | 2 +- .../knative.dev/pkg/reconciler/configstore.go | 2 +- vendor/knative.dev/pkg/reconciler/events.go | 2 +- vendor/knative.dev/pkg/test/helpers/dir.go | 2 +- vendor/knative.dev/pkg/test/helpers/name.go | 6 ++-- .../knative.dev/pkg/test/logging/logging.go | 2 ++ .../knative.dev/pkg/tracing/config/tracing.go | 6 ++-- vendor/knative.dev/pkg/tracker/interface.go | 1 - vendor/modules.txt | 6 ++-- 42 files changed, 102 insertions(+), 122 deletions(-) rename vendor/knative.dev/pkg/hack/{update-k8s-deps.sh => format-code.sh} (68%) diff --git a/go.mod b/go.mod index 57d8ca37..dcd63ca8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module knative.dev/reconciler-test -go 1.21 +go 1.22 require ( github.com/cloudevents/conformance v0.2.0 @@ -22,7 +22,7 @@ require ( k8s.io/client-go v0.29.2 k8s.io/utils v0.0.0-20240102154912-e7106e64919e knative.dev/hack v0.0.0-20240607132042-09143140a254 - knative.dev/pkg v0.0.0-20240614135239-339c22b8218c + knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef sigs.k8s.io/yaml v1.4.0 ) @@ -74,7 +74,7 @@ require ( golang.org/x/tools v0.22.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/api v0.183.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect diff --git a/go.sum b/go.sum index 7d702441..d4f60a73 100644 --- a/go.sum +++ b/go.sum @@ -640,8 +640,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e h1:SkdGTrROJl2jRGT/Fxv5QUf9jtdKCQh4KQJXbXVLAi0= -google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e/go.mod h1:LweJcLbyVij6rCex8YunD8DYR5VDonap/jYl3ZRxcIU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= +google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -725,8 +725,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= knative.dev/hack v0.0.0-20240607132042-09143140a254 h1:1YFnu3U6dWZg0oxm6GU8kEdA9A+BvSWKJO7sg3N0kq8= knative.dev/hack v0.0.0-20240607132042-09143140a254/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= -knative.dev/pkg v0.0.0-20240614135239-339c22b8218c h1:OaKrY7L6rzWTvs51JlieJajL40F6CpBbvO1aZspg2EA= -knative.dev/pkg v0.0.0-20240614135239-339c22b8218c/go.mod h1:l7R8/SteYph0mZDsVgq3fVs4mWp1DaYx9BJJX68U6ik= +knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef h1:EAYfNP+YJ3f4KeLpXEIm3KQFN7BXla9SVD81JzzbzFo= +knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef/go.mod h1:Wikg4u73T6vk9TctrxZt60VXzqmGEQIx0iKfk1+9o4c= 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/knative.dev/pkg/apis/condition_set.go b/vendor/knative.dev/pkg/apis/condition_set.go index 1b110475..940d1b3a 100644 --- a/vendor/knative.dev/pkg/apis/condition_set.go +++ b/vendor/knative.dev/pkg/apis/condition_set.go @@ -17,12 +17,12 @@ limitations under the License. package apis import ( + "errors" + "fmt" "reflect" "sort" "time" - "fmt" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -234,7 +234,7 @@ func (r conditionsImpl) ClearCondition(t ConditionType) error { } // Terminal conditions are not handled as they can't be nil if r.isTerminal(t) { - return fmt.Errorf("clearing terminal conditions not implemented") + return errors.New("clearing terminal conditions not implemented") } cond := r.GetCondition(t) if cond == nil { diff --git a/vendor/knative.dev/pkg/apis/convert.go b/vendor/knative.dev/pkg/apis/convert.go index d6a28a07..72e9b676 100644 --- a/vendor/knative.dev/pkg/apis/convert.go +++ b/vendor/knative.dev/pkg/apis/convert.go @@ -24,7 +24,6 @@ func ConvertToViaProxy( ctx context.Context, source, proxy, sink Convertible, ) error { - if err := source.ConvertTo(ctx, proxy); err != nil { return err } @@ -38,7 +37,6 @@ func ConvertFromViaProxy( ctx context.Context, source, proxy, sink Convertible, ) error { - if err := proxy.ConvertFrom(ctx, source); err != nil { return err } diff --git a/vendor/knative.dev/pkg/apis/deprecated.go b/vendor/knative.dev/pkg/apis/deprecated.go index 8f07e71b..b5dfde2f 100644 --- a/vendor/knative.dev/pkg/apis/deprecated.go +++ b/vendor/knative.dev/pkg/apis/deprecated.go @@ -94,7 +94,7 @@ func getPrefixedNamedFieldValues(prefix string, obj interface{}) (map[string]ref return fields, inlined } - for i := 0; i < objValue.NumField(); i++ { + for i := range objValue.NumField() { tf := objValue.Type().Field(i) if v := objValue.Field(i); v.IsValid() { jTag := tf.Tag.Get("json") diff --git a/vendor/knative.dev/pkg/apis/duck/v1/addressable_types.go b/vendor/knative.dev/pkg/apis/duck/v1/addressable_types.go index a855c385..3877683c 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/addressable_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/addressable_types.go @@ -54,10 +54,8 @@ type Addressable struct { Audience *string `json:"audience,omitempty"` } -var ( - // Addressable is a Convertible type. - _ apis.Convertible = (*Addressable)(nil) -) +// Addressable is a Convertible type. +var _ apis.Convertible = (*Addressable)(nil) // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/knative.dev/pkg/apis/duck/v1/destination.go b/vendor/knative.dev/pkg/apis/duck/v1/destination.go index 720d4067..34c1af94 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/destination.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/destination.go @@ -103,11 +103,11 @@ func (d *Destination) SetDefaults(ctx context.Context) { } } -func validateCACerts(CACert *string) *apis.FieldError { +func validateCACerts(caCert *string) *apis.FieldError { // Check the object. var errs *apis.FieldError - block, err := pem.Decode([]byte(*CACert)) + block, err := pem.Decode([]byte(*caCert)) if err != nil && block == nil { errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is invalid", "caCert")) return errs diff --git a/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go b/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go index 4d03b6b9..2609fb1c 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go @@ -102,7 +102,6 @@ func (kr *KReference) Validate(ctx context.Context) *apis.FieldError { Details: fmt.Sprintf("parent namespace: %q does not match ref: %q", parentNS, kr.Namespace), }) } - } } return errs diff --git a/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go b/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go index 1f6ee826..9229ba93 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go @@ -68,7 +68,7 @@ func (t *KResource) Populate() { // Populate ALL fields Type: "Birthday", Status: corev1.ConditionTrue, - LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Date(1984, 02, 28, 18, 52, 00, 00, time.UTC))}, + LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Date(1984, 2, 28, 18, 52, 0, 0, time.UTC))}, Reason: "Celebrate", Message: "n3wScott, find your party hat :tada:", }} diff --git a/vendor/knative.dev/pkg/apis/duck/v1/register.go b/vendor/knative.dev/pkg/apis/duck/v1/register.go index fb4348a0..b7366b66 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/register.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/register.go @@ -52,6 +52,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { (&KResource{}).GetListType(), &AddressableType{}, (&AddressableType{}).GetListType(), + &AuthenticatableType{}, + (&AuthenticatableType{}).GetListType(), &Source{}, (&Source{}).GetListType(), &WithPod{}, diff --git a/vendor/knative.dev/pkg/apis/duck/v1/source_types.go b/vendor/knative.dev/pkg/apis/duck/v1/source_types.go index 95b7d141..284ab318 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/source_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/source_types.go @@ -158,7 +158,7 @@ func (s *Source) Populate() { // Populate ALL fields Type: SourceConditionSinkProvided, Status: corev1.ConditionTrue, - LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Date(1984, 02, 28, 18, 52, 00, 00, time.UTC))}, + LastTransitionTime: apis.VolatileTime{Inner: metav1.NewTime(time.Date(1984, 2, 28, 18, 52, 0, 0, time.UTC))}, }} s.Status.SinkURI = &apis.URL{ Scheme: "https", diff --git a/vendor/knative.dev/pkg/apis/duck/v1/status_types.go b/vendor/knative.dev/pkg/apis/duck/v1/status_types.go index 15e26453..2e8d66f9 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/status_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/status_types.go @@ -97,7 +97,6 @@ func (s *Status) ConvertTo(ctx context.Context, sink *Status, predicates ...func conditions := make(apis.Conditions, 0, len(s.Conditions)) for _, c := range s.Conditions { - // Copy over the "happy" condition, which is the only condition that // we can reliably transfer. if c.Type == apis.ConditionReady || c.Type == apis.ConditionSucceeded { diff --git a/vendor/knative.dev/pkg/apis/duck/verify.go b/vendor/knative.dev/pkg/apis/duck/verify.go index 48675f93..4e33e659 100644 --- a/vendor/knative.dev/pkg/apis/duck/verify.go +++ b/vendor/knative.dev/pkg/apis/duck/verify.go @@ -24,8 +24,10 @@ import ( "knative.dev/pkg/kmp" ) -type Implementable = ducktypes.Implementable -type Populatable = ducktypes.Populatable +type ( + Implementable = ducktypes.Implementable + Populatable = ducktypes.Populatable +) // VerifyType verifies that a particular concrete resource properly implements // the provided Implementable duck type. It is expected that under the resource diff --git a/vendor/knative.dev/pkg/apis/kind2resource.go b/vendor/knative.dev/pkg/apis/kind2resource.go index 37ffe080..b1937086 100644 --- a/vendor/knative.dev/pkg/apis/kind2resource.go +++ b/vendor/knative.dev/pkg/apis/kind2resource.go @@ -17,7 +17,6 @@ limitations under the License. package apis import ( - "fmt" "strings" "k8s.io/apimachinery/pkg/runtime/schema" @@ -41,7 +40,7 @@ func KindToResource(gvk schema.GroupVersionKind) schema.GroupVersionResource { func pluralizeKind(kind string) string { ret := strings.ToLower(kind) if strings.HasSuffix(ret, "s") { - return fmt.Sprintf("%ses", ret) + return ret + "es" } - return fmt.Sprintf("%ss", ret) + return ret + "s" } diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go index 265b4e40..92595e2f 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go @@ -17,7 +17,7 @@ limitations under the License. package args import ( - "fmt" + "errors" "github.com/spf13/pflag" "k8s.io/gengo/args" @@ -59,13 +59,13 @@ func Validate(genericArgs *args.GeneratorArgs) error { customArgs := genericArgs.CustomArgs.(*CustomArgs) if len(genericArgs.OutputPackagePath) == 0 { - return fmt.Errorf("output package cannot be empty") + return errors.New("output package cannot be empty") } if len(customArgs.VersionedClientSetPackage) == 0 { - return fmt.Errorf("versioned clientset package cannot be empty") + return errors.New("versioned clientset package cannot be empty") } if len(customArgs.ExternalVersionsInformersPackage) == 0 { - return fmt.Errorf("external versions informers package cannot be empty") + return errors.New("external versions informers package cannot be empty") } return nil diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go index f0ca43f2..02f61519 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go @@ -43,7 +43,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat klog.Fatalf("Wrong CustomArgs type: %T", arguments.CustomArgs) } - versionPackagePath := filepath.Join(arguments.OutputPackagePath) + versionPackagePath := filepath.Clean(arguments.OutputPackagePath) var packageList generator.Packages @@ -389,8 +389,6 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg vers := make([]generator.Package, 0, 2*len(typesToGenerate)) for _, t := range typesToGenerate { - // Fix for golang iterator bug. - t := t packagePath := packagePath + "/" + strings.ToLower(t.Name.Name) typedInformerPackage := typedInformerPackage(groupPkgName, gv, customArgs.ExternalVersionsInformersPackage) @@ -501,7 +499,6 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg return tags.NeedsInformerInjection() }, }) - } return vers } @@ -513,8 +510,6 @@ func reconcilerPackages(basePackage string, groupPkgName string, gv clientgentyp vers := make([]generator.Package, 0, 4*len(typesToGenerate)) for _, t := range typesToGenerate { - // Fix for golang iterator bug. - t := t extracted := extractCommentTags(t) reconcilerClasses, hasReconcilerClass := extractReconcilerClassesTag(extracted) nonNamespaced := isNonNamespaced(extracted) @@ -677,7 +672,6 @@ func versionDuckPackages(basePackage string, groupPkgName string, gv clientgenty for _, t := range typesToGenerate { // Fix for golang iterator bug. - t := t packagePath := filepath.Join(packagePath, strings.ToLower(t.Name.Name)) // Impl diff --git a/vendor/knative.dev/pkg/configmap/example.go b/vendor/knative.dev/pkg/configmap/example.go index f14a6e6f..82aaf939 100644 --- a/vendor/knative.dev/pkg/configmap/example.go +++ b/vendor/knative.dev/pkg/configmap/example.go @@ -31,10 +31,8 @@ const ( ExampleChecksumAnnotation = "knative.dev/example-checksum" ) -var ( - // Allows for normalizing by collapsing newlines. - sequentialNewlines = regexp.MustCompile("(?:\r?\n)+") -) +// Allows for normalizing by collapsing newlines. +var sequentialNewlines = regexp.MustCompile("(?:\r?\n)+") // Checksum generates a checksum for the example value to be compared against // a respective annotation. diff --git a/vendor/knative.dev/pkg/configmap/filter.go b/vendor/knative.dev/pkg/configmap/filter.go index ed1040e2..6fb332a8 100644 --- a/vendor/knative.dev/pkg/configmap/filter.go +++ b/vendor/knative.dev/pkg/configmap/filter.go @@ -17,7 +17,7 @@ limitations under the License. package configmap import ( - "fmt" + "errors" "reflect" corev1 "k8s.io/api/core/v1" @@ -58,17 +58,17 @@ func ValidateConstructor(constructor interface{}) error { cType := reflect.TypeOf(constructor) if cType.Kind() != reflect.Func { - return fmt.Errorf("config constructor must be a function") + return errors.New("config constructor must be a function") } if cType.NumIn() != 1 || cType.In(0) != reflect.TypeOf(&corev1.ConfigMap{}) { - return fmt.Errorf("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)") + return errors.New("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)") } errorType := reflect.TypeOf((*error)(nil)).Elem() if cType.NumOut() != 2 || !cType.Out(1).Implements(errorType) { - return fmt.Errorf("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)") + return errors.New("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)") } return nil } diff --git a/vendor/knative.dev/pkg/configmap/store.go b/vendor/knative.dev/pkg/configmap/store.go index 375a474c..e2658021 100644 --- a/vendor/knative.dev/pkg/configmap/store.go +++ b/vendor/knative.dev/pkg/configmap/store.go @@ -81,8 +81,8 @@ func NewUntypedStore( name string, logger Logger, constructors Constructors, - onAfterStore ...func(name string, value interface{})) *UntypedStore { - + onAfterStore ...func(name string, value interface{}), +) *UntypedStore { store := &UntypedStore{ name: name, logger: logger, diff --git a/vendor/knative.dev/pkg/controller/controller.go b/vendor/knative.dev/pkg/controller/controller.go index 9fdb0a9d..152d837d 100644 --- a/vendor/knative.dev/pkg/controller/controller.go +++ b/vendor/knative.dev/pkg/controller/controller.go @@ -54,14 +54,12 @@ const ( DefaultResyncPeriod = 10 * time.Hour ) -var ( - // DefaultThreadsPerController is the number of threads to use - // when processing the controller's workqueue. Controller binaries - // may adjust this process-wide default. For finer control, invoke - // Run on the controller directly. - // TODO rename the const to Concurrency and deprecated this - DefaultThreadsPerController = 2 -) +// DefaultThreadsPerController is the number of threads to use +// when processing the controller's workqueue. Controller binaries +// may adjust this process-wide default. For finer control, invoke +// Run on the controller directly. +// TODO rename the const to Concurrency and deprecated this +var DefaultThreadsPerController = 2 // Reconciler is the interface that controller implementations are expected // to implement, so that the shared controller.Impl can drive work through it. @@ -226,7 +224,7 @@ type Impl struct { // ControllerOptions encapsulates options for creating a new controller, // including throttling and stats behavior. -type ControllerOptions struct { //nolint // for backcompat. +type ControllerOptions struct { WorkQueueName string Logger *zap.SugaredLogger Reporter StatsReporter @@ -484,7 +482,7 @@ func (c *Impl) RunContext(ctx context.Context, threadiness int) error { // Launch workers to process resources that get enqueued to our workqueue. c.logger.Info("Starting controller and workers") - for i := 0; i < threadiness; i++ { + for range threadiness { sg.Add(1) go func() { defer sg.Done() @@ -625,7 +623,6 @@ func IsSkipKey(err error) bool { // Is implements the Is() interface of error. It returns whether the target // error can be treated as equivalent to a permanentError. func (skipKeyError) Is(target error) bool { - //nolint: errorlint // This check is actually fine. _, ok := target.(skipKeyError) return ok } @@ -652,7 +649,6 @@ func IsPermanentError(err error) bool { // Is implements the Is() interface of error. It returns whether the target // error can be treated as equivalent to a permanentError. func (permanentError) Is(target error) bool { - //nolint: errorlint // This check is actually fine. _, ok := target.(permanentError) return ok } @@ -712,7 +708,6 @@ func IsRequeueKey(err error) (bool, time.Duration) { // Is implements the Is() interface of error. It returns whether the target // error can be treated as equivalent to a requeueKeyError. func (requeueKeyError) Is(target error) bool { - //nolint: errorlint // This check is actually fine. _, ok := target.(requeueKeyError) return ok } @@ -728,7 +723,6 @@ type Informer interface { // of them to synchronize. func StartInformers(stopCh <-chan struct{}, informers ...Informer) error { for _, informer := range informers { - informer := informer go informer.Run(stopCh) } @@ -746,7 +740,6 @@ func RunInformers(stopCh <-chan struct{}, informers ...Informer) (func(), error) var wg sync.WaitGroup wg.Add(len(informers)) for _, informer := range informers { - informer := informer go func() { defer wg.Done() informer.Run(stopCh) @@ -764,8 +757,8 @@ func RunInformers(stopCh <-chan struct{}, informers ...Informer) (func(), error) // WaitForCacheSyncQuick is the same as cache.WaitForCacheSync but with a much reduced // check-rate for the sync period. func WaitForCacheSyncQuick(stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) bool { - err := wait.PollImmediateUntil(time.Millisecond, - func() (bool, error) { + err := wait.PollUntilContextCancel(wait.ContextForChannel(stopCh), time.Millisecond, true, + func(context.Context) (bool, error) { for _, syncFunc := range cacheSyncs { if !syncFunc() { return false, nil @@ -773,7 +766,7 @@ func WaitForCacheSyncQuick(stopCh <-chan struct{}, cacheSyncs ...cache.InformerS } return true, nil }, - stopCh) + ) return err == nil } diff --git a/vendor/knative.dev/pkg/controller/stats_reporter.go b/vendor/knative.dev/pkg/controller/stats_reporter.go index 6735285d..99386f91 100644 --- a/vendor/knative.dev/pkg/controller/stats_reporter.go +++ b/vendor/knative.dev/pkg/controller/stats_reporter.go @@ -194,7 +194,6 @@ func (r *reporter) ReportReconcile(duration time.Duration, success string, key t tag.Insert(successTagKey, success), tag.Insert(NamespaceTagKey, key.Namespace), ) - if err != nil { return err } diff --git a/vendor/knative.dev/pkg/environment/client_config.go b/vendor/knative.dev/pkg/environment/client_config.go index aef33927..9f1883d2 100644 --- a/vendor/knative.dev/pkg/environment/client_config.go +++ b/vendor/knative.dev/pkg/environment/client_config.go @@ -86,7 +86,6 @@ func (c *ClientConfig) GetRESTConfig() (*rest.Config, error) { loadingRules, overrides, ).ClientConfig() - if err != nil { return nil, fmt.Errorf("failed to create client config: %w", err) } diff --git a/vendor/knative.dev/pkg/hack/update-k8s-deps.sh b/vendor/knative.dev/pkg/hack/format-code.sh similarity index 68% rename from vendor/knative.dev/pkg/hack/update-k8s-deps.sh rename to vendor/knative.dev/pkg/hack/format-code.sh index d97170f1..b9ccea8f 100644 --- a/vendor/knative.dev/pkg/hack/update-k8s-deps.sh +++ b/vendor/knative.dev/pkg/hack/format-code.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2020 The Knative Authors +# Copyright 2024 The Knative Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,12 +18,6 @@ set -o errexit set -o nounset set -o pipefail -source $(dirname "$0")/../vendor/knative.dev/hack/library.sh -run_go_tool knative.dev/test-infra/buoy \ - buoy float ${REPO_ROOT_DIR}/go.mod \ - --release "$1" --domain k8s.io --ruleset=Release \ - | xargs -n1 -t go get -d - -./hack/update-deps.sh +go run mvdan.cc/gofumpt@latest -l -w . diff --git a/vendor/knative.dev/pkg/injection/informers.go b/vendor/knative.dev/pkg/injection/informers.go index 9356f8d7..2c7a283c 100644 --- a/vendor/knative.dev/pkg/injection/informers.go +++ b/vendor/knative.dev/pkg/injection/informers.go @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ +//nolint:fatcontext package injection import ( @@ -93,7 +94,6 @@ func (i *impl) SetupInformers(ctx context.Context, cfg *rest.Config) (context.Co for _, fii := range i.GetFilteredInformers() { ctx, filteredinfs = fii(ctx) informers = append(informers, filteredinfs...) - } return ctx, informers } diff --git a/vendor/knative.dev/pkg/kmeta/names.go b/vendor/knative.dev/pkg/kmeta/names.go index 963b121d..0977544c 100644 --- a/vendor/knative.dev/pkg/kmeta/names.go +++ b/vendor/knative.dev/pkg/kmeta/names.go @@ -18,6 +18,7 @@ package kmeta import ( "crypto/md5" //nolint:gosec // No strong cryptography needed. + "encoding/hex" "fmt" "regexp" ) @@ -53,7 +54,7 @@ func ChildName(parent, suffix string) string { // Format the return string, if it's shorter than longest: pad with // beginning of the suffix. This happens, for example, when parent is // short, but the suffix is very long. - ret := parent + fmt.Sprintf("%x", h) + ret := parent + hex.EncodeToString(h[:]) if d := longest - len(ret); d > 0 { ret += suffix[:d] } diff --git a/vendor/knative.dev/pkg/leaderelection/context.go b/vendor/knative.dev/pkg/leaderelection/context.go index b0122b84..15f9376e 100644 --- a/vendor/knative.dev/pkg/leaderelection/context.go +++ b/vendor/knative.dev/pkg/leaderelection/context.go @@ -117,7 +117,8 @@ type standardBuilder struct { } func (b *standardBuilder) buildElector(ctx context.Context, la reconciler.LeaderAware, - queueName string, enq func(reconciler.Bucket, types.NamespacedName)) (Elector, error) { + queueName string, enq func(reconciler.Bucket, types.NamespacedName), +) (Elector, error) { logger := logging.FromContext(ctx) id := b.lec.Identity @@ -132,9 +133,6 @@ func (b *standardBuilder) buildElector(ctx context.Context, la reconciler.Leader bkts := newStandardBuckets(queueName, b.lec) electors := make([]Elector, 0, b.lec.Buckets) for _, bkt := range bkts { - // Use a local var which won't change across the for loop since it is - // used in a callback asynchronously. - bkt := bkt rl, err := resourcelock.New(knativeResourceLock, system.Namespace(), // use namespace we are running in bkt.Name(), @@ -191,7 +189,7 @@ func newStandardBuckets(queueName string, cc ComponentConfig) []reconciler.Bucke } } names := make(sets.Set[string], cc.Buckets) - for i := uint32(0); i < cc.Buckets; i++ { + for i := range cc.Buckets { names.Insert(ln(i)) } @@ -238,7 +236,7 @@ func NewStatefulSetBucketAndSet(buckets int) (reconciler.Bucket, *hash.BucketSet } names := make(sets.Set[string], buckets) - for i := 0; i < buckets; i++ { + for i := range buckets { names.Insert(statefulSetPodDNS(i, ssc)) } diff --git a/vendor/knative.dev/pkg/logging/config.go b/vendor/knative.dev/pkg/logging/config.go index a95dfe8f..1898ac34 100644 --- a/vendor/knative.dev/pkg/logging/config.go +++ b/vendor/knative.dev/pkg/logging/config.go @@ -197,7 +197,8 @@ func levelFromString(level string) (*zapcore.Level, error) { // UpdateLevelFromConfigMap returns a helper func that can be used to update the logging level // when a config map is updated func UpdateLevelFromConfigMap(logger *zap.SugaredLogger, atomicLevel zap.AtomicLevel, - levelKey string) func(configMap *corev1.ConfigMap) { + levelKey string, +) func(configMap *corev1.ConfigMap) { return func(configMap *corev1.ConfigMap) { config, err := NewConfigFromConfigMap(configMap) if err != nil { diff --git a/vendor/knative.dev/pkg/metrics/config.go b/vendor/knative.dev/pkg/metrics/config.go index ce5e7f87..9ed17ef6 100644 --- a/vendor/knative.dev/pkg/metrics/config.go +++ b/vendor/knative.dev/pkg/metrics/config.go @@ -58,11 +58,9 @@ const ( prometheusHostEnvName = "METRICS_PROMETHEUS_HOST" ) -var ( - // TestOverrideBundleCount is a variable for testing to reduce the size (number of metrics) buffered before - // OpenCensus will send a bundled metric report. Only applies if non-zero. - TestOverrideBundleCount = 0 -) +// TestOverrideBundleCount is a variable for testing to reduce the size (number of metrics) buffered before +// OpenCensus will send a bundled metric report. Only applies if non-zero. +var TestOverrideBundleCount = 0 // Metrics backend "enum". const ( diff --git a/vendor/knative.dev/pkg/metrics/exporter.go b/vendor/knative.dev/pkg/metrics/exporter.go index a4c83734..95e0f5b2 100644 --- a/vendor/knative.dev/pkg/metrics/exporter.go +++ b/vendor/knative.dev/pkg/metrics/exporter.go @@ -271,8 +271,7 @@ func flushGivenExporter(e view.Exporter) bool { return false } -type noneExporter struct { -} +type noneExporter struct{} // NoneExporter implements view.Exporter in the nil case. func (*noneExporter) ExportView(*view.Data) { diff --git a/vendor/knative.dev/pkg/metrics/metrics.go b/vendor/knative.dev/pkg/metrics/metrics.go index b65f470c..a0c64343 100644 --- a/vendor/knative.dev/pkg/metrics/metrics.go +++ b/vendor/knative.dev/pkg/metrics/metrics.go @@ -125,9 +125,7 @@ type resultMetric struct { measure *stats.Int64Measure } -var ( - _ metrics.ResultMetric = (*resultMetric)(nil) -) +var _ metrics.ResultMetric = (*resultMetric)(nil) // Increment implements ResultMetric func (m resultMetric) Increment(ctx context.Context, code, method, host string) { diff --git a/vendor/knative.dev/pkg/metrics/opencensus_exporter.go b/vendor/knative.dev/pkg/metrics/opencensus_exporter.go index 59e33ab0..8ea0f6e4 100644 --- a/vendor/knative.dev/pkg/metrics/opencensus_exporter.go +++ b/vendor/knative.dev/pkg/metrics/opencensus_exporter.go @@ -64,7 +64,9 @@ func getFactory(defaultExporter view.Exporter, stored []ocagent.ExporterOption) // Don't create duplicate exporters for the default exporter. return defaultExporter, nil } - opts := append(stored, ocagent.WithResourceDetector( + opts := make([]ocagent.ExporterOption, 0, len(stored)+1) + opts = append(opts, stored...) + opts = append(opts, ocagent.WithResourceDetector( func(context.Context) (*resource.Resource, error) { return r, nil })) diff --git a/vendor/knative.dev/pkg/metrics/prometheus_exporter.go b/vendor/knative.dev/pkg/metrics/prometheus_exporter.go index 5f11c12e..7dfcc094 100644 --- a/vendor/knative.dev/pkg/metrics/prometheus_exporter.go +++ b/vendor/knative.dev/pkg/metrics/prometheus_exporter.go @@ -42,7 +42,6 @@ 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. func newPrometheusExporter(config *metricsConfig, logger *zap.SugaredLogger) (view.Exporter, ResourceExporterFactory, error) { e, err := prom.NewExporter(prom.Options{Namespace: config.component}) if err != nil { @@ -86,7 +85,7 @@ func startNewPromSrv(e *prom.Exporter, host string, port int) *http.Server { curPromSrv = &http.Server{ Addr: host + ":" + strconv.Itoa(port), Handler: sm, - ReadHeaderTimeout: time.Minute, //https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6 + ReadHeaderTimeout: time.Minute, // https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6 } return curPromSrv } diff --git a/vendor/knative.dev/pkg/metrics/resource_view.go b/vendor/knative.dev/pkg/metrics/resource_view.go index 69e4ab43..d4e2c599 100644 --- a/vendor/knative.dev/pkg/metrics/resource_view.go +++ b/vendor/knative.dev/pkg/metrics/resource_view.go @@ -48,15 +48,17 @@ type meterExporter struct { // for each observed Resource. This is needed because OpenCensus support for // Resources is a bit tacked-on rather than being a first-class component like // Tags are. -type ResourceExporterFactory func(*resource.Resource) (view.Exporter, error) -type meters struct { - meters map[string]*meterExporter - factory ResourceExporterFactory - lock sync.Mutex - clock clock.WithTicker - ticker clock.Ticker - tickerStopChan chan struct{} -} +type ( + ResourceExporterFactory func(*resource.Resource) (view.Exporter, error) + meters struct { + meters map[string]*meterExporter + factory ResourceExporterFactory + lock sync.Mutex + clock clock.WithTicker + ticker clock.Ticker + tickerStopChan chan struct{} + } +) // Lock regime: lock allMeters before resourceViews. The critical path is in // optionForResource, which must lock allMeters, but only needs to lock @@ -305,7 +307,7 @@ func optionForResource(r *resource.Resource) (stats.Options, error) { // If we can't create exporters but we have a Meter, return that. return mE.o, nil } - return nil, fmt.Errorf("whoops, allMeters.factory is nil") + return nil, errors.New("whoops, allMeters.factory is nil") } exporter, err := allMeters.factory(r) if err != nil { @@ -421,15 +423,19 @@ func (*defaultMeterImpl) Find(name string) *view.View { func (*defaultMeterImpl) Register(views ...*view.View) error { return view.Register(views...) } + func (*defaultMeterImpl) Unregister(views ...*view.View) { view.Unregister(views...) } + func (*defaultMeterImpl) SetReportingPeriod(t time.Duration) { view.SetReportingPeriod(t) } + func (*defaultMeterImpl) RegisterExporter(e view.Exporter) { view.RegisterExporter(e) } + func (*defaultMeterImpl) UnregisterExporter(e view.Exporter) { view.UnregisterExporter(e) } @@ -438,6 +444,7 @@ func (*defaultMeterImpl) Stop() {} func (*defaultMeterImpl) RetrieveData(viewName string) ([]*view.Row, error) { return view.RetrieveData(viewName) } + func (*defaultMeterImpl) SetResource(*resource.Resource) { } diff --git a/vendor/knative.dev/pkg/network/h2c.go b/vendor/knative.dev/pkg/network/h2c.go index e1671233..d0608be7 100644 --- a/vendor/knative.dev/pkg/network/h2c.go +++ b/vendor/knative.dev/pkg/network/h2c.go @@ -32,7 +32,7 @@ func NewServer(addr string, h http.Handler) *http.Server { h1s := &http.Server{ Addr: addr, Handler: h2c.NewHandler(h, &http2.Server{}), - ReadHeaderTimeout: time.Minute, //https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6 + ReadHeaderTimeout: time.Minute, // https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6 } return h1s diff --git a/vendor/knative.dev/pkg/reconciler/configstore.go b/vendor/knative.dev/pkg/reconciler/configstore.go index 6b61856d..3cbfbbff 100644 --- a/vendor/knative.dev/pkg/reconciler/configstore.go +++ b/vendor/knative.dev/pkg/reconciler/configstore.go @@ -33,7 +33,7 @@ var _ ConfigStore = ConfigStores{} func (stores ConfigStores) ToContext(ctx context.Context) context.Context { for _, s := range stores { - ctx = s.ToContext(ctx) + ctx = s.ToContext(ctx) //nolint:fatcontext } return ctx } diff --git a/vendor/knative.dev/pkg/reconciler/events.go b/vendor/knative.dev/pkg/reconciler/events.go index df4c366c..9d249bc9 100644 --- a/vendor/knative.dev/pkg/reconciler/events.go +++ b/vendor/knative.dev/pkg/reconciler/events.go @@ -62,7 +62,7 @@ func NewEvent(eventtype, reason, messageFmt string, args ...interface{}) Event { // ReconcilerEvent wraps the fields required for recorders to create a // kubernetes recorder Event. -type ReconcilerEvent struct { //nolint:revive // for backcompat. +type ReconcilerEvent struct { //nolint:errname EventType string Reason string Format string diff --git a/vendor/knative.dev/pkg/test/helpers/dir.go b/vendor/knative.dev/pkg/test/helpers/dir.go index e6df6112..e5085f00 100644 --- a/vendor/knative.dev/pkg/test/helpers/dir.go +++ b/vendor/knative.dev/pkg/test/helpers/dir.go @@ -23,7 +23,7 @@ import ( "strings" ) -const allUsersFullPermission = 0777 +const allUsersFullPermission = 0o777 // CreateDir creates dir if does not exist. // The created dir will have the permission bits as 0777, which means everyone can read/write/execute it. diff --git a/vendor/knative.dev/pkg/test/helpers/name.go b/vendor/knative.dev/pkg/test/helpers/name.go index 0ceaed59..4da8e4dc 100644 --- a/vendor/knative.dev/pkg/test/helpers/name.go +++ b/vendor/knative.dev/pkg/test/helpers/name.go @@ -32,12 +32,14 @@ const ( testNamePrefix = "Test" ) +var nameRand *rand.Rand + func init() { // Properly seed the random number generator so RandomString() is actually random. // Otherwise, rerunning tests will generate the same names for the test resources, causing conflicts with // already existing resources. seed := time.Now().UTC().UnixNano() - rand.Seed(seed) + nameRand = rand.New(rand.NewSource(seed)) } type named interface { @@ -74,7 +76,7 @@ func AppendRandomString(prefix string) string { func RandomString() string { suffix := make([]byte, randSuffixLen) for i := range suffix { - suffix[i] = letterBytes[rand.Intn(len(letterBytes))] + suffix[i] = letterBytes[nameRand.Intn(len(letterBytes))] } return string(suffix) } diff --git a/vendor/knative.dev/pkg/test/logging/logging.go b/vendor/knative.dev/pkg/test/logging/logging.go index 74df6dfd..0946077a 100644 --- a/vendor/knative.dev/pkg/test/logging/logging.go +++ b/vendor/knative.dev/pkg/test/logging/logging.go @@ -67,6 +67,8 @@ func (e *zapMetricExporter) ExportView(vd *view.Data) { // GetEmitableSpan starts and returns a trace.Span with a name that // is used by the ExportSpan method to emit the span. +// +//nolint:spancheck func GetEmitableSpan(ctx context.Context, metricName string) *trace.Span { _, span := trace.StartSpan(ctx, emitableSpanNamePrefix+metricName) return span diff --git a/vendor/knative.dev/pkg/tracing/config/tracing.go b/vendor/knative.dev/pkg/tracing/config/tracing.go index 4d1831fc..633ce3d4 100644 --- a/vendor/knative.dev/pkg/tracing/config/tracing.go +++ b/vendor/knative.dev/pkg/tracing/config/tracing.go @@ -135,12 +135,12 @@ func JSONToTracingConfig(jsonCfg string) (*Config, error) { cfg, err := NewTracingConfigFromMap(configMap) if err != nil { - return NoopConfig(), nil + return NoopConfig(), nil //nolint:nilerr } return cfg, nil } -func TracingConfigToJSON(cfg *Config) (string, error) { //nolint // for backcompat. +func TracingConfigToJSON(cfg *Config) (string, error) { if cfg == nil { return "", nil } @@ -150,7 +150,7 @@ func TracingConfigToJSON(cfg *Config) (string, error) { //nolint // for backcomp if cfg.ZipkinEndpoint != "" { out[zipkinEndpointKey] = cfg.ZipkinEndpoint } - out[debugKey] = fmt.Sprint(cfg.Debug) + out[debugKey] = strconv.FormatBool(cfg.Debug) out[sampleRateKey] = fmt.Sprint(cfg.SampleRate) jsonCfg, err := json.Marshal(out) diff --git a/vendor/knative.dev/pkg/tracker/interface.go b/vendor/knative.dev/pkg/tracker/interface.go index 5e580b34..58bc941d 100644 --- a/vendor/knative.dev/pkg/tracker/interface.go +++ b/vendor/knative.dev/pkg/tracker/interface.go @@ -177,5 +177,4 @@ func (ref *Reference) Validate(ctx context.Context) *apis.FieldError { } return errs - } diff --git a/vendor/modules.txt b/vendor/modules.txt index 838d5c85..3d73726c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -287,7 +287,7 @@ gomodules.xyz/jsonpatch/v2 # google.golang.org/api v0.183.0 ## explicit; go 1.20 google.golang.org/api/support/bundler -# google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e +# google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 ## explicit; go 1.20 google.golang.org/genproto/googleapis/api/httpbody # google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 @@ -842,8 +842,8 @@ k8s.io/utils/trace # knative.dev/hack v0.0.0-20240607132042-09143140a254 ## explicit; go 1.18 knative.dev/hack -# knative.dev/pkg v0.0.0-20240614135239-339c22b8218c -## explicit; go 1.21 +# knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef +## explicit; go 1.22 knative.dev/pkg/apis knative.dev/pkg/apis/duck knative.dev/pkg/apis/duck/ducktypes