Skip to content

Commit

Permalink
PR comments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Boomatang committed Jan 23, 2024
1 parent 885eb2d commit 2863177
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
49 changes: 24 additions & 25 deletions controllers/kuadrant_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package controllers
import (
"context"
"encoding/json"
"k8s.io/utils/ptr"

"github.com/kuadrant/kuadrant-operator/pkg/kuadranttools"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -498,34 +499,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
}

Check warning on line 504 in controllers/kuadrant_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/kuadrant_controller.go#L503-L504

Added lines #L503 - L504 were not covered by tests
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
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/kuadranttools/authorino_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2863177

Please sign in to comment.