Skip to content

Commit

Permalink
Rebase from main for changes in the policy machinery
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Fitzpatrick <[email protected]>
  • Loading branch information
Boomatang committed Sep 25, 2024
1 parent e8740c5 commit e8899cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions controllers/authorino_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controllers
import (
"context"
"strings"
"sync"

v1beta2 "github.com/kuadrant/authorino-operator/api/v1beta1"
"github.com/kuadrant/policy-machinery/controller"
Expand Down Expand Up @@ -34,7 +35,7 @@ func (r *AuthorinoCrReconciler) Subscription() *controller.Subscription {
}
}

func (r *AuthorinoCrReconciler) Reconcile(ctx context.Context, _ []controller.ResourceEvent, topology *machinery.Topology, _ error) {
func (r *AuthorinoCrReconciler) Reconcile(ctx context.Context, _ []controller.ResourceEvent, topology *machinery.Topology, _ error, _ *sync.Map) error {
logger := controller.LoggerFromContext(ctx).WithName("AuthorinoCrReconciler")
logger.Info("reconciling authorino resource", "status", "started")
defer logger.Info("reconciling authorino resource", "status", "completed")
Expand All @@ -50,10 +51,10 @@ func (r *AuthorinoCrReconciler) Reconcile(ctx context.Context, _ []controller.Re
if err != nil {
if strings.Contains(err.Error(), "empty list passed") {
logger.Info("kuadrant resource not found, ignoring", "status", "skipping")
return
return err
}
logger.Error(err, "cannot find Kuadrant resource", "status", "error")
return
return err
}

aobjs := lo.FilterMap(topology.Objects().Objects().Children(kobj), func(item machinery.Object, _ int) (machinery.Object, bool) {
Expand All @@ -65,7 +66,7 @@ func (r *AuthorinoCrReconciler) Reconcile(ctx context.Context, _ []controller.Re

if len(aobjs) > 0 {
logger.Info("authorino resource already exists, no need to create", "status", "skipping")
return
return nil
}

authorino := &v1beta2.Authorino{
Expand Down Expand Up @@ -116,4 +117,5 @@ func (r *AuthorinoCrReconciler) Reconcile(ctx context.Context, _ []controller.Re
logger.Error(err, "failed to create authorino resource", "status", "error")
}
}
return nil
}
2 changes: 1 addition & 1 deletion controllers/state_of_the_world.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (r *TopologyFileReconciler) Reconcile(ctx context.Context, _ []controller.R
if errors.IsAlreadyExists(err) {
// This error can happen when the operator is starting, and the create event for the topology has not being processed.
logger.Info("already created topology configmap, must not be in topology yet")
return
return err
}
logger.Error(err, "failed to write topology configmap")
}
Expand Down

0 comments on commit e8899cc

Please sign in to comment.