Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions api/gateway/v1alpha1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"net"
"net/netip"
"regexp"
Expand Down Expand Up @@ -387,9 +386,7 @@ func (gw *Gateway) Validate(ctx context.Context, kube kclient.Reader) error {
}
for _, gwGroup := range gw.Spec.Groups {
if !gwGroups[gwGroup.Name] {
// TODO enable validation back after it's supplied by the fabricator
slog.Warn("Gateway group not found", "gateway", gw.Name, "group", gwGroup.Name)
// return fmt.Errorf("gateway group %s not found: %w", gwGroup.Name, ErrInvalidGW)
return fmt.Errorf("gateway group %s not found: %w", gwGroup.Name, ErrInvalidGW)
}
}
}
Expand Down
12 changes: 5 additions & 7 deletions api/gateway/v1alpha1/peering_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ package v1alpha1
import (
"context"
"fmt"
"log/slog"
"maps"
"net/netip"
"slices"
"strconv"
"strings"
"time"

kapierrors "k8s.io/apimachinery/pkg/api/errors"
kmetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kclient "sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -269,13 +269,11 @@ func (p *Peering) Validate(ctx context.Context, kube kclient.Reader) error {
if kube != nil {
gwGroup := &GatewayGroup{}
if err := kube.Get(ctx, kclient.ObjectKey{Name: p.Spec.GatewayGroup, Namespace: p.Namespace}, gwGroup); err != nil {
// TODO enable validation back after it's supplied by the fabricator
slog.Warn("Failed to get Gateway group", "name", p.Spec.GatewayGroup, "error", err.Error())
// if kapierrors.IsNotFound(err) {
// return fmt.Errorf("gateway group %s not found", p.Spec.GatewayGroup) //nolint:err113
// }
if kapierrors.IsNotFound(err) {
return fmt.Errorf("gateway group %s not found", p.Spec.GatewayGroup) //nolint:err113
}

// return fmt.Errorf("failed to get gateway group %s: %w", p.Spec.GatewayGroup, err)
return fmt.Errorf("failed to get gateway group %s: %w", p.Spec.GatewayGroup, err)
}
// check for overlaps of exposed IPs towards either of the VPCs in the peering we are validating
peeringVPCs := maps.Keys(p.Spec.Peering)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ctrl/gateway_ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (r *GatewayReconciler) Reconcile(ctx context.Context, req kctrl.Request) (k
defGwGr := &gwapi.GatewayGroup{
ObjectMeta: kmetav1.ObjectMeta{
Name: gwapi.DefaultGatewayGroup,
Namespace: gw.Namespace,
Namespace: kmetav1.NamespaceDefault,
},
}
if _, err := ctrlutil.CreateOrUpdate(ctx, r.Client, defGwGr, func() error {
Expand Down
Loading