upgrade to latest dependencies (#1448)

bumping knative.dev/eventing 38f3845...316e14d:
  > 316e14d upgrade to latest dependencies (# 5717)
bumping knative.dev/networking 9d1fe47...eb37d69:
  > eb37d69 Create cert pool for each test client (# 508)
  > 25d317b upgrade to latest dependencies (# 507)
  > 78c491e upgrade to latest dependencies (# 506)
  > 060e46e upgrade to latest dependencies (# 505)
  > c94e114 upgrade to latest dependencies (# 504)
  > 5c789e6 upgrade to latest dependencies (# 503)
  > be5cfde upgrade to latest dependencies (# 502)
bumping knative.dev/serving 1c022d7...33aeffc:
  > 33aeffc Delete orphaned tag certificates after tag deletion (# 11798)
  > f402f87 Introduce a flag to set memory used in the resource limit test (# 11957)
  > a71d49d Update net-istio nightly (# 11975)
  > e85265c Update net-contour nightly (# 11974)
  > a9213d1 Update net-certmanager nightly (# 11973)
  > 9342eeb Add Kubernetes 1.22 to CI (# 11981)
  > 0042297 drop (# 11968)
  > 0342070 upgrade to latest dependencies (# 11970)
  > 3d2eec9 Update net-certmanager nightly (# 11963)
  > 1762cdc Update net-contour nightly (# 11962)
  > c65ed94 Update net-kourier nightly (# 11961)
  > 42353dd Update net-istio nightly (# 11960)
  > 4fcaa97 dd more logging to background digest resolver (# 11959)
  > 4818437 upgrade to latest dependencies (# 11942)
  > 92862ef Speed up concurrency state handler tests (# 11910)
  > cc19d71 Update net-contour nightly (# 11950)
  > 794661a Touch up TestIdleTimeoutHandler some more (# 11953)
  > 5e495e6 Update net-istio nightly (# 11951)
  > e1df9b5 Remove unused isAggressive parameter (# 11935)
  > 9b8b4f6 Run podspeed as part of CI (# 11903)
  > c77bf60 Update net-certmanager nightly (# 11952)
  > f3e4eff Update net-kourier nightly (# 11938)
  > 734fdcf Stabilize TestIdleTimeoutHandler (# 11946)
  > 85a352a Skip TestHPAAutoscaleUpDownUpMem because of excessive flakiness (# 11945)
  > cecace7 Update net-contour nightly (# 11936)
  > 831536e Update net-istio nightly (# 11937)
  > c2b78ab Drop unnecessary RetryingRouteInconsistency helper (# 11933)
  > ac4dc6a Adding simple conformance test for Service list and delete (# 11925)
bumping knative.dev/pkg 73d4fe6...d4505c6:
  > d4505c6 Source validation fixes (# 2251)
  > fb7ee28 when testing downstream use the correct release branch (# 2265)
  > bfab3c8 Add back inadvertedly deleted call to ObserveKind (# 2282)
  > d569db3 Add context to reconcile error logs (# 2281)
  > 9a4b612 Added invalid value field error with details (# 2246)
  > d9b35c4 Delete deprecated ObserveFinalizeKind API (# 2248)
  > 71508fc Introduce `duckv1.Pod`. (# 2280)
  > 26db1ba Enable using `duckv1.WithPod` with our webhook infra. (# 2279)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2021-09-13 11:56:32 -04:00 committed by GitHub
parent 94c8d33b51
commit 82a21a5773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 391 additions and 81 deletions

8
go.mod
View File

@ -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
)

23
go.sum
View File

@ -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=

View File

@ -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.

View File

@ -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)
}

View File

@ -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"`
}

View File

@ -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)
}

View File

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

View File

@ -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

View File

@ -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, ", "),
}
}

View File

@ -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)

View File

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

View File

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

View File

@ -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"
)

View File

@ -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 <<EOF | ko apply -f -
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: podspeed
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/minScale: "1"
spec:
containers:
- image: ko://knative.dev/serving/test/test_images/helloworld
EOF
kubectl wait ksvc/podspeed --for=condition=Ready
template=$(mktemp)
kubectl get pods -lserving.knative.dev/service=podspeed -ojson | jq '.items[0]' > "$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

View File

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

8
vendor/modules.txt vendored
View File

@ -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