diff --git a/go.mod b/go.mod index 423cabe4f..85a9fcd4a 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.25.1-0.20210906161343-38f38456f045 + knative.dev/eventing v0.25.1-0.20210909163359-316e14d7fbc2 knative.dev/hack v0.0.0-20210806075220-815cd312d65c - knative.dev/networking v0.0.0-20210906131644-9d1fe47ad4b4 - knative.dev/pkg v0.0.0-20210907112319-73d4fe679a2e - knative.dev/serving v0.25.1-0.20210907113619-1c022d766c5b + knative.dev/networking v0.0.0-20210910120730-eb37d69eb87f + knative.dev/pkg v0.0.0-20210909165259-d4505c660535 + knative.dev/serving v0.25.1-0.20210913112533-33aeffc6c9e2 sigs.k8s.io/yaml v1.2.0 ) diff --git a/go.sum b/go.sum index 6768dcb26..2e708aece 100644 --- a/go.sum +++ b/go.sum @@ -1722,25 +1722,22 @@ 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-20210903022457-553240b1b365/go.mod h1:J2o0f0nayAT6ZaXy9yo4GyEcoPyJndMrh+4X5kQTQ5w= -knative.dev/eventing v0.25.1-0.20210906161343-38f38456f045 h1:54qhX/rJC3rv8mmPbKOO6BwM4gykRwWjDuyBCEeL6Gs= -knative.dev/eventing v0.25.1-0.20210906161343-38f38456f045/go.mod h1:aEq47MCAi5nMgILNF8mTK7FG3ONmKXMWVtBzYt3Vp64= +knative.dev/caching v0.0.0-20210910063632-a51cf6760e00/go.mod h1:PMt1PGfOsjGpIj0m6QWIfutn+5mY4WPGf3q4MP6oFf0= +knative.dev/eventing v0.25.1-0.20210909163359-316e14d7fbc2 h1:WKCQDScAr1eP6w1vrl6mwvrIN3wiMLpOg4w17fAFYWw= +knative.dev/eventing v0.25.1-0.20210909163359-316e14d7fbc2/go.mod h1:TIwKUgnYc56nHR/pUcEOXGey8iWiGgcWZymp7CO7VpA= knative.dev/hack v0.0.0-20210622141627-e28525d8d260/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack v0.0.0-20210806075220-815cd312d65c h1:nOXoDWAAItwr4o0dp3nHr6skgpVD4IvME/UX84YNl5k= knative.dev/hack v0.0.0-20210806075220-815cd312d65c/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack/schema v0.0.0-20210806075220-815cd312d65c/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= -knative.dev/networking v0.0.0-20210903170058-7c11d237f014/go.mod h1:DldEflDGWAychEH7SzPj1MeJRZaugxOIbdXaIYHvEz0= -knative.dev/networking v0.0.0-20210906131644-9d1fe47ad4b4 h1:t/UVxgp6LY5oOd5n0BXySA3sSFR/SlMXuJV6yplmxEo= -knative.dev/networking v0.0.0-20210906131644-9d1fe47ad4b4/go.mod h1:HeGWxfHnx24M8NFWanmnja4ff68Blg5vhgSLFSxRn7E= +knative.dev/networking v0.0.0-20210910120730-eb37d69eb87f h1:FHPmpIrUnJjoI2xBIpxTAvCoh9Y1nNHAOWRSJRJECww= +knative.dev/networking v0.0.0-20210910120730-eb37d69eb87f/go.mod h1:Bq/n7aJlzPiieLpB/ndIgZXUJeGf50LXN7AQ/UaL6KA= knative.dev/pkg v0.0.0-20210803160015-21eb4c167cc5/go.mod h1:RPk5txNA3apR9X40D4MpUOP9/VqOG8CrtABWfOwGVS4= -knative.dev/pkg v0.0.0-20210902202457-7a61343b36ca/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= -knative.dev/pkg v0.0.0-20210903055557-dec98b426132/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= -knative.dev/pkg v0.0.0-20210906105443-bb433c98147d/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= -knative.dev/pkg v0.0.0-20210907112319-73d4fe679a2e h1:EpwOC7a0EreNYej/GpuUjbeC9xf1an+66TNRzzPgH6s= -knative.dev/pkg v0.0.0-20210907112319-73d4fe679a2e/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= +knative.dev/pkg v0.0.0-20210909102158-d569db39a812/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= +knative.dev/pkg v0.0.0-20210909165259-d4505c660535 h1:1bbKs8NGGodV0LjOyn6s5lo+oAJ/9KtTURUZtpRxr60= +knative.dev/pkg v0.0.0-20210909165259-d4505c660535/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= knative.dev/reconciler-test v0.0.0-20210820180205-a25de6a08087/go.mod h1:+Kovy+G5zXZNcuO/uB+zfo37vFKZzsLIlWezt/nKMz0= -knative.dev/serving v0.25.1-0.20210907113619-1c022d766c5b h1:MTmRCHCA8egJ2V792zETJgzwhXT+X59214cYxC/HeqU= -knative.dev/serving v0.25.1-0.20210907113619-1c022d766c5b/go.mod h1:cz8Yo/w6b8g5W/5JIjPRZiJQx+d6MXASm+yjGhKFmZo= +knative.dev/serving v0.25.1-0.20210913112533-33aeffc6c9e2 h1:KeBA8Ls2lprv51I2wOg171icGBN8TBt9j3CBSofMsjw= +knative.dev/serving v0.25.1-0.20210913112533-33aeffc6c9e2/go.mod h1:GqSjSPq0d0E3P8RgwWE2yWaDCwAMUdz81xSXwVBbds0= 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/pkg/apis/duck/ABOUT.md b/vendor/knative.dev/pkg/apis/duck/ABOUT.md index b223412a0..989769220 100644 --- a/vendor/knative.dev/pkg/apis/duck/ABOUT.md +++ b/vendor/knative.dev/pkg/apis/duck/ABOUT.md @@ -302,7 +302,11 @@ is used with duck types:                 ...         } logger := c.Logger.Named("Revisions") -        impl := controller.NewImpl(c, logger, "Revisions") +        impl := controller.NewContext( + ctx, + c, + controller.ControllerOptions{WorkQueueName: "Revisions", Logger: logger}, + ) // Calls to Track create a 30 minute lease before they must be renewed. // Coordinate this value with controller resync periods. diff --git a/vendor/knative.dev/pkg/apis/duck/v1/podspec_defaults.go b/vendor/knative.dev/pkg/apis/duck/v1/podspec_defaults.go new file mode 100644 index 000000000..1c6acb1e7 --- /dev/null +++ b/vendor/knative.dev/pkg/apis/duck/v1/podspec_defaults.go @@ -0,0 +1,73 @@ +/* +Copyright 2021 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. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" +) + +// PodSpecDefaulter is a callback to validate a PodSpecable. +type PodSpecDefaulter func(context.Context, *WithPod) + +// SetDefaults implements apis.Defaultable +func (wp *WithPod) SetDefaults(ctx context.Context) { + if psd := GetPodSpecDefaulter(ctx); psd != nil { + psd(ctx, wp) + } +} + +// psdKey is used for associating a PodSpecDefaulter with a context.Context +type psdKey struct{} + +func WithPodSpecDefaulter(ctx context.Context, psd PodSpecDefaulter) context.Context { + return context.WithValue(ctx, psdKey{}, psd) +} + +// GetPodSpecDefaulter extracts the PodSpecDefaulter from the context. +func GetPodSpecDefaulter(ctx context.Context) PodSpecDefaulter { + untyped := ctx.Value(psdKey{}) + if untyped == nil { + return nil + } + return untyped.(PodSpecDefaulter) +} + +// PodDefaulter is a callback to validate a Pod. +type PodDefaulter func(context.Context, *Pod) + +// SetDefaults implements apis.Defaultable +func (p *Pod) SetDefaults(ctx context.Context) { + if pd := GetPodDefaulter(ctx); pd != nil { + pd(ctx, p) + } +} + +// pdKey is used for associating a PodDefaulter with a context.Context +type pdKey struct{} + +func WithPodDefaulter(ctx context.Context, pd PodDefaulter) context.Context { + return context.WithValue(ctx, pdKey{}, pd) +} + +// GetPodDefaulter extracts the PodDefaulter from the context. +func GetPodDefaulter(ctx context.Context) PodDefaulter { + untyped := ctx.Value(pdKey{}) + if untyped == nil { + return nil + } + return untyped.(PodDefaulter) +} diff --git a/vendor/knative.dev/pkg/apis/duck/v1/podspec_types.go b/vendor/knative.dev/pkg/apis/duck/v1/podspec_types.go index a8d172416..7b1946e50 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/podspec_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/podspec_types.go @@ -52,18 +52,20 @@ type WithPodSpec struct { // Verify WithPod resources meet duck contracts. var ( + _ apis.Validatable = (*WithPod)(nil) + _ apis.Defaultable = (*WithPod)(nil) _ apis.Listable = (*WithPod)(nil) _ ducktypes.Populatable = (*WithPod)(nil) ) // GetFullType implements duck.Implementable -func (*PodSpecable) GetFullType() ducktypes.Populatable { +func (wp *PodSpecable) GetFullType() ducktypes.Populatable { return &WithPod{} } // Populate implements duck.Populatable -func (t *WithPod) Populate() { - t.Spec.Template = PodSpecable{ +func (wp *WithPod) Populate() { + wp.Spec.Template = PodSpecable{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "foo": "bar", @@ -79,7 +81,7 @@ func (t *WithPod) Populate() { } // GetListType implements apis.Listable -func (*WithPod) GetListType() runtime.Object { +func (wp *WithPod) GetListType() runtime.Object { return &WithPodList{} } @@ -92,3 +94,52 @@ type WithPodList struct { Items []WithPod `json:"items"` } + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Pod is a wrapper around Pod-like resource, which supports our interfaces +// for webhooks +type Pod struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec corev1.PodSpec `json:"spec,omitempty"` +} + +// Verify Pod resources meet duck contracts. +var ( + _ apis.Validatable = (*Pod)(nil) + _ apis.Defaultable = (*Pod)(nil) + _ apis.Listable = (*Pod)(nil) + _ ducktypes.Populatable = (*Pod)(nil) +) + +// GetFullType implements duck.Implementable +func (p *Pod) GetFullType() ducktypes.Populatable { + return &Pod{} +} + +// Populate implements duck.Populatable +func (p *Pod) Populate() { + p.Spec = corev1.PodSpec{ + Containers: []corev1.Container{{ + Name: "container-name", + Image: "container-image:latest", + }}, + } +} + +// GetListType implements apis.Listable +func (p *Pod) GetListType() runtime.Object { + return &PodList{} +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PodList is a list of WithPod resources +type PodList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []WithPod `json:"items"` +} diff --git a/vendor/knative.dev/pkg/apis/duck/v1/podspec_validation.go b/vendor/knative.dev/pkg/apis/duck/v1/podspec_validation.go new file mode 100644 index 000000000..1ec6ef48d --- /dev/null +++ b/vendor/knative.dev/pkg/apis/duck/v1/podspec_validation.go @@ -0,0 +1,77 @@ +/* +Copyright 2021 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. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + "context" + + "knative.dev/pkg/apis" +) + +// PodSpecValidator is a callback to validate a PodSpecable. +type PodSpecValidator func(context.Context, *WithPod) *apis.FieldError + +// Validate implements apis.Validatable +func (wp *WithPod) Validate(ctx context.Context) *apis.FieldError { + if psv := GetPodSpecValidator(ctx); psv != nil { + return psv(ctx, wp) + } + return nil +} + +// psvKey is used for associating a PodSpecValidator with a context.Context +type psvKey struct{} + +func WithPodSpecValidator(ctx context.Context, psv PodSpecValidator) context.Context { + return context.WithValue(ctx, psvKey{}, psv) +} + +// GetPodSpecValidator extracts the PodSpecValidator from the context. +func GetPodSpecValidator(ctx context.Context) PodSpecValidator { + untyped := ctx.Value(psvKey{}) + if untyped == nil { + return nil + } + return untyped.(PodSpecValidator) +} + +// PodValidator is a callback to validate Pods. +type PodValidator func(context.Context, *Pod) *apis.FieldError + +// Validate implements apis.Validatable +func (p *Pod) Validate(ctx context.Context) *apis.FieldError { + if pv := GetPodValidator(ctx); pv != nil { + return pv(ctx, p) + } + return nil +} + +// pvKey is used for associating a PodValidator with a context.Context +type pvKey struct{} + +func WithPodValidator(ctx context.Context, pv PodValidator) context.Context { + return context.WithValue(ctx, pvKey{}, pv) +} + +// GetPodValidator extracts the PodValidator from the context. +func GetPodValidator(ctx context.Context) PodValidator { + untyped := ctx.Value(pvKey{}) + if untyped == nil { + return nil + } + return untyped.(PodValidator) +} 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 2f1afe246..00e699156 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/source_types.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/source_types.go @@ -17,6 +17,7 @@ limitations under the License. package v1 import ( + "context" "time" corev1 "k8s.io/api/core/v1" @@ -170,3 +171,45 @@ type SourceList struct { Items []Source `json:"items"` } + +func (s *Source) Validate(ctx context.Context) *apis.FieldError { + if s == nil { + return nil + } + return s.Spec.Validate(ctx).ViaField("spec") +} + +func (s *SourceSpec) Validate(ctx context.Context) *apis.FieldError { + return s.CloudEventOverrides.Validate(ctx).ViaField("ceOverrides") +} + +func (ceOverrides *CloudEventOverrides) Validate(ctx context.Context) *apis.FieldError { + for key := range ceOverrides.Extensions { + if err := validateExtensionName(key); err != nil { + return err.ViaField("extensions") + } + } + return nil +} + +func validateExtensionName(key string) *apis.FieldError { + if key == "" { + return apis.ErrInvalidKeyName( + key, + "", + "keys MUST NOT be empty", + ) + } + + for _, c := range key { + if !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) { + return apis.ErrInvalidKeyName( + key, + "", + "keys are expected to be alphanumeric", + ) + } + } + + return nil +} diff --git a/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go b/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go index ae98f0468..22088b214 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go @@ -367,6 +367,66 @@ func (in *KResourceList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Pod) DeepCopyInto(out *Pod) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pod. +func (in *Pod) DeepCopy() *Pod { + if in == nil { + return nil + } + out := new(Pod) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Pod) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodList) DeepCopyInto(out *PodList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WithPod, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodList. +func (in *PodList) DeepCopy() *PodList { + if in == nil { + return nil + } + out := new(PodList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodSpecable) DeepCopyInto(out *PodSpecable) { *out = *in diff --git a/vendor/knative.dev/pkg/apis/field_error.go b/vendor/knative.dev/pkg/apis/field_error.go index 4a5242851..5ea51c0e4 100644 --- a/vendor/knative.dev/pkg/apis/field_error.go +++ b/vendor/knative.dev/pkg/apis/field_error.go @@ -323,12 +323,13 @@ func ErrInvalidArrayValue(value interface{}, field string, index int) *FieldErro return ErrInvalidValue(value, CurrentField).ViaFieldIndex(field, index) } -// ErrInvalidValue constructs a FieldError for a field that has received an -// invalid value. -func ErrInvalidValue(value interface{}, fieldPath string) *FieldError { +// ErrInvalidValue is a variadic helper method for constructing a FieldError +// for a field that has received an invalid value. +func ErrInvalidValue(value interface{}, fieldPath string, details ...string) *FieldError { return &FieldError{ Message: fmt.Sprint("invalid value: ", value), Paths: []string{fieldPath}, + Details: strings.Join(details, ", "), } } diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go index 1781a60e3..e787096b3 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go @@ -206,10 +206,6 @@ func (g *reconcilerReconcilerGenerator) GenerateType(c *generator.Context, t *ty Package: "knative.dev/pkg/reconciler", Name: "DoFinalizeKind", }), - "doObserveFinalizeKind": c.Universe.Type(types.Name{ - Package: "knative.dev/pkg/reconciler", - Name: "DoObserveFinalizeKind", - }), "controllerIsSkipKey": c.Universe.Function(types.Name{ Package: "knative.dev/pkg/controller", Name: "IsSkipKey", @@ -264,20 +260,6 @@ type ReadOnlyInterface interface { ObserveKind(ctx {{.contextContext|raw}}, o *{{.type|raw}}) {{.reconcilerEvent|raw}} } -// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a -// controller finalizing {{.type|raw}} if they want to process tombstoned resources -// even when they are not the leader. Due to the nature of how finalizers are handled -// there are no guarantees that this will be called. -// -// Deprecated: Use reconciler.OnDeletionInterface instead. -type ReadOnlyFinalizer interface { - // ObserveFinalizeKind implements custom logic to observe the final state of {{.type|raw}}. - // This method should not write to the API. - // - // Deprecated: Use reconciler.ObserveDeletion instead. - ObserveFinalizeKind(ctx {{.contextContext|raw}}, o *{{.type|raw}}) {{.reconcilerEvent|raw}} -} - type doReconcile func(ctx {{.contextContext|raw}}, o *{{.type|raw}}) {{.reconcilerEvent|raw}} // reconcilerImpl implements controller.Reconciler for {{.type|raw}} resources. @@ -483,7 +465,7 @@ func (r *reconcilerImpl) Reconcile(ctx {{.contextContext|raw}}, key string) erro return {{.fmtErrorf|raw}}("failed to clear finalizers: %w", err) } - case {{.doObserveKind|raw}}, {{.doObserveFinalizeKind|raw}}: + case {{.doObserveKind|raw}}: // Observe any changes to this resource, since we are not the leader. reconcileEvent = do(ctx, resource) diff --git a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_state.go b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_state.go index db8334b40..9ef362505 100644 --- a/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_state.go +++ b/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_state.go @@ -84,10 +84,6 @@ func (g *reconcilerStateGenerator) GenerateType(c *generator.Context, t *types.T Package: "knative.dev/pkg/reconciler", Name: "DoFinalizeKind", }), - "doObserveFinalizeKind": c.Universe.Type(types.Name{ - Package: "knative.dev/pkg/reconciler", - Name: "DoObserveFinalizeKind", - }), } sw.Do(reconcilerStateType, m) @@ -111,10 +107,6 @@ type state struct { roi ReadOnlyInterface // isROI (Read Only Interface) the reconciler only observes reconciliation. isROI bool - // rof is the read only finalizer cast of the reconciler. - rof ReadOnlyFinalizer - // isROF (Read Only Finalizer) the reconciler only observes finalize. - isROF bool // isLeader the instance of the reconciler is the elected leader. isLeader bool } @@ -127,7 +119,6 @@ func newState(key string, r *reconcilerImpl) (*state, error) { } roi, isROI := r.reconciler.(ReadOnlyInterface) - rof, isROF := r.reconciler.(ReadOnlyFinalizer) isLeader := r.IsLeaderFor({{.typesNamespacedName|raw}}{ Namespace: namespace, @@ -141,8 +132,6 @@ func newState(key string, r *reconcilerImpl) (*state, error) { reconciler: r.reconciler, roi: roi, isROI: isROI, - rof: rof, - isROF: isROF, isLeader: isLeader, }, nil } @@ -154,8 +143,8 @@ var reconcilerStateMethods = ` // isNotLeaderNorObserver returns true when there is no work possible for the // reconciler. func (s *state) isNotLeaderNorObserver() bool { - if !s.isLeader && !s.isROI && !s.isROF { - // If we are not the leader, and we don't implement either ReadOnly + if !s.isLeader && !s.isROI { + // If we are not the leader, and we don't implement the ReadOnly // interface, then take a fast-path out. return true } @@ -171,8 +160,6 @@ func (s *state) reconcileMethodFor(o *{{.type|raw}}) (string, doReconcile) { } } else if fin, ok := s.reconciler.(Finalizer); s.isLeader && ok { return {{.doFinalizeKind|raw}}, fin.FinalizeKind - } else if !s.isLeader && s.isROF { - return {{.doObserveFinalizeKind|raw}}, s.rof.ObserveFinalizeKind } return "unknown", nil } diff --git a/vendor/knative.dev/pkg/controller/controller.go b/vendor/knative.dev/pkg/controller/controller.go index 6d8035fe9..3952dbc2e 100644 --- a/vendor/knative.dev/pkg/controller/controller.go +++ b/vendor/knative.dev/pkg/controller/controller.go @@ -273,7 +273,7 @@ func (c *Impl) WorkQueue() workqueue.RateLimitingInterface { func (c *Impl) EnqueueAfter(obj interface{}, after time.Duration) { object, err := kmeta.DeletionHandlingAccessor(obj) if err != nil { - c.logger.Errorw("Enqueue", zap.Error(err)) + c.logger.Errorw("EnqueueAfter", zap.Error(err)) return } c.EnqueueKeyAfter(types.NamespacedName{Namespace: object.GetNamespace(), Name: object.GetName()}, after) @@ -540,7 +540,7 @@ func (c *Impl) processNextWorkItem() bool { // Run Reconcile, passing it the namespace/name string of the // resource to be synced. if err = c.Reconciler.Reconcile(ctx, keyStr); err != nil { - c.handleErr(err, key, startTime) + c.handleErr(logger, err, key, startTime) return true } @@ -552,18 +552,18 @@ func (c *Impl) processNextWorkItem() bool { return true } -func (c *Impl) handleErr(err error, key types.NamespacedName, startTime time.Time) { +func (c *Impl) handleErr(logger *zap.SugaredLogger, err error, key types.NamespacedName, startTime time.Time) { if IsSkipKey(err) { c.workQueue.Forget(key) return } if ok, delay := IsRequeueKey(err); ok { c.workQueue.AddAfter(key, delay) - c.logger.Debugf("Requeuing key %s (by request) after %v (depth: %d)", safeKey(key), delay, c.workQueue.Len()) + logger.Debugf("Requeuing key %s (by request) after %v (depth: %d)", safeKey(key), delay, c.workQueue.Len()) return } - c.logger.Errorw("Reconcile error", zap.Duration("duration", time.Since(startTime)), zap.Error(err)) + logger.Errorw("Reconcile error", zap.Duration("duration", time.Since(startTime)), zap.Error(err)) // Re-queue the key if it's a transient error. // We want to check that the queue is shutting down here @@ -571,7 +571,7 @@ func (c *Impl) handleErr(err error, key types.NamespacedName, startTime time.Tim // being processed, queue.Len==0). if !IsPermanentError(err) && !c.workQueue.ShuttingDown() { c.workQueue.AddRateLimited(key) - c.logger.Debugf("Requeuing key %s due to non-permanent error (depth: %d)", safeKey(key), c.workQueue.Len()) + logger.Debugf("Requeuing key %s due to non-permanent error (depth: %d)", safeKey(key), c.workQueue.Len()) return } diff --git a/vendor/knative.dev/pkg/reconciler/reconcile_common.go b/vendor/knative.dev/pkg/reconciler/reconcile_common.go index 114d53b03..34d56b2f4 100644 --- a/vendor/knative.dev/pkg/reconciler/reconcile_common.go +++ b/vendor/knative.dev/pkg/reconciler/reconcile_common.go @@ -38,6 +38,8 @@ const ( // DoObserveKind is the function name for observing the resource (as a non leader). DoObserveKind = "ObserveKind" // DoObserveFinalizeKind is the function name for observing finalization of the resource (as a non leader). + // + // Deprecated: This will be deleted soon. DoObserveFinalizeKind = "ObserveFinalizeKind" ) diff --git a/vendor/knative.dev/serving/test/e2e-tests.sh b/vendor/knative.dev/serving/test/e2e-tests.sh index 01c00e59c..4f839dd6a 100644 --- a/vendor/knative.dev/serving/test/e2e-tests.sh +++ b/vendor/knative.dev/serving/test/e2e-tests.sh @@ -130,4 +130,32 @@ fi # Remove the kail log file if the test flow passes. # This is for preventing too many large log files to be uploaded to GCS in CI. rm "${ARTIFACTS}/k8s.log-$(basename "${E2E_SCRIPT}").txt" + +header "Collecting performance data" + +cat < "$template" + +run_go_tool github.com/markusthoemmes/podspeed/cmd/podspeed@358209f podspeed --prepull -pods 100 -template "$template" > "${ARTIFACTS}/pod-bringup-performance.txt" +cat "${ARTIFACTS}/pod-bringup-performance.txt" + +kubectl delete ksvc podspeed + success diff --git a/vendor/knative.dev/serving/test/e2e_flags.go b/vendor/knative.dev/serving/test/e2e_flags.go index 69154d6ca..73214d7d8 100644 --- a/vendor/knative.dev/serving/test/e2e_flags.go +++ b/vendor/knative.dev/serving/test/e2e_flags.go @@ -31,18 +31,19 @@ var ServingFlags = initializeServingFlags() // ServingEnvironmentFlags holds the e2e flags needed only by the serving repo. type ServingEnvironmentFlags struct { - ResolvableDomain bool // Resolve Route controller's `domainSuffix` - CustomDomain string // Indicates the `domainSuffix` for custom domain test. - HTTPS bool // Indicates where the test service will be created with https - Buckets int // The number of reconciler buckets configured. - Replicas int // The number of controlplane replicas being run. - EnableAlphaFeatures bool // Indicates whether we run tests for alpha features - EnableBetaFeatures bool // Indicates whether we run tests for beta features - DisableLogStream bool // Indicates whether log streaming is disabled - DisableOptionalAPI bool // Indicates whether to skip conformance tests against optional API - TestNamespace string // Default namespace for Serving E2E/Conformance tests - AltTestNamespace string // Alternative namespace for running cross-namespace tests in - TLSTestNamespace string // Namespace for Serving TLS tests + ResolvableDomain bool // Resolve Route controller's `domainSuffix` + CustomDomain string // Indicates the `domainSuffix` for custom domain test. + HTTPS bool // Indicates where the test service will be created with https + Buckets int // The number of reconciler buckets configured. + Replicas int // The number of controlplane replicas being run. + EnableAlphaFeatures bool // Indicates whether we run tests for alpha features + EnableBetaFeatures bool // Indicates whether we run tests for beta features + DisableLogStream bool // Indicates whether log streaming is disabled + DisableOptionalAPI bool // Indicates whether to skip conformance tests against optional API + TestNamespace string // Default namespace for Serving E2E/Conformance tests + AltTestNamespace string // Alternative namespace for running cross-namespace tests in + TLSTestNamespace string // Namespace for Serving TLS tests + ExceedingMemoryLimitSize int // Memory size used to trigger a non-200 response when the service is set with 300MB memory limit. } func initializeServingFlags() *ServingEnvironmentFlags { @@ -84,5 +85,9 @@ func initializeServingFlags() *ServingEnvironmentFlags { flag.StringVar(&f.TLSTestNamespace, "tls-test-namespace", "tls", "Set this flag to change the namespace for running TLS tests.") + flag.IntVar(&f.ExceedingMemoryLimitSize, "exceeding-memory-limit-size", 500, + "Set this flag to the MB of memory consumed by your service in resource limit tests. "+ + "You service is set with 300 MB memory limit and shoud return a non-200 response when consuming such amount of memory.") + return &f } diff --git a/vendor/modules.txt b/vendor/modules.txt index 74e4c55ba..63d74c5e0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -727,7 +727,7 @@ k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/pointer k8s.io/utils/trace -# knative.dev/eventing v0.25.1-0.20210906161343-38f38456f045 +# knative.dev/eventing v0.25.1-0.20210909163359-316e14d7fbc2 ## explicit knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/duck @@ -756,7 +756,7 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake # knative.dev/hack v0.0.0-20210806075220-815cd312d65c ## explicit knative.dev/hack -# knative.dev/networking v0.0.0-20210906131644-9d1fe47ad4b4 +# knative.dev/networking v0.0.0-20210910120730-eb37d69eb87f ## explicit knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking @@ -764,7 +764,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-20210907112319-73d4fe679a2e +# knative.dev/pkg v0.0.0-20210909165259-d4505c660535 ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -814,7 +814,7 @@ knative.dev/pkg/tracing/propagation knative.dev/pkg/tracing/propagation/tracecontextb3 knative.dev/pkg/tracker knative.dev/pkg/unstructured -# knative.dev/serving v0.25.1-0.20210907113619-1c022d766c5b +# knative.dev/serving v0.25.1-0.20210913112533-33aeffc6c9e2 ## explicit knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1