From fa530145e25d3829e3003262d0117a6db7da76a8 Mon Sep 17 00:00:00 2001 From: Jim Fitzpatrick Date: Tue, 23 Jan 2024 10:57:57 +0000 Subject: [PATCH] PR comments fix --- controllers/kuadrant_controller.go | 50 ++++++++++++++-------------- pkg/kuadranttools/authorino_tools.go | 4 +-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/controllers/kuadrant_controller.go b/controllers/kuadrant_controller.go index b82f503c0..3a881ce48 100644 --- a/controllers/kuadrant_controller.go +++ b/controllers/kuadrant_controller.go @@ -20,6 +20,8 @@ import ( "context" "encoding/json" + "k8s.io/utils/ptr" + "github.com/kuadrant/kuadrant-operator/pkg/kuadranttools" corev1 "k8s.io/api/core/v1" "k8s.io/utils/env" @@ -525,34 +527,32 @@ func (r *KuadrantReconciler) reconcileAuthorino(ctx context.Context, kObj *kuadr authorino := &authorinov1beta1.Authorino{} err := r.Client().Get(ctx, authorinoKey, authorino) if err != nil { - if apierrors.IsNotFound(err) { - tmpFalse := false - authorino = &authorinov1beta1.Authorino{ - TypeMeta: metav1.TypeMeta{ - Kind: "Authorino", - APIVersion: "operator.authorino.kuadrant.io/v1beta1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: common.AuthorinoName, - Namespace: kObj.Namespace, - }, - Spec: authorinov1beta1.AuthorinoSpec{ - ClusterWide: true, - SupersedingHostSubsets: true, - Listener: authorinov1beta1.Listener{ - Tls: authorinov1beta1.Tls{ - Enabled: &tmpFalse, - }, + if !apierrors.IsNotFound(err) { + return err + } + authorino = &authorinov1beta1.Authorino{ + TypeMeta: metav1.TypeMeta{ + Kind: "Authorino", + APIVersion: "operator.authorino.kuadrant.io/v1beta1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: common.AuthorinoName, + Namespace: kObj.Namespace, + }, + Spec: authorinov1beta1.AuthorinoSpec{ + ClusterWide: true, + SupersedingHostSubsets: true, + Listener: authorinov1beta1.Listener{ + Tls: authorinov1beta1.Tls{ + Enabled: ptr.To(false), }, - OIDCServer: authorinov1beta1.OIDCServer{ - Tls: authorinov1beta1.Tls{ - Enabled: &tmpFalse, - }, + }, + OIDCServer: authorinov1beta1.OIDCServer{ + Tls: authorinov1beta1.Tls{ + Enabled: ptr.To(false), }, }, - } - } else { - return err + }, } } diff --git a/pkg/kuadranttools/authorino_tools.go b/pkg/kuadranttools/authorino_tools.go index bc1846a9c..7617e719b 100644 --- a/pkg/kuadranttools/authorino_tools.go +++ b/pkg/kuadranttools/authorino_tools.go @@ -13,11 +13,11 @@ func AuthorinoMutator(existingObj, desiredObj client.Object) (bool, error) { update := false existing, ok := existingObj.(*authorinov1beta1.Authorino) if !ok { - return false, fmt.Errorf("existingObj %T is not a *authorinoauthorinov1beta1.Authorino", existingObj) + return false, fmt.Errorf("existingObj %T is not a *authorinov1beta1.Authorino", existingObj) } desired, ok := desiredObj.(*authorinov1beta1.Authorino) if !ok { - return false, fmt.Errorf("desiredObj %T is not a *authorinoauthorinov1beta1.Authorino", desiredObj) + return false, fmt.Errorf("desiredObj %T is not a *authorinov1beta1.Authorino", desiredObj) } existingSpec := authorinoSpecSubSet(existing.Spec)