From 1b9d15bf82429e26330cd5e2a3a3d73035e404c3 Mon Sep 17 00:00:00 2001 From: Knative Automation Date: Wed, 26 Jun 2024 13:24:35 +0000 Subject: [PATCH] upgrade to latest dependencies bumping knative.dev/eventing f84a98c...922edf2: > 922edf2 Remove unneeded replaces in go.mod (# 8033) > 0f71292 [main] Upgrade to latest dependencies (# 8029) > 9cf272a Event Type API: updated test name to avoid confusion (# 8030) > 6352784 Updating RetryableHttp lib to latest (# 8026) > d4e647d List applying policies in Channel and propagate EventPolicies to underlying channel (# 8014) > 7253b36 Add EventPolicy resource for rekt tests (# 8010) > e21311d [main] Upgrade to latest dependencies (# 8019) > 36c904a Fix test case in `TestCreateExpectedEventDeliveryMap` (# 8023) > 825202f Fix test case in TestCreateExpectedEventPatterns (# 8022) > c9deeb9 Add JobSink to storage version migration (# 8020) bumping knative.dev/serving 6d90f54...b02cc68: > b02cc68 Update net-istio nightly (# 15358) > 1dff15d feat: add defaults configurable runtimeClassName (# 15271) > 5558435 Update net-contour nightly (# 15350) > 2ac8b35 add tests to validate uptime of services during user pod deletion (# 15284) > 7193018 upgrade to latest dependencies (# 15351) > d6d8525 use wait.Interrupted (# 15342) > 48d3196 Update net-gateway-api nightly (# 15349) > 866782a Update net-istio nightly (# 15348) > 226c771 Bump ko-build/setup-ko from 0.6 to 0.7 (# 15346) > 6fa0f6d upgrade to latest dependencies (# 15344) > a5ad85b Update net-gateway-api nightly (# 15337) > b22e06c Update net-kourier nightly (# 15340) > de3b9ba upgrade to latest dependencies (# 15341) bumping knative.dev/pkg 915c009...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) Signed-off-by: Knative Automation --- go.mod | 6 +-- go.sum | 20 +++---- .../pkg/apis/duck/v1/channelable_types.go | 3 ++ .../pkg/apis/duck/v1/zz_generated.deepcopy.go | 1 + .../apis/messaging/v1/channel_lifecycle.go | 21 ++++++++ .../messaging/v1/in_memory_channel_types.go | 4 -- .../messaging/v1/zz_generated.deepcopy.go | 1 - .../eventing/pkg/auth/event_policy.go | 52 +++++++++++++++++++ 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 - .../pkg/apis/duck/v1beta1/destination.go | 5 +- .../pkg/apis/duck/v1beta1/source_types.go | 2 +- .../pkg/apis/duck/v1beta1/status_types.go | 2 +- 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 +-- .../pkg/configmap/informer/synced_callback.go | 4 +- 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 +- .../pkg/injection/sharedmain/main.go | 5 +- 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 +- vendor/knative.dev/pkg/profiling/server.go | 2 +- .../knative.dev/pkg/reconciler/configstore.go | 2 +- vendor/knative.dev/pkg/reconciler/events.go | 2 +- .../pkg/reconciler/testing/context.go | 2 +- .../pkg/reconciler/testing/table.go | 7 ++- .../knative.dev/pkg/tracing/config/tracing.go | 6 +-- vendor/knative.dev/pkg/tracker/interface.go | 1 - vendor/knative.dev/pkg/webhook/admission.go | 2 +- .../pkg/webhook/certificates/certificates.go | 6 ++- .../pkg/webhook/certificates/controller.go | 1 - .../webhook/certificates/resources/certs.go | 4 +- vendor/knative.dev/pkg/webhook/conversion.go | 2 +- vendor/knative.dev/pkg/webhook/helper.go | 8 +-- vendor/knative.dev/pkg/webhook/json/decode.go | 5 +- .../pkg/webhook/psbinding/controller.go | 1 - .../pkg/webhook/psbinding/psbinding.go | 17 +++--- .../pkg/webhook/psbinding/reconciler.go | 10 ++-- .../defaulting/controller.go | 1 - .../defaulting/defaulting.go | 10 ++-- .../validation/controller.go | 2 - .../validation/reconcile_config.go | 10 ++-- .../validation/validation_admit.go | 7 +-- .../knative.dev/pkg/webhook/stats_reporter.go | 6 ++- vendor/knative.dev/pkg/webhook/webhook.go | 6 +-- vendor/modules.txt | 10 ++-- 70 files changed, 250 insertions(+), 189 deletions(-) rename vendor/knative.dev/pkg/hack/{update-k8s-deps.sh => format-code.sh} (68%) diff --git a/go.mod b/go.mod index 3b218bbe1..af1ed1a36 100644 --- a/go.mod +++ b/go.mod @@ -14,10 +14,10 @@ require ( k8s.io/api v0.29.2 k8s.io/apimachinery v0.29.2 k8s.io/client-go v0.29.2 - knative.dev/eventing v0.41.1-0.20240620173702-f84a98c60901 + knative.dev/eventing v0.41.1-0.20240626113428-922edf285258 knative.dev/hack v0.0.0-20240607132042-09143140a254 - knative.dev/pkg v0.0.0-20240620215714-915c00977757 - knative.dev/serving v0.41.1-0.20240620131618-6d90f5493686 + knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef + knative.dev/serving v0.41.1-0.20240626122742-b02cc68c4b6c ) require ( diff --git a/go.sum b/go.sum index 19d39e6bf..abe1616fd 100644 --- a/go.sum +++ b/go.sum @@ -207,10 +207,10 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= -github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-retryablehttp v0.6.7 h1:8/CAEZt/+F7kR7GevNHulKkUjLht3CPmn7egmhieNKo= -github.com/hashicorp/go-retryablehttp v0.6.7/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= @@ -723,16 +723,16 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/eventing v0.41.1-0.20240620173702-f84a98c60901 h1:f+8MaSnRI5U7hjTf4V8xhF4ppd3UvcJVJB7w0Z1WPMo= -knative.dev/eventing v0.41.1-0.20240620173702-f84a98c60901/go.mod h1:o6FjbuGhX9faLv57flszVIvbEw++dBpeuD/xExAEagc= +knative.dev/eventing v0.41.1-0.20240626113428-922edf285258 h1:kS7QyqeQsaEsvy8FBMKUD2eZbE0Rih6gZ+5fL3efCyw= +knative.dev/eventing v0.41.1-0.20240626113428-922edf285258/go.mod h1:TfF4KWA9K++M5dGYGBaDWPrs0hzv0UqXsLZsuG01YS4= 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/networking v0.0.0-20240611072033-3b8764c0bb4c h1:Q+DdJYzvhwAVWMQtP6mbEr5dNxpr+K9HAF9RqJmZefY= knative.dev/networking v0.0.0-20240611072033-3b8764c0bb4c/go.mod h1:WhZLv94eOMDGHbdZiMrw6cnRfN3WEcFgpjUcV0A48pI= -knative.dev/pkg v0.0.0-20240620215714-915c00977757 h1:vjPAW4ll00Yu0H/avu1vkjbHHh9n0DlukvWGl2eHrs4= -knative.dev/pkg v0.0.0-20240620215714-915c00977757/go.mod h1:uqK/Rec08I8njY3r2y8aY90Lmt/a8cUwm8H2XI9jHZk= -knative.dev/serving v0.41.1-0.20240620131618-6d90f5493686 h1:vsVRBvxZrC312+j3q/fhBJfHAsx+4DcOOChWZOP3CdE= -knative.dev/serving v0.41.1-0.20240620131618-6d90f5493686/go.mod h1:zvjO9iWedTW7/heF8A6rouZP47g4ZvmtDjUW2f88KQo= +knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef h1:EAYfNP+YJ3f4KeLpXEIm3KQFN7BXla9SVD81JzzbzFo= +knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef/go.mod h1:Wikg4u73T6vk9TctrxZt60VXzqmGEQIx0iKfk1+9o4c= +knative.dev/serving v0.41.1-0.20240626122742-b02cc68c4b6c h1:/n7KB+P3sLSeK7NfVz5n1LADWv18BDxrODwjMQNBOMo= +knative.dev/serving v0.41.1-0.20240626122742-b02cc68c4b6c/go.mod h1:hJmsIYz96VulSSDCPYfUIA14cwZAT6ehMST3zMfmUmU= 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/eventing/pkg/apis/duck/v1/channelable_types.go b/vendor/knative.dev/eventing/pkg/apis/duck/v1/channelable_types.go index fef82764d..82d75bd98 100644 --- a/vendor/knative.dev/eventing/pkg/apis/duck/v1/channelable_types.go +++ b/vendor/knative.dev/eventing/pkg/apis/duck/v1/channelable_types.go @@ -67,6 +67,9 @@ type ChannelableStatus struct { // resolved delivery options. // +optional DeliveryStatus `json:",inline"` + // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Channel + // +optional + AppliedEventPoliciesStatus `json:",inline"` } var ( diff --git a/vendor/knative.dev/eventing/pkg/apis/duck/v1/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/duck/v1/zz_generated.deepcopy.go index 609c7f6f6..d7965aaf4 100644 --- a/vendor/knative.dev/eventing/pkg/apis/duck/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/eventing/pkg/apis/duck/v1/zz_generated.deepcopy.go @@ -154,6 +154,7 @@ func (in *ChannelableStatus) DeepCopyInto(out *ChannelableStatus) { in.AddressStatus.DeepCopyInto(&out.AddressStatus) in.SubscribableStatus.DeepCopyInto(&out.SubscribableStatus) in.DeliveryStatus.DeepCopyInto(&out.DeliveryStatus) + in.AppliedEventPoliciesStatus.DeepCopyInto(&out.AppliedEventPoliciesStatus) return } diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go index 2936a1f19..4f225822f 100644 --- a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_lifecycle.go @@ -29,6 +29,7 @@ var chCondSet = apis.NewLivingConditionSet( ChannelConditionBackingChannelReady, ChannelConditionAddressable, ChannelConditionDeadLetterSinkResolved, + ChannelConditionEventPoliciesReady, ) const ( @@ -45,6 +46,10 @@ const ( // ChannelConditionDeadLetterSinkResolved has status True when there is a Dead Letter Sink ref or URI // defined in the Spec.Delivery, is a valid destination and its correctly resolved into a valid URI ChannelConditionDeadLetterSinkResolved apis.ConditionType = "DeadLetterSinkResolved" + + // ChannelConditionEventPoliciesReady has status True when all the EventPolicies which reference this + // Channel are Ready too. + ChannelConditionEventPoliciesReady apis.ConditionType = "EventPoliciesReady" ) // GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. @@ -146,3 +151,19 @@ func (cs *ChannelStatus) MarkDeadLetterSinkResolvedFailed(reason, messageFormat cs.DeliveryStatus = eventingduck.DeliveryStatus{} chCondSet.Manage(cs).MarkFalse(ChannelConditionDeadLetterSinkResolved, reason, messageFormat, messageA...) } + +func (cs *ChannelStatus) MarkEventPoliciesFailed(reason, messageFormat string, messageA ...interface{}) { + chCondSet.Manage(cs).MarkFalse(ChannelConditionEventPoliciesReady, reason, messageFormat, messageA...) +} + +func (cs *ChannelStatus) MarkEventPoliciesUnknown(reason, messageFormat string, messageA ...interface{}) { + chCondSet.Manage(cs).MarkUnknown(ChannelConditionEventPoliciesReady, reason, messageFormat, messageA...) +} + +func (cs *ChannelStatus) MarkEventPoliciesTrue() { + chCondSet.Manage(cs).MarkTrue(ChannelConditionEventPoliciesReady) +} + +func (cs *ChannelStatus) MarkEventPoliciesTrueWithReason(reason, messageFormat string, messageA ...interface{}) { + chCondSet.Manage(cs).MarkTrueWithReason(ChannelConditionEventPoliciesReady, reason, messageFormat, messageA...) +} diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go index cdf0f6075..5b0c971b5 100644 --- a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/in_memory_channel_types.go @@ -73,10 +73,6 @@ type InMemoryChannelSpec struct { type InMemoryChannelStatus struct { // Channel conforms to Duck type ChannelableStatus. eventingduckv1.ChannelableStatus `json:",inline"` - - // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker - // +optional - eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go index f0e08f87f..fff2d237b 100644 --- a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go @@ -245,7 +245,6 @@ func (in *InMemoryChannelSpec) DeepCopy() *InMemoryChannelSpec { func (in *InMemoryChannelStatus) DeepCopyInto(out *InMemoryChannelStatus) { *out = *in in.ChannelableStatus.DeepCopyInto(&out.ChannelableStatus) - in.AppliedEventPoliciesStatus.DeepCopyInto(&out.AppliedEventPoliciesStatus) return } diff --git a/vendor/knative.dev/eventing/pkg/auth/event_policy.go b/vendor/knative.dev/eventing/pkg/auth/event_policy.go index e049772f1..56ac38021 100644 --- a/vendor/knative.dev/eventing/pkg/auth/event_policy.go +++ b/vendor/knative.dev/eventing/pkg/auth/event_policy.go @@ -20,6 +20,9 @@ import ( "fmt" "strings" + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + "knative.dev/eventing/pkg/apis/feature" + "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/cache" @@ -287,3 +290,52 @@ func EventPolicyEventHandler(indexer cache.Indexer, gk schema.GroupKind, enqueue }, } } + +type EventPolicyStatusMarker interface { + MarkEventPoliciesFailed(reason, messageFormat string, messageA ...interface{}) + MarkEventPoliciesUnknown(reason, messageFormat string, messageA ...interface{}) + MarkEventPoliciesTrue() + MarkEventPoliciesTrueWithReason(reason, messageFormat string, messageA ...interface{}) +} + +func UpdateStatusWithEventPolicies(featureFlags feature.Flags, status *eventingduckv1.AppliedEventPoliciesStatus, statusMarker EventPolicyStatusMarker, eventPolicyLister listerseventingv1alpha1.EventPolicyLister, gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta) error { + status.Policies = nil + + applyingEvenPolicies, err := GetEventPoliciesForResource(eventPolicyLister, gvk, objectMeta) + if err != nil { + statusMarker.MarkEventPoliciesFailed("EventPoliciesGetFailed", "Failed to get applying event policies") + return fmt.Errorf("unable to get applying event policies: %w", err) + } + + if len(applyingEvenPolicies) > 0 { + unreadyEventPolicies := []string{} + for _, policy := range applyingEvenPolicies { + if !policy.Status.IsReady() { + unreadyEventPolicies = append(unreadyEventPolicies, policy.Name) + } else { + // only add Ready policies to the list + status.Policies = append(status.Policies, eventingduckv1.AppliedEventPolicyRef{ + Name: policy.Name, + APIVersion: v1alpha1.SchemeGroupVersion.String(), + }) + } + } + + if len(unreadyEventPolicies) == 0 { + statusMarker.MarkEventPoliciesTrue() + } else { + statusMarker.MarkEventPoliciesFailed("EventPoliciesNotReady", "event policies %s are not ready", strings.Join(unreadyEventPolicies, ", ")) + } + } else { + // we have no applying event policy. So we set the EP condition to True + if featureFlags.IsOIDCAuthentication() { + // in case of OIDC auth, we also set the message with the default authorization mode + statusMarker.MarkEventPoliciesTrueWithReason("DefaultAuthorizationMode", "Default authz mode is %q", featureFlags[feature.AuthorizationDefaultMode]) + } else { + // in case OIDC is disabled, we set EP condition to true too, but give some message that authz (EPs) require OIDC + statusMarker.MarkEventPoliciesTrueWithReason("OIDCDisabled", "Feature %q must be enabled to support Authorization", feature.OIDCAuthentication) + } + } + + return nil +} diff --git a/vendor/knative.dev/pkg/apis/condition_set.go b/vendor/knative.dev/pkg/apis/condition_set.go index 1b110475f..940d1b3ab 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 d6a28a072..72e9b6761 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 8f07e71b3..b5dfde2fb 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 a855c3857..3877683c3 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 720d40677..34c1af94f 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 4d03b6b97..2609fb1c9 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 1f6ee8264..9229ba930 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 fb4348a05..b7366b660 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 95b7d1417..284ab318d 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 15e264534..2e8d66f93 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/v1beta1/destination.go b/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go index ba83f1d4e..bc6e56ae4 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go +++ b/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go @@ -167,11 +167,12 @@ func validateDestinationRef(ref corev1.ObjectReference) *apis.FieldError { return errs } -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/v1beta1/source_types.go b/vendor/knative.dev/pkg/apis/duck/v1beta1/source_types.go index 60a502041..e1056cf82 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1beta1/source_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1beta1/source_types.go @@ -129,7 +129,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/v1beta1/status_types.go b/vendor/knative.dev/pkg/apis/duck/v1beta1/status_types.go index e1ae875eb..30f4354ac 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1beta1/status_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1beta1/status_types.go @@ -129,7 +129,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/verify.go b/vendor/knative.dev/pkg/apis/duck/verify.go index 48675f93a..4e33e6597 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 37ffe0803..b1937086e 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 265b4e40a..92595e2ff 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 f0ca43f2b..02f61519f 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 f14a6e6ff..82aaf9398 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 ed1040e27..6fb332a8c 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/informer/synced_callback.go b/vendor/knative.dev/pkg/configmap/informer/synced_callback.go index 0b3e2d3a9..80e776aa9 100644 --- a/vendor/knative.dev/pkg/configmap/informer/synced_callback.go +++ b/vendor/knative.dev/pkg/configmap/informer/synced_callback.go @@ -17,10 +17,10 @@ limitations under the License. package informer import ( + "context" "sync" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/apimachinery/pkg/util/wait" ) // namedWaitGroup is used to increment and decrement a WaitGroup by name @@ -107,6 +107,6 @@ func (s *syncedCallback) WaitForAllKeys(stopCh <-chan struct{}) error { case <-c: return nil case <-stopCh: - return wait.ErrWaitTimeout + return context.DeadlineExceeded } } diff --git a/vendor/knative.dev/pkg/configmap/store.go b/vendor/knative.dev/pkg/configmap/store.go index 375a474c2..e26580219 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 9fdb0a9d5..152d837d6 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 6735285db..99386f91b 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 aef33927e..9f1883d23 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 d97170f1c..b9ccea8fc 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 9356f8d7f..2c7a283c2 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/injection/sharedmain/main.go b/vendor/knative.dev/pkg/injection/sharedmain/main.go index 348599f09..86bb1e340 100644 --- a/vendor/knative.dev/pkg/injection/sharedmain/main.go +++ b/vendor/knative.dev/pkg/injection/sharedmain/main.go @@ -151,7 +151,6 @@ var ( // In addition to the MainWithConfig flow, it defines a `disabled-controllers` flag that allows disabling controllers // by name. func MainNamed(ctx context.Context, component string, ctors ...injection.NamedControllerConstructor) { - disabledControllers := flag.String("disable-controllers", "", "Comma-separated list of disabled controllers.") // HACK: This parses flags, so the above should be set once this runs. @@ -456,8 +455,8 @@ func SecretFetcher(ctx context.Context) metrics.SecretFetcher { // of the webhooks created from the given constructors. func ControllersAndWebhooksFromCtors(ctx context.Context, cmw *cminformer.InformedWatcher, - ctors ...injection.ControllerConstructor) ([]*controller.Impl, []interface{}) { - + ctors ...injection.ControllerConstructor, +) ([]*controller.Impl, []interface{}) { // Check whether the context has been infused with a leader elector builder. // If it has, then every reconciler we plan to start MUST implement LeaderAware. leEnabled := leaderelection.HasLeaderElection(ctx) diff --git a/vendor/knative.dev/pkg/kmeta/names.go b/vendor/knative.dev/pkg/kmeta/names.go index 963b121d2..0977544c8 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 b0122b84a..15f9376ed 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 a95dfe8fa..1898ac34f 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 ce5e7f875..9ed17ef67 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 a4c837348..95e0f5b2f 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 b65f470cc..a0c64343b 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 59e33ab09..8ea0f6e41 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 5f11c12e8..7dfcc094d 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 69e4ab435..d4e2c599d 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 e1671233d..d0608be72 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/profiling/server.go b/vendor/knative.dev/pkg/profiling/server.go index f362f36fa..9eceef51c 100644 --- a/vendor/knative.dev/pkg/profiling/server.go +++ b/vendor/knative.dev/pkg/profiling/server.go @@ -117,6 +117,6 @@ func NewServer(handler http.Handler) *http.Server { return &http.Server{ Addr: ":" + port, Handler: handler, - 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 } } diff --git a/vendor/knative.dev/pkg/reconciler/configstore.go b/vendor/knative.dev/pkg/reconciler/configstore.go index 6b61856d5..3cbfbbffb 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 df4c366cc..9d249bc9d 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/reconciler/testing/context.go b/vendor/knative.dev/pkg/reconciler/testing/context.go index 58b3b8d29..eb4d45b73 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/context.go +++ b/vendor/knative.dev/pkg/reconciler/testing/context.go @@ -51,7 +51,7 @@ func SetupFakeContextWithCancel(t testing.TB, fs ...func(context.Context) contex ctx, c := context.WithCancel(logtesting.TestContextWithLogger(t)) ctx = controller.WithEventRecorder(ctx, record.NewFakeRecorder(1000)) for _, f := range fs { - ctx = f(ctx) + ctx = f(ctx) //nolint:fatcontext } ctx = injection.WithConfig(ctx, &rest.Config{}) diff --git a/vendor/knative.dev/pkg/reconciler/testing/table.go b/vendor/knative.dev/pkg/reconciler/testing/table.go index d36c49b89..97cc92157 100644 --- a/vendor/knative.dev/pkg/reconciler/testing/table.go +++ b/vendor/knative.dev/pkg/reconciler/testing/table.go @@ -20,6 +20,7 @@ import ( "context" "path" "reflect" + "slices" "strings" "testing" @@ -168,7 +169,8 @@ func (r *TableRow) Test(t *testing.T, factory Factory) { t.Errorf("Error capturing actions by verb: %q", err) } - effectiveOpts := append(r.CmpOpts, defaultCmpOpts...) + effectiveOpts := slices.Concat(r.CmpOpts, defaultCmpOpts) + // Previous state is used to diff resource expected state for update requests that were missed. objPrevState := make(map[string]runtime.Object, len(r.Objects)) for _, o := range r.Objects { @@ -363,7 +365,8 @@ func (r *TableRow) Test(t *testing.T, factory Factory) { func filterUpdatesWithSubresource( subresource string, - actions []clientgotesting.UpdateAction) (result []clientgotesting.UpdateAction) { + actions []clientgotesting.UpdateAction, +) (result []clientgotesting.UpdateAction) { for _, action := range actions { if action.GetSubresource() == subresource { result = append(result, action) diff --git a/vendor/knative.dev/pkg/tracing/config/tracing.go b/vendor/knative.dev/pkg/tracing/config/tracing.go index 4d1831fc1..633ce3d4b 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 5e580b34c..58bc941d8 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/knative.dev/pkg/webhook/admission.go b/vendor/knative.dev/pkg/webhook/admission.go index db131b902..9e14eae89 100644 --- a/vendor/knative.dev/pkg/webhook/admission.go +++ b/vendor/knative.dev/pkg/webhook/admission.go @@ -88,7 +88,7 @@ func admissionHandler(rootLogger *zap.SugaredLogger, stats StatsReporter, c Admi <-synced } - var ttStart = time.Now() + ttStart := time.Now() logger := rootLogger logger.Infof("Webhook ServeHTTP request=%#v", r) diff --git a/vendor/knative.dev/pkg/webhook/certificates/certificates.go b/vendor/knative.dev/pkg/webhook/certificates/certificates.go index 5239279e5..21c6bdec6 100644 --- a/vendor/knative.dev/pkg/webhook/certificates/certificates.go +++ b/vendor/knative.dev/pkg/webhook/certificates/certificates.go @@ -48,8 +48,10 @@ type reconciler struct { serviceName string } -var _ controller.Reconciler = (*reconciler)(nil) -var _ pkgreconciler.LeaderAware = (*reconciler)(nil) +var ( + _ controller.Reconciler = (*reconciler)(nil) + _ pkgreconciler.LeaderAware = (*reconciler)(nil) +) // Reconcile implements controller.Reconciler func (r *reconciler) Reconcile(ctx context.Context, key string) error { diff --git a/vendor/knative.dev/pkg/webhook/certificates/controller.go b/vendor/knative.dev/pkg/webhook/certificates/controller.go index 1932e28c2..b076bd661 100644 --- a/vendor/knative.dev/pkg/webhook/certificates/controller.go +++ b/vendor/knative.dev/pkg/webhook/certificates/controller.go @@ -41,7 +41,6 @@ func NewController( ctx context.Context, cmw configmap.Watcher, ) *controller.Impl { - client := kubeclient.Get(ctx) secretInformer := secretinformer.Get(ctx) options := webhook.GetOptions(ctx) diff --git a/vendor/knative.dev/pkg/webhook/certificates/resources/certs.go b/vendor/knative.dev/pkg/webhook/certificates/resources/certs.go index 811eb569c..cb56c8cef 100644 --- a/vendor/knative.dev/pkg/webhook/certificates/resources/certs.go +++ b/vendor/knative.dev/pkg/webhook/certificates/resources/certs.go @@ -98,8 +98,8 @@ func createServerCertTemplate(name, namespace string, notAfter time.Time) (*x509 // Actually sign the cert and return things in a form that we can use later on func createCert(template, parent *x509.Certificate, pub, parentPriv interface{}) ( - cert *x509.Certificate, certPEM []byte, err error) { - + cert *x509.Certificate, certPEM []byte, err error, +) { certDER, err := x509.CreateCertificate(rand.Reader, template, parent, pub, parentPriv) if err != nil { return diff --git a/vendor/knative.dev/pkg/webhook/conversion.go b/vendor/knative.dev/pkg/webhook/conversion.go index 2e876c14f..fa3c76a70 100644 --- a/vendor/knative.dev/pkg/webhook/conversion.go +++ b/vendor/knative.dev/pkg/webhook/conversion.go @@ -40,7 +40,7 @@ type ConversionController interface { func conversionHandler(rootLogger *zap.SugaredLogger, stats StatsReporter, c ConversionController) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var ttStart = time.Now() + ttStart := time.Now() logger := rootLogger logger.Infof("Webhook ServeHTTP request=%#v", r) diff --git a/vendor/knative.dev/pkg/webhook/helper.go b/vendor/knative.dev/pkg/webhook/helper.go index a3647ac74..a9ff91fe2 100644 --- a/vendor/knative.dev/pkg/webhook/helper.go +++ b/vendor/knative.dev/pkg/webhook/helper.go @@ -29,8 +29,8 @@ import ( // adds all knative-keys not yet there. func EnsureLabelSelectorExpressions( current *metav1.LabelSelector, - want *metav1.LabelSelector) *metav1.LabelSelector { - + want *metav1.LabelSelector, +) *metav1.LabelSelector { if current == nil { return want } @@ -56,8 +56,8 @@ func EnsureLabelSelectorExpressions( func ensureLabelSelectorRequirements( current []metav1.LabelSelectorRequirement, - want []metav1.LabelSelectorRequirement) []metav1.LabelSelectorRequirement { - + want []metav1.LabelSelectorRequirement, +) []metav1.LabelSelectorRequirement { nonKnative := make([]metav1.LabelSelectorRequirement, 0, len(current)) for _, r := range current { if !strings.Contains(r.Key, "knative.dev") { diff --git a/vendor/knative.dev/pkg/webhook/json/decode.go b/vendor/knative.dev/pkg/webhook/json/decode.go index b62caec61..57720e81d 100644 --- a/vendor/knative.dev/pkg/webhook/json/decode.go +++ b/vendor/knative.dev/pkg/webhook/json/decode.go @@ -19,6 +19,7 @@ package json import ( "bytes" "encoding/json" + "errors" "io" ) @@ -32,7 +33,7 @@ var ( // Unmarshal is an alias for json.Unmarshal Unmarshal = json.Unmarshal - //Marshal is an alias for json.Marshal + // Marshal is an alias for json.Marshal Marshal = json.Marshal ) @@ -95,7 +96,7 @@ func findMetadataOffsets(bites []byte) (start, end int64, err error) { for { t, err = dec.Token() - if err == io.EOF { //nolint + if errors.Is(err, io.EOF) { break } if err != nil { diff --git a/vendor/knative.dev/pkg/webhook/psbinding/controller.go b/vendor/knative.dev/pkg/webhook/psbinding/controller.go index bceffcb4f..f79984721 100644 --- a/vendor/knative.dev/pkg/webhook/psbinding/controller.go +++ b/vendor/knative.dev/pkg/webhook/psbinding/controller.go @@ -78,7 +78,6 @@ func NewAdmissionController( withContext BindableContext, reconcilerOptions ...ReconcilerOption, ) *controller.Impl { - // Extract the assorted things from our context. client := kubeclient.Get(ctx) mwhInformer := mwhinformer.Get(ctx) diff --git a/vendor/knative.dev/pkg/webhook/psbinding/psbinding.go b/vendor/knative.dev/pkg/webhook/psbinding/psbinding.go index ee1d66a82..2236cadc6 100644 --- a/vendor/knative.dev/pkg/webhook/psbinding/psbinding.go +++ b/vendor/knative.dev/pkg/webhook/psbinding/psbinding.go @@ -118,9 +118,11 @@ type Reconciler struct { index index } -var _ controller.Reconciler = (*Reconciler)(nil) -var _ pkgreconciler.LeaderAware = (*Reconciler)(nil) -var _ webhook.AdmissionController = (*Reconciler)(nil) +var ( + _ controller.Reconciler = (*Reconciler)(nil) + _ pkgreconciler.LeaderAware = (*Reconciler)(nil) + _ webhook.AdmissionController = (*Reconciler)(nil) +) // We need to specifically exclude our deployment(s) from consideration, but this provides a way // of excluding other things as well. @@ -186,7 +188,8 @@ func (ac *Reconciler) Admit(ctx context.Context, request *admissionv1.AdmissionR Group: request.Kind.Group, Kind: request.Kind.Kind, Namespace: request.Namespace, - Name: orig.Name}, + Name: orig.Name, + }, labels.Set(orig.Labels)) if len(fbs) == 0 { // This doesn't apply! @@ -269,7 +272,8 @@ func (ac *Reconciler) reconcileMutatingWebhook(ctx context.Context, caCert []byt Group: gk.Group, Kind: gk.Kind, Namespace: ref.Namespace, - Name: ref.Name}, + Name: ref.Name, + }, fb) } else { selector, err := metav1.LabelSelectorAsSelector(ref.Selector) @@ -279,7 +283,8 @@ func (ac *Reconciler) reconcileMutatingWebhook(ctx context.Context, caCert []byt ib.associateSelection(inexactKey{ Group: gk.Group, Kind: gk.Kind, - Namespace: ref.Namespace}, + Namespace: ref.Namespace, + }, selector, fb) } } diff --git a/vendor/knative.dev/pkg/webhook/psbinding/reconciler.go b/vendor/knative.dev/pkg/webhook/psbinding/reconciler.go index 3d156fdca..b7f1ba0c7 100644 --- a/vendor/knative.dev/pkg/webhook/psbinding/reconciler.go +++ b/vendor/knative.dev/pkg/webhook/psbinding/reconciler.go @@ -102,8 +102,10 @@ type BaseReconciler struct { } // Check that our Reconciler implements controller.Reconciler -var _ controller.Reconciler = (*BaseReconciler)(nil) -var _ pkgreconciler.LeaderAware = (*BaseReconciler)(nil) +var ( + _ controller.Reconciler = (*BaseReconciler)(nil) + _ pkgreconciler.LeaderAware = (*BaseReconciler)(nil) +) // Reconcile implements controller.Reconciler func (r *BaseReconciler) Reconcile(ctx context.Context, key string) error { @@ -111,7 +113,7 @@ func (r *BaseReconciler) Reconcile(ctx context.Context, key string) error { namespace, name, err := cache.SplitMetaNamespaceKey(key) if err != nil { logging.FromContext(ctx).Error("invalid resource key: ", key) - return nil + return nil //nolint:nilerr } // Only the leader should reconcile binding resources. @@ -275,7 +277,6 @@ func (r *BaseReconciler) RemoveFinalizer(ctx context.Context, fb kmeta.Accessor) } func (r *BaseReconciler) labelNamespace(ctx context.Context, subject tracker.Reference) error { - namespaceObject, err := r.NamespaceLister.Get(subject.Namespace) if apierrs.IsNotFound(err) { logging.FromContext(ctx).Info("Error getting namespace (not found): ", err) @@ -390,7 +391,6 @@ func (r *BaseReconciler) ReconcileSubject(ctx context.Context, fb Bindable, muta // For each of the referents, apply the mutation. eg := errgroup.Group{} for _, ps := range referents { - ps := ps eg.Go(func() error { // Do the binding to the pod specable. orig := ps.DeepCopy() diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go index ba50005d7..c7f9bb139 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/controller.go @@ -45,7 +45,6 @@ func NewAdmissionController( disallowUnknownFields bool, callbacks ...map[schema.GroupVersionKind]Callback, ) *controller.Impl { - // This not ideal, we are using a variadic argument to effectively make callbacks optional // This allows this addition to be non-breaking to consumers of /pkg // TODO: once all sub-repos have adopted this, we might move this back to a traditional param. diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/defaulting.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/defaulting.go index 90f9ec8c9..4140ec719 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/defaulting.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/defaulting/defaulting.go @@ -104,10 +104,12 @@ func NewCallback(function func(context.Context, *unstructured.Unstructured) erro return Callback{function: function, supportedVerbs: m} } -var _ controller.Reconciler = (*reconciler)(nil) -var _ pkgreconciler.LeaderAware = (*reconciler)(nil) -var _ webhook.AdmissionController = (*reconciler)(nil) -var _ webhook.StatelessAdmissionController = (*reconciler)(nil) +var ( + _ controller.Reconciler = (*reconciler)(nil) + _ pkgreconciler.LeaderAware = (*reconciler)(nil) + _ webhook.AdmissionController = (*reconciler)(nil) + _ webhook.StatelessAdmissionController = (*reconciler)(nil) +) // Reconcile implements controller.Reconciler func (ac *reconciler) Reconcile(ctx context.Context, key string) error { diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go index eee6105b4..f24b36792 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/controller.go @@ -45,7 +45,6 @@ func NewAdmissionControllerWithConfig( disallowUnknownFields bool, callbacks map[schema.GroupVersionKind]Callback, ) *controller.Impl { - opts := []OptionFunc{ WithPath(path), WithTypes(handlers), @@ -122,7 +121,6 @@ func newController(ctx context.Context, name string, optsFunc ...OptionFunc) *co }) return c - } // NewAdmissionController constructs a reconciler diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/reconcile_config.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/reconcile_config.go index dfc361991..afbc45c05 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/reconcile_config.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/reconcile_config.go @@ -64,10 +64,12 @@ type reconciler struct { secretName string } -var _ controller.Reconciler = (*reconciler)(nil) -var _ pkgreconciler.LeaderAware = (*reconciler)(nil) -var _ webhook.AdmissionController = (*reconciler)(nil) -var _ webhook.StatelessAdmissionController = (*reconciler)(nil) +var ( + _ controller.Reconciler = (*reconciler)(nil) + _ pkgreconciler.LeaderAware = (*reconciler)(nil) + _ webhook.AdmissionController = (*reconciler)(nil) + _ webhook.StatelessAdmissionController = (*reconciler)(nil) +) // Path implements AdmissionController func (ac *reconciler) Path() string { diff --git a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go index e601890af..94093e648 100644 --- a/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go +++ b/vendor/knative.dev/pkg/webhook/resourcesemantics/validation/validation_admit.go @@ -106,8 +106,8 @@ func (ac *reconciler) Admit(ctx context.Context, request *admissionv1.AdmissionR func (ac *reconciler) decodeRequestAndPrepareContext( ctx context.Context, req *admissionv1.AdmissionRequest, - gvk schema.GroupVersionKind) (context.Context, resourcesemantics.GenericCRD, error) { - + gvk schema.GroupVersionKind, +) (context.Context, resourcesemantics.GenericCRD, error) { logger := logging.FromContext(ctx) handler, ok := ac.handlers[gvk] if !ok { @@ -160,7 +160,8 @@ func (ac *reconciler) decodeRequestAndPrepareContext( return ctx, newObj, nil } -func validate(ctx context.Context, resource resourcesemantics.GenericCRD, req *admissionv1.AdmissionRequest) (err error, warn []error) { //nolint +//nolint:stylecheck +func validate(ctx context.Context, resource resourcesemantics.GenericCRD, req *admissionv1.AdmissionRequest) (err error, warn []error) { logger := logging.FromContext(ctx) // Only run validation for supported create and update validation. diff --git a/vendor/knative.dev/pkg/webhook/stats_reporter.go b/vendor/knative.dev/pkg/webhook/stats_reporter.go index 3f05d4a91..bc62820b9 100644 --- a/vendor/knative.dev/pkg/webhook/stats_reporter.go +++ b/vendor/knative.dev/pkg/webhook/stats_reporter.go @@ -66,8 +66,10 @@ var ( resultCodeKey = tag.MustNewKey("result_code") ) -type admissionToValue func(*admissionv1.AdmissionRequest, *admissionv1.AdmissionResponse) string -type conversionToValue func(*apixv1.ConversionRequest, *apixv1.ConversionResponse) string +type ( + admissionToValue func(*admissionv1.AdmissionRequest, *admissionv1.AdmissionResponse) string + conversionToValue func(*apixv1.ConversionRequest, *apixv1.ConversionResponse) string +) var ( allAdmissionTags = map[tag.Key]admissionToValue{ diff --git a/vendor/knative.dev/pkg/webhook/webhook.go b/vendor/knative.dev/pkg/webhook/webhook.go index d8842df35..e05c6f041 100644 --- a/vendor/knative.dev/pkg/webhook/webhook.go +++ b/vendor/knative.dev/pkg/webhook/webhook.go @@ -132,7 +132,6 @@ func New( ctx context.Context, controllers []interface{}, ) (webhook *Webhook, err error) { - // ServeMux.Handle panics on duplicate paths defer func() { if r := recover(); r != nil { @@ -177,6 +176,7 @@ func New( // a new secret informer from it. secretInformer := kubeinformerfactory.Get(ctx).Core().V1().Secrets() + //nolint:gosec // operator configures TLS min version (default is 1.3) webhook.tlsConfig = &tls.Config{ MinVersion: opts.TLSMinVersion, @@ -270,11 +270,11 @@ func (wh *Webhook) Run(stop <-chan struct{}) error { Handler: drainer, Addr: fmt.Sprint(":", wh.Options.Port), TLSConfig: wh.tlsConfig, - 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 TLSNextProto: nextProto, } - var serve = server.ListenAndServe + serve := server.ListenAndServe if server.TLSConfig != nil && wh.testListener != nil { serve = func() error { diff --git a/vendor/modules.txt b/vendor/modules.txt index 296518b01..26e723906 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -970,8 +970,8 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/eventing v0.41.1-0.20240620173702-f84a98c60901 -## explicit; go 1.21 +# knative.dev/eventing v0.41.1-0.20240626113428-922edf285258 +## explicit; go 1.22 knative.dev/eventing/pkg/adapter/v2 knative.dev/eventing/pkg/adapter/v2/test knative.dev/eventing/pkg/adapter/v2/util/crstatusevent @@ -1038,7 +1038,7 @@ knative.dev/hack knative.dev/networking/pkg/apis/networking knative.dev/networking/pkg/apis/networking/v1alpha1 knative.dev/networking/pkg/config -# knative.dev/pkg v0.0.0-20240620215714-915c00977757 +# knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef ## explicit; go 1.22 knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -1103,8 +1103,8 @@ knative.dev/pkg/webhook/psbinding knative.dev/pkg/webhook/resourcesemantics knative.dev/pkg/webhook/resourcesemantics/defaulting knative.dev/pkg/webhook/resourcesemantics/validation -# knative.dev/serving v0.41.1-0.20240620131618-6d90f5493686 -## explicit; go 1.21 +# knative.dev/serving v0.41.1-0.20240626122742-b02cc68c4b6c +## explicit; go 1.22 knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1 knative.dev/serving/pkg/apis/config