diff --git a/go.mod b/go.mod index a3b52246..f9799e45 100644 --- a/go.mod +++ b/go.mod @@ -21,5 +21,5 @@ require ( k8s.io/code-generator v0.21.4 k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 knative.dev/hack v0.0.0-20210806075220-815cd312d65c - knative.dev/pkg v0.0.0-20210908025933-71508fc69a57 + knative.dev/pkg v0.0.0-20210908202858-9a4b6128207c ) diff --git a/go.sum b/go.sum index 43f2fb0b..fc7630b1 100644 --- a/go.sum +++ b/go.sum @@ -978,8 +978,8 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= 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/pkg v0.0.0-20210908025933-71508fc69a57 h1:du+do3to2zboxuk0Uj8Xvf2onOxthyaBSr98+hVB7z4= -knative.dev/pkg v0.0.0-20210908025933-71508fc69a57/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= +knative.dev/pkg v0.0.0-20210908202858-9a4b6128207c h1:Em+aGSEisMG9my6i+arqz5GU+f9GPdbPndtyBIAlOns= +knative.dev/pkg v0.0.0-20210908202858-9a4b6128207c/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8= 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/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go b/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go index a52af19d..ea8388ba 100644 --- a/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go +++ b/pkg/client/injection/reconciler/caching/v1alpha1/image/reconciler.go @@ -73,20 +73,6 @@ type ReadOnlyInterface interface { ObserveKind(ctx context.Context, o *v1alpha1.Image) reconciler.Event } -// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a -// controller finalizing v1alpha1.Image 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 v1alpha1.Image. - // This method should not write to the API. - // - // Deprecated: Use reconciler.ObserveDeletion instead. - ObserveFinalizeKind(ctx context.Context, o *v1alpha1.Image) reconciler.Event -} - type doReconcile func(ctx context.Context, o *v1alpha1.Image) reconciler.Event // reconcilerImpl implements controller.Reconciler for v1alpha1.Image resources. @@ -265,10 +251,6 @@ func (r *reconcilerImpl) Reconcile(ctx context.Context, key string) error { return fmt.Errorf("failed to clear finalizers: %w", err) } - case reconciler.DoObserveKind, reconciler.DoObserveFinalizeKind: - // Observe any changes to this resource, since we are not the leader. - reconcileEvent = do(ctx, resource) - } // Synchronize the status. diff --git a/pkg/client/injection/reconciler/caching/v1alpha1/image/state.go b/pkg/client/injection/reconciler/caching/v1alpha1/image/state.go index e1020597..ee88c448 100644 --- a/pkg/client/injection/reconciler/caching/v1alpha1/image/state.go +++ b/pkg/client/injection/reconciler/caching/v1alpha1/image/state.go @@ -41,10 +41,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 } @@ -57,7 +53,6 @@ func newState(key string, r *reconcilerImpl) (*state, error) { } roi, isROI := r.reconciler.(ReadOnlyInterface) - rof, isROF := r.reconciler.(ReadOnlyFinalizer) isLeader := r.IsLeaderFor(types.NamespacedName{ Namespace: namespace, @@ -71,8 +66,6 @@ func newState(key string, r *reconcilerImpl) (*state, error) { reconciler: r.reconciler, roi: roi, isROI: isROI, - rof: rof, - isROF: isROF, isLeader: isLeader, }, nil } @@ -82,8 +75,8 @@ func newState(key string, r *reconcilerImpl) (*state, error) { // 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 } @@ -99,8 +92,6 @@ func (s *state) reconcileMethodFor(o *v1alpha1.Image) (string, doReconcile) { } } else if fin, ok := s.reconciler.(Finalizer); s.isLeader && ok { return reconciler.DoFinalizeKind, fin.FinalizeKind - } else if !s.isLeader && s.isROF { - return reconciler.DoObserveFinalizeKind, s.rof.ObserveFinalizeKind } return "unknown", nil } diff --git a/vendor/knative.dev/pkg/apis/field_error.go b/vendor/knative.dev/pkg/apis/field_error.go index 4a524285..5ea51c0e 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 1781a60e..96e1edc2 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,10 +465,6 @@ func (r *reconcilerImpl) Reconcile(ctx {{.contextContext|raw}}, key string) erro return {{.fmtErrorf|raw}}("failed to clear finalizers: %w", err) } - case {{.doObserveKind|raw}}, {{.doObserveFinalizeKind|raw}}: - // Observe any changes to this resource, since we are not the leader. - reconcileEvent = do(ctx, resource) - } {{if .hasStatus}} 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 db8334b4..9ef36250 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/reconciler/reconcile_common.go b/vendor/knative.dev/pkg/reconciler/reconcile_common.go index 114d53b0..34d56b2f 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/modules.txt b/vendor/modules.txt index c144c8b9..f7c4072f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -612,7 +612,7 @@ k8s.io/utils/trace # knative.dev/hack v0.0.0-20210806075220-815cd312d65c ## explicit knative.dev/hack -# knative.dev/pkg v0.0.0-20210908025933-71508fc69a57 +# knative.dev/pkg v0.0.0-20210908202858-9a4b6128207c ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck