Skip to content

Commit

Permalink
fixup! base reconciler reconciles status: new approach
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Jul 16, 2024
1 parent 0b1f8cd commit 6473a4e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion api/v1beta2/ratelimitpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func (s *RateLimitPolicyStatus) GetConditions() []metav1.Condition {

var _ kuadrant.Policy = &RateLimitPolicy{}
var _ kuadrant.Referrer = &RateLimitPolicy{}
var _ reconcilers.ObjectWithStatus = &RateLimitPolicy{}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
Expand Down
8 changes: 1 addition & 7 deletions pkg/library/reconcilers/base_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ type StatusMeta struct {
func (meta *StatusMeta) GetObservedGeneration() int64 { return meta.ObservedGeneration }

Check warning on line 43 in pkg/library/reconcilers/base_reconciler.go

View check run for this annotation

Codecov / codecov/patch

pkg/library/reconcilers/base_reconciler.go#L43

Added line #L43 was not covered by tests
func (meta *StatusMeta) SetObservedGeneration(o int64) { meta.ObservedGeneration = o }

type ObjectWithStatus interface {
client.Object
GetObservedGeneration() int64
SetObservedGeneration(o int64)
}

// StatusMutator is an interface to hold mutator functions for status updates.
type StatusMutator interface {
Mutate(obj client.Object) (bool, error)
Expand Down Expand Up @@ -175,7 +169,7 @@ func (b *BaseReconciler) ReconcileResource(ctx context.Context, obj, desired cli
return nil
}

func (b *BaseReconciler) ReconcileResourceStatus(ctx context.Context, objKey client.ObjectKey, obj ObjectWithStatus, mutator StatusMutator) error {
func (b *BaseReconciler) ReconcileResourceStatus(ctx context.Context, objKey client.ObjectKey, obj client.Object, mutator StatusMutator) error {
logger, err := logr.FromContext(ctx)
if err != nil {
return err

Check warning on line 175 in pkg/library/reconcilers/base_reconciler.go

View check run for this annotation

Codecov / codecov/patch

pkg/library/reconcilers/base_reconciler.go#L175

Added line #L175 was not covered by tests
Expand Down

0 comments on commit 6473a4e

Please sign in to comment.