From e8899ccf069f9d51b2e2f8316875d71c9af3705b Mon Sep 17 00:00:00 2001 From: Jim Fitzpatrick Date: Wed, 25 Sep 2024 16:21:18 +0100 Subject: [PATCH] Rebase from main for changes in the policy machinery Signed-off-by: Jim Fitzpatrick --- controllers/authorino_task.go | 10 ++++++---- controllers/state_of_the_world.go | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/controllers/authorino_task.go b/controllers/authorino_task.go index ead3ad29f..0e7c093c9 100644 --- a/controllers/authorino_task.go +++ b/controllers/authorino_task.go @@ -3,6 +3,7 @@ package controllers import ( "context" "strings" + "sync" v1beta2 "github.com/kuadrant/authorino-operator/api/v1beta1" "github.com/kuadrant/policy-machinery/controller" @@ -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") @@ -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) { @@ -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{ @@ -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 } diff --git a/controllers/state_of_the_world.go b/controllers/state_of_the_world.go index 1788e6264..97184d9d4 100644 --- a/controllers/state_of_the_world.go +++ b/controllers/state_of_the_world.go @@ -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") }