From d8143258a02e08bec2afb9a39df2da262db18de0 Mon Sep 17 00:00:00 2001 From: Knative Automation Date: Thu, 28 Mar 2024 01:49:10 +0000 Subject: [PATCH] upgrade to latest dependencies bumping knative.dev/pkg 1ca1f09...b8b7ca1: > b8b7ca1 upgrade to latest dependencies (# 3000) bumping knative.dev/eventing 4754325...e581d36: > e581d36 Update eventtype v1beta3 type to reflect spec changes (# 7708) > 93e0c85 CrossNamespace: added brokerRef in trigger spec (# 7815) Signed-off-by: Knative Automation --- go.mod | 4 +- go.sum | 8 ++-- .../pkg/apis/eventing/v1/trigger_types.go | 5 ++- .../apis/eventing/v1/zz_generated.deepcopy.go | 5 +++ .../apis/eventing/v1beta3/eventtype_types.go | 33 ++++++++--------- .../eventing/v1beta3/eventtype_validation.go | 37 +++++++++++++++---- .../eventing/v1beta3/zz_generated.deepcopy.go | 32 ++++++++++------ vendor/modules.txt | 4 +- 8 files changed, 82 insertions(+), 46 deletions(-) diff --git a/go.mod b/go.mod index 1e261a9b7..2b6647786 100644 --- a/go.mod +++ b/go.mod @@ -22,10 +22,10 @@ require ( k8s.io/apimachinery v0.29.2 k8s.io/client-go v0.29.2 k8s.io/utils v0.0.0-20240102154912-e7106e64919e - knative.dev/eventing v0.40.1-0.20240327131403-47543259ceba + knative.dev/eventing v0.40.1-0.20240327210418-e581d36f9f2a knative.dev/hack v0.0.0-20240327150553-47368d631660 knative.dev/hack/schema v0.0.0-20240327150553-47368d631660 - knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e + knative.dev/pkg v0.0.0-20240327172111-b8b7ca1f7904 knative.dev/reconciler-test v0.0.0-20240327131444-6346b918a853 ) diff --git a/go.sum b/go.sum index b3c10037b..953318d7d 100644 --- a/go.sum +++ b/go.sum @@ -893,14 +893,14 @@ 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.40.1-0.20240327131403-47543259ceba h1:uX9UsYNHJQDpqVSMVijhSljmCSLZm5ocPdQJ4jrkyig= -knative.dev/eventing v0.40.1-0.20240327131403-47543259ceba/go.mod h1:19sfPiy4dK2jBIHgszOTk43qOvfCXz1GTIncRY3trB8= +knative.dev/eventing v0.40.1-0.20240327210418-e581d36f9f2a h1:IcopvDTfpZ57wgJnWKvaLl1ob4E9xi49Azc5yhSwUTk= +knative.dev/eventing v0.40.1-0.20240327210418-e581d36f9f2a/go.mod h1:19sfPiy4dK2jBIHgszOTk43qOvfCXz1GTIncRY3trB8= knative.dev/hack v0.0.0-20240327150553-47368d631660 h1:tW6NgyjMnSXBS75+k+Xh5uNiLhJ9TFswS9hrkC3OQOc= knative.dev/hack v0.0.0-20240327150553-47368d631660/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= knative.dev/hack/schema v0.0.0-20240327150553-47368d631660 h1:aXrY48YoL6p97e10do+hjXRFoa+6N9zJIzAclykEpy0= knative.dev/hack/schema v0.0.0-20240327150553-47368d631660/go.mod h1:3pWwBLnTZSM9psSgCAvhKOHIPTzqfEMlWRpDu6IYhK0= -knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e h1:Cg28hbL35g5Qd3tC0PKSX2FMMD8IZnTYxRr4VLIUgd8= -knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e/go.mod h1:uYSh5G3A/pFmzgowpvKeyphLbXVkY4x7zEhReKwsVeU= +knative.dev/pkg v0.0.0-20240327172111-b8b7ca1f7904 h1:AT4AIwO3p1qZtmEzW5tWPftrUxts8Tlpra7EjNS/2PY= +knative.dev/pkg v0.0.0-20240327172111-b8b7ca1f7904/go.mod h1:LgcT4KPEcw24alWzzkFAN2acHq38au8NZqybU16TStI= knative.dev/reconciler-test v0.0.0-20240327131444-6346b918a853 h1:YNnU474EU6U4iBEVGV9zZmEH/IbZIQwJ4I4OU4PHodQ= knative.dev/reconciler-test v0.0.0-20240327131444-6346b918a853/go.mod h1:e3ZGbaE4B/7hIDyxxkEIYyGdkXB/51gMaEdH8pPpXIM= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_types.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_types.go index b20f651a2..91a1aa75a 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_types.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_types.go @@ -76,8 +76,9 @@ var ( type TriggerSpec struct { // Broker is the broker that this trigger receives events from. Broker string `json:"broker,omitempty"` - // BrokerNamespace is the namespace of the broker that the trigger receives events from. - BrokerNamespace string `json:"brokerNamespace,omitempty"` + + // BrokerRef is the broker that is used for cross-namespace referencing. + BrokerRef *duckv1.KReference `json:"brokerRef,omitempty"` // Filter is the filter to apply against all events from the Broker. Only events that pass this // filter will be sent to the Subscriber. If not specified, will default to allowing all events. diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/zz_generated.deepcopy.go index 5d19c3bfa..41765815e 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/zz_generated.deepcopy.go @@ -299,6 +299,11 @@ func (in *TriggerList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TriggerSpec) DeepCopyInto(out *TriggerSpec) { *out = *in + if in.BrokerRef != nil { + in, out := &in.BrokerRef, &out.BrokerRef + *out = new(duckv1.KReference) + (*in).DeepCopyInto(*out) + } if in.Filter != nil { in, out := &in.Filter, &out.Filter *out = new(TriggerFilter) diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_types.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_types.go index 622f3b9fd..2ecc74586 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_types.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_types.go @@ -62,24 +62,6 @@ var ( ) type EventTypeSpec struct { - // Type represents the CloudEvents type. It is authoritative. - Type string `json:"type"` - // Source is a URI, it represents the CloudEvents source. - // +optional - Source *apis.URL `json:"source,omitempty"` - // Schema is a URI, it represents the CloudEvents schemaurl extension attribute. - // It may be a JSON schema, a protobuf schema, etc. It is optional. - // +optional - Schema *apis.URL `json:"schema,omitempty"` - // SchemaData allows the CloudEvents schema to be stored directly in the - // EventType. Content is dependent on the encoding. Optional attribute. - // The contents are not validated or manipulated by the system. - // +optional - SchemaData string `json:"schemaData,omitempty"` - // Broker refers to the Broker that can provide the EventType. - // Deprecated: This field is deprecated and will be removed in a future release. - // +optional - Broker string `json:"broker,omitempty"` // Reference is a KReference to the belonging addressable. //For example, this could be a pointer to a Broker. // +optional @@ -87,6 +69,21 @@ type EventTypeSpec struct { // Description is an optional field used to describe the EventType, in any meaningful way. // +optional Description string `json:"description,omitempty"` + // Attributes is an array of CloudEvent attributes and extension attributes. + Attributes []EventAttributeDefinition `json:"attributes"` +} + +type EventAttributeDefinition struct { + // Name is the name of the CloudEvents attribute. + Name string `json:"name"` + // Required determines whether this attribute must be set on corresponding CloudEvents. + Required bool `json:"required"` + // Value is a string representing the allowable values for the EventType attribute. + // It may be a single value such as "/apis/v1/namespaces/default/pingsource/ps", or it could be a template + // for the allowed values, such as "/apis/v1/namespaces/{namespace}/pingsource/{sourceName}. + // To specify a section of the string value which may change between different CloudEvents + // you can use curly brackets {} and optionally a variable name between them. + Value string `json:"value,omitempty"` } // EventTypeStatus represents the current state of a EventType. diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_validation.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_validation.go index 9f3d49df6..75590bcae 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_validation.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/eventtype_validation.go @@ -29,13 +29,9 @@ func (et *EventType) Validate(ctx context.Context) *apis.FieldError { func (ets *EventTypeSpec) Validate(ctx context.Context) *apis.FieldError { var errs *apis.FieldError - if ets.Type == "" { - fe := apis.ErrMissingField("type") - errs = errs.Also(fe) - } - // TODO validate Source is a valid URI. - // TODO validate Schema is a valid URI. - // There is no validation of the SchemaData, it is application specific data. + // TODO: validate attribute with name=source is a valid URI + // TODO: validate attribute with name=schema is a valid URI + errs = errs.Also(ets.ValidateAttributes().ViaField("attributes")) return errs } @@ -60,3 +56,30 @@ func (et *EventType) CheckImmutableFields(ctx context.Context, original *EventTy } return nil } + +func (ets *EventTypeSpec) ValidateAttributes() *apis.FieldError { + attributes := make(map[string]EventAttributeDefinition, len(ets.Attributes)) + for _, attr := range ets.Attributes { + attributes[attr.Name] = attr + } + + missingFields := []string{} + if _, ok := attributes["type"]; !ok { + missingFields = append(missingFields, "type") + } + if _, ok := attributes["source"]; !ok { + missingFields = append(missingFields, "source") + } + if _, ok := attributes["specversion"]; !ok { + missingFields = append(missingFields, "specversion") + } + if _, ok := attributes["id"]; !ok { + missingFields = append(missingFields, "id") + } + + if len(missingFields) > 0 { + return apis.ErrMissingField(missingFields...) + } + + return nil +} diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/zz_generated.deepcopy.go index 02c061e41..e25635dc5 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/zz_generated.deepcopy.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta3/zz_generated.deepcopy.go @@ -23,10 +23,25 @@ package v1beta3 import ( runtime "k8s.io/apimachinery/pkg/runtime" - apis "knative.dev/pkg/apis" v1 "knative.dev/pkg/apis/duck/v1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EventAttributeDefinition) DeepCopyInto(out *EventAttributeDefinition) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EventAttributeDefinition. +func (in *EventAttributeDefinition) DeepCopy() *EventAttributeDefinition { + if in == nil { + return nil + } + out := new(EventAttributeDefinition) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EventType) DeepCopyInto(out *EventType) { *out = *in @@ -91,21 +106,16 @@ func (in *EventTypeList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EventTypeSpec) DeepCopyInto(out *EventTypeSpec) { *out = *in - if in.Source != nil { - in, out := &in.Source, &out.Source - *out = new(apis.URL) - (*in).DeepCopyInto(*out) - } - if in.Schema != nil { - in, out := &in.Schema, &out.Schema - *out = new(apis.URL) - (*in).DeepCopyInto(*out) - } if in.Reference != nil { in, out := &in.Reference, &out.Reference *out = new(v1.KReference) (*in).DeepCopyInto(*out) } + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *out = make([]EventAttributeDefinition, len(*in)) + copy(*out, *in) + } return } diff --git a/vendor/modules.txt b/vendor/modules.txt index c576029e7..935c475c9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1082,7 +1082,7 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/eventing v0.40.1-0.20240327131403-47543259ceba +# knative.dev/eventing v0.40.1-0.20240327210418-e581d36f9f2a ## explicit; go 1.21 knative.dev/eventing/pkg/apis knative.dev/eventing/pkg/apis/config @@ -1156,7 +1156,7 @@ knative.dev/hack/schema/commands knative.dev/hack/schema/docs knative.dev/hack/schema/registry knative.dev/hack/schema/schema -# knative.dev/pkg v0.0.0-20240327140624-1ca1f09c329e +# knative.dev/pkg v0.0.0-20240327172111-b8b7ca1f7904 ## explicit; go 1.21 knative.dev/pkg/apis knative.dev/pkg/apis/duck