Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
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 <automation@knative.team>
  • Loading branch information
knative-automation committed Mar 28, 2024
1 parent 9e3cdc4 commit d814325
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 46 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,28 @@ 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
Reference *duckv1.KReference `json:"reference,omitempty"`
// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d814325

Please sign in to comment.