mirror of https://github.com/knative/pkg.git
Delete deprecated ObserveFinalizeKind API (#2248)
* Delete deprecated ObserveFinalizeKind API * Add back global to allow changes to propagate cleanly
This commit is contained in:
parent
71508fc69a
commit
d9b35c4013
|
@ -73,20 +73,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1.CustomResourceDefinition) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1.CustomResourceDefinition 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 v1.CustomResourceDefinition.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1.CustomResourceDefinition) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1.CustomResourceDefinition) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1.CustomResourceDefinition resources.
|
||||
|
@ -257,10 +243,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.
|
||||
|
|
|
@ -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 *v1.CustomResourceDefinition) (string, doRe
|
|||
}
|
||||
} 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
|
||||
}
|
||||
|
|
|
@ -73,20 +73,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1beta1.CustomResourceDefinition) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1beta1.CustomResourceDefinition 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 v1beta1.CustomResourceDefinition.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1beta1.CustomResourceDefinition) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1beta1.CustomResourceDefinition) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1beta1.CustomResourceDefinition resources.
|
||||
|
@ -257,10 +243,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.
|
||||
|
|
|
@ -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 *v1beta1.CustomResourceDefinition) (string,
|
|||
}
|
||||
} 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
|
||||
}
|
||||
|
|
|
@ -73,20 +73,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1.Deployment 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 v1.Deployment.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1.Deployment) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1.Deployment resources.
|
||||
|
@ -257,10 +243,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.
|
||||
|
|
|
@ -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 *v1.Deployment) (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
|
||||
}
|
||||
|
|
|
@ -73,20 +73,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1beta1.Deployment 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 v1beta1.Deployment.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1beta1.Deployment) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1beta1.Deployment resources.
|
||||
|
@ -257,10 +243,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.
|
||||
|
|
|
@ -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 *v1beta1.Deployment) (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
|
||||
}
|
||||
|
|
|
@ -73,20 +73,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1beta2.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1beta2.Deployment 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 v1beta2.Deployment.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1beta2.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1beta2.Deployment) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1beta2.Deployment resources.
|
||||
|
@ -257,10 +243,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.
|
||||
|
|
|
@ -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 *v1beta2.Deployment) (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
|
||||
}
|
||||
|
|
|
@ -72,20 +72,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1.Namespace) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1.Namespace 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 v1.Namespace.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1.Namespace) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1.Namespace) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1.Namespace resources.
|
||||
|
@ -256,10 +242,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.
|
||||
|
|
|
@ -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 *v1.Namespace) (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
|
||||
}
|
||||
|
|
|
@ -70,20 +70,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1.Secret) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1.Secret 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 v1.Secret.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1.Secret) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1.Secret) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1.Secret resources.
|
||||
|
@ -247,10 +233,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)
|
||||
|
||||
}
|
||||
|
||||
// Report the reconciler event, if any.
|
||||
|
|
|
@ -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 *v1.Secret) (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
|
||||
}
|
||||
|
|
|
@ -73,20 +73,6 @@ type ReadOnlyInterface interface {
|
|||
ObserveKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
// ReadOnlyFinalizer defines the strongly typed interfaces to be implemented by a
|
||||
// controller finalizing v1beta1.Deployment 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 v1beta1.Deployment.
|
||||
// This method should not write to the API.
|
||||
//
|
||||
// Deprecated: Use reconciler.ObserveDeletion instead.
|
||||
ObserveFinalizeKind(ctx context.Context, o *v1beta1.Deployment) reconciler.Event
|
||||
}
|
||||
|
||||
type doReconcile func(ctx context.Context, o *v1beta1.Deployment) reconciler.Event
|
||||
|
||||
// reconcilerImpl implements controller.Reconciler for v1beta1.Deployment resources.
|
||||
|
@ -257,10 +243,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.
|
||||
|
|
|
@ -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 *v1beta1.Deployment) (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
|
||||
}
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue