diff --git a/go.mod b/go.mod index f3eb8988e..64e8f45f8 100644 --- a/go.mod +++ b/go.mod @@ -18,10 +18,10 @@ require ( k8s.io/cli-runtime v0.21.4 k8s.io/client-go v0.21.4 k8s.io/code-generator v0.21.4 - knative.dev/eventing v0.27.1-0.20211109172546-31e4e2eb26d1 - knative.dev/hack v0.0.0-20211108170701-96aac1c30be3 - knative.dev/networking v0.0.0-20211109174044-1507a59cf35c - knative.dev/pkg v0.0.0-20211109100843-91d1932616a7 - knative.dev/serving v0.27.1-0.20211109195444-c02ef3147516 + knative.dev/eventing v0.27.1-0.20211116113552-12418535e186 + knative.dev/hack v0.0.0-20211112192837-128cf0150a69 + knative.dev/networking v0.0.0-20211116075352-3f45c8b29bc1 + knative.dev/pkg v0.0.0-20211115071955-517ef0292b53 + knative.dev/serving v0.27.1-0.20211116120552-dae92fcaf11a sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index 42382b7f5..15f5cc242 100644 --- a/go.sum +++ b/go.sum @@ -1710,24 +1710,26 @@ k8s.io/legacy-cloud-providers v0.21.0/go.mod h1:bNxo7gDg+PGkBmT/MFZswLTWdSWK9kAl k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ= k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -knative.dev/caching v0.0.0-20211109020143-eceaa05e3ecc/go.mod h1:B1UvFZohVEmH+Fruuimvj5uJZcGde8F5ZhtYapFnyVg= -knative.dev/eventing v0.27.1-0.20211109172546-31e4e2eb26d1 h1:vC/EpcYF1lsvaapxNGmz6vGNZfq94/1Fd770SQTZ9Es= -knative.dev/eventing v0.27.1-0.20211109172546-31e4e2eb26d1/go.mod h1:zHDfFKGqgq9bZvUd3QC6iHRAaj2AbHercYhlxdtc9fA= +knative.dev/caching v0.0.0-20211111075937-0c3d96f98a71/go.mod h1:B1UvFZohVEmH+Fruuimvj5uJZcGde8F5ZhtYapFnyVg= +knative.dev/eventing v0.27.1-0.20211116113552-12418535e186 h1:Bcz4Wul/NOx+o1XdAhZecupkaUcHg781FBCrlfTjDbU= +knative.dev/eventing v0.27.1-0.20211116113552-12418535e186/go.mod h1:eJGGW9Rbrq585P2Ppc0a+nDLfJzGXe/R8eMXcNwUKlI= knative.dev/hack v0.0.0-20211101195839-11d193bf617b/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack v0.0.0-20211105231158-29f86c2653b5/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= -knative.dev/hack v0.0.0-20211108170701-96aac1c30be3 h1:oSvRgnKoU308k7aXbPV3iL5Zh5kBGM2Ptar4hyeda+A= knative.dev/hack v0.0.0-20211108170701-96aac1c30be3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= -knative.dev/hack/schema v0.0.0-20211108170701-96aac1c30be3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= -knative.dev/networking v0.0.0-20211109063843-5ee89331e361/go.mod h1:k+A0D662HneO3gjsvzjSbPkJt+ihUSHm4Cxw49Y5j/w= -knative.dev/networking v0.0.0-20211109174044-1507a59cf35c h1:awrpNjtd0HmquFzQkZwe+9ppVy7mka27vvKSJo6YmN0= -knative.dev/networking v0.0.0-20211109174044-1507a59cf35c/go.mod h1:k+A0D662HneO3gjsvzjSbPkJt+ihUSHm4Cxw49Y5j/w= +knative.dev/hack v0.0.0-20211112192837-128cf0150a69 h1:/3NW6B9VeqAwpW0ZAS+8xLfwgVMIqH+CPmesDATovhk= +knative.dev/hack v0.0.0-20211112192837-128cf0150a69/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= +knative.dev/hack/schema v0.0.0-20211112192837-128cf0150a69/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= +knative.dev/networking v0.0.0-20211111131538-526348e63718/go.mod h1:XskFTw7FTMeGwD60lrTT+P3BNp59fJxLS0019WNHq9o= +knative.dev/networking v0.0.0-20211116075352-3f45c8b29bc1 h1:CSjr5XM8oMlftjSENHSB+sxdr1k36CWlJwq6ou8TQM8= +knative.dev/networking v0.0.0-20211116075352-3f45c8b29bc1/go.mod h1:+MZjHIMRatw4Nf2U9xDJBStXUDcdjAcbrZL7iGU6tjY= knative.dev/pkg v0.0.0-20211101212339-96c0204a70dc/go.mod h1:SkfDk9bWIiNZD7XtILGkG7AKVyF/M6M0bGxLgl0SYL8= knative.dev/pkg v0.0.0-20211108064904-3cc697a3cb09/go.mod h1:YiSfFDMdYHZTuO5XS8UzxSeOEmocy+Kb2YOGik9C8lw= -knative.dev/pkg v0.0.0-20211109100843-91d1932616a7 h1:uqo0nLez3NJf03gE9mdYpFxbqZ8iWdVElQa+s8W7VNQ= -knative.dev/pkg v0.0.0-20211109100843-91d1932616a7/go.mod h1:plYIuKk6WNC9LyiG/9xBnOBYuxO0Ro6xN0z7iXWVUtk= -knative.dev/reconciler-test v0.0.0-20211101213739-c5f938aa9974/go.mod h1:gTsbLk496j/M9xqMpx/liyCQ0X3bwDpRtcs2Zzws364= -knative.dev/serving v0.27.1-0.20211109195444-c02ef3147516 h1:cny97YW42CGXYxfNvO1KS6G6iuC4QmkwFmGNAZFf9fg= -knative.dev/serving v0.27.1-0.20211109195444-c02ef3147516/go.mod h1:NvsLBPP8/Hz01rplIWfETwXjtJYRrJjYlJezBhTYIdc= +knative.dev/pkg v0.0.0-20211111114938-0b0c3390a475/go.mod h1:plYIuKk6WNC9LyiG/9xBnOBYuxO0Ro6xN0z7iXWVUtk= +knative.dev/pkg v0.0.0-20211115071955-517ef0292b53 h1:rzKI45d30Gi6Wyg2FgPOSqVB1wYwHOjG4cB6sAFkyVk= +knative.dev/pkg v0.0.0-20211115071955-517ef0292b53/go.mod h1:VqUp1KWJqpTDNoiSI/heaX3uMdubImslJE2tBkP+Bbw= +knative.dev/reconciler-test v0.0.0-20211112132636-ae9e2e21972f/go.mod h1:gTsbLk496j/M9xqMpx/liyCQ0X3bwDpRtcs2Zzws364= +knative.dev/serving v0.27.1-0.20211116120552-dae92fcaf11a h1:4HvaidDS83x+iu7bag7+JAAJ/rS6J4+5Nj5mWLYqVA8= +knative.dev/serving v0.27.1-0.20211116120552-dae92fcaf11a/go.mod h1:sldNhpKRW7/XlYR6hMwdUQfWCWOYNxHmgi5u1lBG3jM= pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= 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= 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 aa842be3f..25dd0f0ac 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 @@ -83,8 +83,22 @@ type TriggerSpec struct { // +optional Filter *TriggerFilter `json:"filter,omitempty"` - // Subscriber is the addressable that receives events from the Broker that pass the Filter. It - // is required. + // Filters is an experimental field that conforms to the CNCF CloudEvents Subscriptions + // API. It's an array of filter expressions that evaluate to true or false. + // If any filter expression in the array evaluates to false, the event MUST + // NOT be sent to the Subscriber. If all the filter expressions in the array + // evaluate to true, the event MUST be attempted to be delivered. Absence of + // a filter or empty array implies a value of true. In the event of users + // specifying both Filter and Filters, then the latter will override the former. + // This will allow users to try out the effect of the new Filters field + // without compromising the existing attribute-based Filter and try it out on existing + // Trigger objects. + // + // +optional + Filters []SubscriptionsAPIFilter `json:"filters,omitempty"` + + // Subscriber is the addressable that receives events from the Broker that pass + // the Filter. It is required. Subscriber duckv1.Destination `json:"subscriber"` // Delivery contains the delivery spec for this specific trigger. @@ -96,17 +110,77 @@ type TriggerFilter struct { // Attributes filters events by exact match on event context attributes. // Each key in the map is compared with the equivalent key in the event // context. An event passes the filter if all values are equal to the - // specified values. - // - // Nested context attributes are not supported as keys. Only string values are supported. + // specified values. Nested context attributes are not supported as keys. Only + // string values are supported. // // +optional Attributes TriggerFilterAttributes `json:"attributes,omitempty"` } +// SubscriptionsAPIFilter allows defining a filter expression using CloudEvents +// Subscriptions API. If multiple filters are specified, then the same semantics +// of SubscriptionsAPIFilter.All is applied. If no filter dialect or empty +// object is specified, then the filter always accept the events. +type SubscriptionsAPIFilter struct { + // All evaluates to true if all the nested expressions evaluate to true. + // It must contain at least one filter expression. + // + // +optional + All []SubscriptionsAPIFilter `json:"all,omitempty"` + + // Any evaluates to true if at least one of the nested expressions evaluates + // to true. It must contain at least one filter expression. + // + // +optional + Any []SubscriptionsAPIFilter `json:"any,omitempty"` + + // Not evaluates to true if the nested expression evaluates to false. + // + // +optional + Not *SubscriptionsAPIFilter `json:"not,omitempty"` + + // Exact evaluates to true if the value of the matching CloudEvents + // attribute matches exactly the String value specified (case-sensitive). + // Exact must contain exactly one property, where the key is the name of the + // CloudEvents attribute to be matched, and its value is the String value to + // use in the comparison. The attribute name and value specified in the filter + // expression cannot be empty strings. + // + // +optional + Exact map[string]string `json:"exact,omitempty"` + + // Prefix evaluates to true if the value of the matching CloudEvents + // attribute starts with the String value specified (case-sensitive). Prefix + // must contain exactly one property, where the key is the name of the + // CloudEvents attribute to be matched, and its value is the String value to + // use in the comparison. The attribute name and value specified in the filter + // expression cannot be empty strings. + // + // +optional + Prefix map[string]string `json:"prefix,omitempty"` + + // Suffix evaluates to true if the value of the matching CloudEvents + // attribute ends with the String value specified (case-sensitive). Suffix + // must contain exactly one property, where the key is the name of the + // CloudEvents attribute to be matched, and its value is the String value to + // use in the comparison. The attribute name and value specified in the filter + // expression cannot be empty strings. + // + // +optional + Suffix map[string]string `json:"suffix,omitempty"` + + // Extensions includes the list of additional filter dialects supported by + // specific broker implementations. Check out the documentation of the + // broker implementation you're using to know about what additional filters + // are supported. + // + // +optional + Extensions map[string]*runtime.RawExtension `json:",inline"` +} + // TriggerFilterAttributes is a map of context attribute names to values for -// filtering by equality. Only exact matches will pass the filter. You can use the value '' -// to indicate all strings match. +// filtering by equality. Only exact matches will pass the filter. You can use +// the value '' to indicate all strings match. type TriggerFilterAttributes map[string]string // TriggerStatus represents the current state of a Trigger. diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_validation.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_validation.go index 4b367340a..772a33f17 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_validation.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/trigger_validation.go @@ -22,10 +22,11 @@ import ( "fmt" "regexp" + corev1 "k8s.io/api/core/v1" "knative.dev/pkg/apis" "knative.dev/pkg/kmp" - corev1 "k8s.io/api/core/v1" + "knative.dev/eventing/pkg/apis/feature" ) var ( @@ -35,7 +36,7 @@ var ( // Validate the Trigger. func (t *Trigger) Validate(ctx context.Context) *apis.FieldError { - errs := t.Spec.Validate(ctx).ViaField("spec") + errs := t.Spec.Validate(apis.WithinSpec(ctx)).ViaField("spec") errs = t.validateAnnotation(errs, DependencyAnnotation, t.validateDependencyAnnotation) errs = t.validateAnnotation(errs, InjectionAnnotation, t.validateInjectionAnnotation) if apis.IsInUpdate(ctx) { @@ -46,36 +47,20 @@ func (t *Trigger) Validate(ctx context.Context) *apis.FieldError { } // Validate the TriggerSpec. -func (ts *TriggerSpec) Validate(ctx context.Context) *apis.FieldError { - var errs *apis.FieldError +func (ts *TriggerSpec) Validate(ctx context.Context) (errs *apis.FieldError) { if ts.Broker == "" { - fe := apis.ErrMissingField("broker") - errs = errs.Also(fe) + errs = errs.Also(apis.ErrMissingField("broker")) } - if ts.Filter != nil { - for attr := range map[string]string(ts.Filter.Attributes) { - if !validAttributeName.MatchString(attr) { - fe := &apis.FieldError{ - Message: fmt.Sprintf("Invalid attribute name: %q", attr), - Paths: []string{"filter.attributes"}, - } - errs = errs.Also(fe) - } - } - } - - if fe := ts.Subscriber.Validate(ctx); fe != nil { - errs = errs.Also(fe.ViaField("subscriber")) - } - - if ts.Delivery != nil { - if de := ts.Delivery.Validate(ctx); de != nil { - errs = errs.Also(de.ViaField("delivery")) - } - } - - return errs + return errs.Also( + ValidateAttributeFilters(ts.Filter).ViaField("filter"), + ).Also( + ValidateSubscriptionAPIFiltersList(ctx, ts.Filters).ViaField("filters"), + ).Also( + ts.Subscriber.Validate(ctx).ViaField("subscriber"), + ).Also( + ts.Delivery.Validate(ctx).ViaField("delivery"), + ) } // CheckImmutableFields checks that any immutable fields were not changed. @@ -163,3 +148,122 @@ func (t *Trigger) validateInjectionAnnotation(injectionAnnotation string) *apis. } return nil } + +func ValidateAttributeFilters(filter *TriggerFilter) (errs *apis.FieldError) { + if filter == nil { + return nil + } + return errs.Also(ValidateAttributesNames(filter.Attributes).ViaField("attributes")) +} + +func ValidateAttributesNames(attrs map[string]string) (errs *apis.FieldError) { + for attr := range attrs { + if !validAttributeName.MatchString(attr) { + errs = errs.Also(apis.ErrInvalidKeyName(attr, apis.CurrentField, "Attribute name must start with a letter and can only contain lowercase alphanumeric").ViaKey(attr)) + } + } + return errs +} + +func ValidateSingleAttributeMap(expr map[string]string) (errs *apis.FieldError) { + if len(expr) == 0 { + return nil + } + + if len(expr) != 1 { + return apis.ErrGeneric("Multiple items found, can have only one key-value", apis.CurrentField) + } + for attr := range expr { + if !validAttributeName.MatchString(attr) { + errs = errs.Also(apis.ErrInvalidKeyName(attr, apis.CurrentField, "Attribute name must start with a letter and can only contain lowercase alphanumeric").ViaKey(attr)) + } + } + return errs +} + +func ValidateSubscriptionAPIFiltersList(ctx context.Context, filters []SubscriptionsAPIFilter) (errs *apis.FieldError) { + if filters == nil || !feature.FromContext(ctx).IsEnabled(feature.NewTriggerFilters) { + return nil + } + + for i, f := range filters { + f := f + errs = errs.Also(ValidateSubscriptionAPIFilter(ctx, &f)).ViaIndex(i) + } + return errs +} + +func ValidateSubscriptionAPIFilter(ctx context.Context, filter *SubscriptionsAPIFilter) (errs *apis.FieldError) { + if filter == nil { + return nil + } + errs = errs.Also( + ValidateOneOf(filter), + ).Also( + ValidateSingleAttributeMap(filter.Exact).ViaField("exact"), + ).Also( + ValidateSingleAttributeMap(filter.Prefix).ViaField("prefix"), + ).Also( + ValidateSingleAttributeMap(filter.Suffix).ViaField("suffix"), + ).Also( + ValidateSubscriptionAPIFiltersList(ctx, filter.All).ViaField("all"), + ).Also( + ValidateSubscriptionAPIFiltersList(ctx, filter.Any).ViaField("any"), + ).Also( + ValidateSubscriptionAPIFilter(ctx, filter.Not).ViaField("not"), + ) + return errs +} + +func ValidateOneOf(filter *SubscriptionsAPIFilter) (err *apis.FieldError) { + if filter != nil && hasMultipleDialects(filter) { + return apis.ErrGeneric("multiple dialects found, filters can have only one dialect set") + } + return nil +} + +func hasMultipleDialects(filter *SubscriptionsAPIFilter) bool { + dialectFound := false + if len(filter.Exact) > 0 { + dialectFound = true + } + if len(filter.Prefix) > 0 { + if dialectFound { + return true + } else { + dialectFound = true + } + } + if len(filter.Suffix) > 0 { + if dialectFound { + return true + } else { + dialectFound = true + } + } + if len(filter.All) > 0 { + if dialectFound { + return true + } else { + dialectFound = true + } + } + if len(filter.Any) > 0 { + if dialectFound { + return true + } else { + dialectFound = true + } + } + if filter.Not != nil { + if dialectFound { + return true + } else { + dialectFound = true + } + } + if len(filter.Extensions) > 0 && dialectFound { + return true + } + return false +} 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 80d853263..df8525537 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 @@ -134,6 +134,77 @@ func (in *BrokerStatus) DeepCopy() *BrokerStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionsAPIFilter) DeepCopyInto(out *SubscriptionsAPIFilter) { + *out = *in + if in.All != nil { + in, out := &in.All, &out.All + *out = make([]SubscriptionsAPIFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Any != nil { + in, out := &in.Any, &out.Any + *out = make([]SubscriptionsAPIFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Not != nil { + in, out := &in.Not, &out.Not + *out = new(SubscriptionsAPIFilter) + (*in).DeepCopyInto(*out) + } + if in.Exact != nil { + in, out := &in.Exact, &out.Exact + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Prefix != nil { + in, out := &in.Prefix, &out.Prefix + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Suffix != nil { + in, out := &in.Suffix, &out.Suffix + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Extensions != nil { + in, out := &in.Extensions, &out.Extensions + *out = make(map[string]*runtime.RawExtension, len(*in)) + for key, val := range *in { + var outVal *runtime.RawExtension + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionsAPIFilter. +func (in *SubscriptionsAPIFilter) DeepCopy() *SubscriptionsAPIFilter { + if in == nil { + return nil + } + out := new(SubscriptionsAPIFilter) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Trigger) DeepCopyInto(out *Trigger) { *out = *in @@ -248,6 +319,13 @@ func (in *TriggerSpec) DeepCopyInto(out *TriggerSpec) { *out = new(TriggerFilter) (*in).DeepCopyInto(*out) } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]SubscriptionsAPIFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } in.Subscriber.DeepCopyInto(&out.Subscriber) if in.Delivery != nil { in, out := &in.Delivery, &out.Delivery diff --git a/vendor/knative.dev/eventing/pkg/apis/feature/flag_names.go b/vendor/knative.dev/eventing/pkg/apis/feature/flag_names.go index 1559d64f9..a404c8fdc 100644 --- a/vendor/knative.dev/eventing/pkg/apis/feature/flag_names.go +++ b/vendor/knative.dev/eventing/pkg/apis/feature/flag_names.go @@ -21,4 +21,5 @@ const ( DeliveryTimeout = "delivery-timeout" KReferenceMapping = "kreference-mapping" StrictSubscriber = "strict-subscriber" + NewTriggerFilters = "new-trigger-filters" ) diff --git a/vendor/knative.dev/hack/release.sh b/vendor/knative.dev/hack/release.sh index 25284371c..6f21ce60c 100644 --- a/vendor/knative.dev/hack/release.sh +++ b/vendor/knative.dev/hack/release.sh @@ -82,10 +82,10 @@ function publish_to_gcs() { # These are global environment variables. SKIP_TESTS=0 PRESUBMIT_TEST_FAIL_FAST=1 -TAG_RELEASE=0 +export TAG_RELEASE=0 PUBLISH_RELEASE=0 PUBLISH_TO_GITHUB=0 -TAG="" +export TAG="" BUILD_COMMIT_HASH="" BUILD_YYYYMMDD="" BUILD_TIMESTAMP="" diff --git a/vendor/knative.dev/pkg/test/request.go b/vendor/knative.dev/pkg/test/request.go index fd495c121..a22542e29 100644 --- a/vendor/knative.dev/pkg/test/request.go +++ b/vendor/knative.dev/pkg/test/request.go @@ -105,7 +105,7 @@ func WaitForEndpointStateWithTimeout( timeout time.Duration, opts ...interface{}) (*spoof.Response, error) { - client, rOpts, err := makeSpoofClient(ctx, kubeClient, logf, url, resolvable, timeout /* true, */, opts...) + client, rOpts, err := makeSpoofClient(ctx, kubeClient, logf, url, resolvable, timeout, opts...) if err != nil { return nil, err } @@ -152,7 +152,7 @@ func CheckEndpointState( resolvable bool, opts ...interface{}, ) (*spoof.Response, error) { - client, rOpts, err := makeSpoofClient(ctx, kubeClient, logf, url, resolvable, Flags.SpoofRequestTimeout /* false, */, opts...) + client, rOpts, err := makeSpoofClient(ctx, kubeClient, logf, url, resolvable, Flags.SpoofRequestTimeout, opts...) if err != nil { return nil, err } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go index 44d199c81..608afa78a 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go @@ -317,17 +317,12 @@ func ValidatePodSpec(ctx context.Context, ps corev1.PodSpec) *apis.FieldError { errs = errs.Also(ValidatePodSecurityContext(ctx, ps.SecurityContext).ViaField("securityContext")) volumes, err := ValidateVolumes(ctx, ps.Volumes, AllMountedVolumes(append(ps.InitContainers, ps.Containers...))) + errs = errs.Also(err.ViaField("volumes")) errs = errs.Also(validateInitContainers(ctx, ps.InitContainers, volumes)) - if err != nil { - errs = errs.Also(err.ViaField("volumes")) - } - port, err := validateContainersPorts(ps.Containers) - if err != nil { - errs = errs.Also(err.ViaField("containers[*]")) - } + errs = errs.Also(err.ViaField("containers[*]")) switch len(ps.Containers) { case 0: diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go index ce1a48586..959d5e97a 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go @@ -137,6 +137,15 @@ type RevisionStatus struct { // +optional ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty"` + // InitContainerStatuses is a slice of images present in .Spec.InitContainer[*].Image + // to their respective digests and their container name. + // The digests are resolved during the creation of Revision. + // ContainerStatuses holds the container name and image digests + // for both serving and non serving containers. + // ref: http://bit.ly/image-digests + // +optional + InitContainerStatuses []ContainerStatus `json:"initContainerStatuses,omitempty"` + // ActualReplicas reflects the amount of ready pods running this revision. // +optional ActualReplicas *int32 `json:"actualReplicas,omitempty"` diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go index 2e92855c3..d249e4ff4 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go @@ -252,6 +252,11 @@ func (in *RevisionStatus) DeepCopyInto(out *RevisionStatus) { *out = make([]ContainerStatus, len(*in)) copy(*out, *in) } + if in.InitContainerStatuses != nil { + in, out := &in.InitContainerStatuses, &out.InitContainerStatuses + *out = make([]ContainerStatus, len(*in)) + copy(*out, *in) + } if in.ActualReplicas != nil { in, out := &in.ActualReplicas, &out.ActualReplicas *out = new(int32) diff --git a/vendor/knative.dev/serving/pkg/testing/v1/revision.go b/vendor/knative.dev/serving/pkg/testing/v1/revision.go index 77cce9b51..3445dc0ab 100644 --- a/vendor/knative.dev/serving/pkg/testing/v1/revision.go +++ b/vendor/knative.dev/serving/pkg/testing/v1/revision.go @@ -220,6 +220,18 @@ func WithRevisionObservedGeneration(gen int64) RevisionOption { } } +func WithRevisionInitContainers() RevisionOption { + return func(r *v1.Revision) { + r.Spec.InitContainers = []corev1.Container{{ + Name: "init1", + Image: "initimage", + }, { + Name: "init2", + Image: "initimage", + }} + } +} + // Revision creates a revision object with given ns/name and options. func Revision(namespace, name string, ro ...RevisionOption) *v1.Revision { r := &v1.Revision{ diff --git a/vendor/modules.txt b/vendor/modules.txt index 7d1ca7459..db9338af9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -731,7 +731,7 @@ k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/pointer k8s.io/utils/trace -# knative.dev/eventing v0.27.1-0.20211109172546-31e4e2eb26d1 +# knative.dev/eventing v0.27.1-0.20211116113552-12418535e186 ## explicit knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/duck @@ -757,10 +757,10 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake -# knative.dev/hack v0.0.0-20211108170701-96aac1c30be3 +# knative.dev/hack v0.0.0-20211112192837-128cf0150a69 ## explicit knative.dev/hack -# knative.dev/networking v0.0.0-20211109174044-1507a59cf35c +# knative.dev/networking v0.0.0-20211116075352-3f45c8b29bc1 ## explicit knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking @@ -768,7 +768,7 @@ knative.dev/networking/pkg/apis/networking/v1alpha1 knative.dev/networking/pkg/client/clientset/versioned knative.dev/networking/pkg/client/clientset/versioned/scheme knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20211109100843-91d1932616a7 +# knative.dev/pkg v0.0.0-20211115071955-517ef0292b53 ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -817,7 +817,7 @@ knative.dev/pkg/tracing/config knative.dev/pkg/tracing/propagation knative.dev/pkg/tracing/propagation/tracecontextb3 knative.dev/pkg/tracker -# knative.dev/serving v0.27.1-0.20211109195444-c02ef3147516 +# knative.dev/serving v0.27.1-0.20211116120552-dae92fcaf11a ## explicit knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1