Skip to content

Commit

Permalink
istio-optional: iteration 2 (#681)
Browse files Browse the repository at this point in the history
* istio-optional: iteration 2

* fix tests

* indexer tests GatewayAPI before create

* fix rebase issues

* fix tests

* fix tests after code refactor
  • Loading branch information
eguzki authored Jun 12, 2024
1 parent dc597d9 commit 3855421
Show file tree
Hide file tree
Showing 15 changed files with 505 additions and 433 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
istioclientgoextensionv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
"k8s.io/utils/env"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
Expand All @@ -45,12 +45,16 @@ import (
"github.com/kuadrant/kuadrant-operator/pkg/rlptools/wasm"
)

const (
HTTPRouteGatewayParentField = ".metadata.parentRefs.gateway"
var (
WASMFilterImageURL = env.GetString("RELATED_IMAGE_WASMSHIM", "oci://quay.io/kuadrant/wasm-shim:latest")
)

// RateLimitingWASMPluginReconciler reconciles a WASMPlugin object for rate limiting
type RateLimitingWASMPluginReconciler struct {
func WASMPluginName(gw *gatewayapiv1.Gateway) string {
return fmt.Sprintf("kuadrant-%s", gw.Name)
}

// RateLimitingIstioWASMPluginReconciler reconciles a WASMPlugin object for rate limiting
type RateLimitingIstioWASMPluginReconciler struct {
*reconcilers.BaseReconciler
}

Expand All @@ -61,7 +65,7 @@ type RateLimitingWASMPluginReconciler struct {

// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile
func (r *RateLimitingWASMPluginReconciler) Reconcile(eventCtx context.Context, req ctrl.Request) (ctrl.Result, error) {
func (r *RateLimitingIstioWASMPluginReconciler) Reconcile(eventCtx context.Context, req ctrl.Request) (ctrl.Result, error) {
logger := r.Logger().WithValues("Gateway", req.NamespacedName, "request id", uuid.NewString())
logger.Info("Reconciling rate limiting WASMPlugin")
ctx := logr.NewContext(eventCtx, logger)
Expand Down Expand Up @@ -89,7 +93,7 @@ func (r *RateLimitingWASMPluginReconciler) Reconcile(eventCtx context.Context, r
return ctrl.Result{}, err
}

err = r.ReconcileResource(ctx, &istioclientgoextensionv1alpha1.WasmPlugin{}, desired, rlptools.WASMPluginMutator)
err = r.ReconcileResource(ctx, &istioclientgoextensionv1alpha1.WasmPlugin{}, desired, kuadrantistioutils.WASMPluginMutator)
if err != nil {
return ctrl.Result{}, err
}
Expand All @@ -98,7 +102,7 @@ func (r *RateLimitingWASMPluginReconciler) Reconcile(eventCtx context.Context, r
return ctrl.Result{}, nil
}

func (r *RateLimitingWASMPluginReconciler) desiredRateLimitingWASMPlugin(ctx context.Context, gw *gatewayapiv1.Gateway) (*istioclientgoextensionv1alpha1.WasmPlugin, error) {
func (r *RateLimitingIstioWASMPluginReconciler) desiredRateLimitingWASMPlugin(ctx context.Context, gw *gatewayapiv1.Gateway) (*istioclientgoextensionv1alpha1.WasmPlugin, error) {
baseLogger, err := logr.FromContext(ctx)
if err != nil {
return nil, err
Expand All @@ -110,12 +114,12 @@ func (r *RateLimitingWASMPluginReconciler) desiredRateLimitingWASMPlugin(ctx con
APIVersion: "extensions.istio.io/v1alpha1",
},
ObjectMeta: metav1.ObjectMeta{
Name: rlptools.WASMPluginName(gw),
Name: WASMPluginName(gw),
Namespace: gw.Namespace,
},
Spec: istioextensionsv1alpha1.WasmPlugin{
TargetRef: kuadrantistioutils.PolicyTargetRefFromGateway(gw),
Url: rlptools.WASMFilterImageURL,
Url: WASMFilterImageURL,
PluginConfig: nil,
// Insert plugin before Istio stats filters and after Istio authorization filters.
Phase: istioextensionsv1alpha1.PluginPhase_STATS,
Expand Down Expand Up @@ -150,18 +154,18 @@ func (r *RateLimitingWASMPluginReconciler) desiredRateLimitingWASMPlugin(ctx con
return wasmPlugin, nil
}

func (r *RateLimitingWASMPluginReconciler) wasmPluginConfig(ctx context.Context, gw *gatewayapiv1.Gateway) (*wasm.Plugin, error) {
func (r *RateLimitingIstioWASMPluginReconciler) wasmPluginConfig(ctx context.Context, gw *gatewayapiv1.Gateway) (*wasm.Config, error) {
logger, err := logr.FromContext(ctx)
if err != nil {
return nil, err
}

wasmPlugin := &wasm.Plugin{
config := &wasm.Config{
FailureMode: wasm.FailureModeDeny,
RateLimitPolicies: make([]wasm.RateLimitPolicy, 0),
}

t, err := r.topologyIndexesFromGateway(ctx, gw)
t, err := rlptools.TopologyIndexesFromGateway(ctx, r.Client(), gw)
if err != nil {
return nil, err
}
Expand All @@ -185,60 +189,13 @@ func (r *RateLimitingWASMPluginReconciler) wasmPluginConfig(ctx context.Context,
continue
}

wasmPlugin.RateLimitPolicies = append(wasmPlugin.RateLimitPolicies, *wasmRLP)
}

return wasmPlugin, nil
}

func (r *RateLimitingWASMPluginReconciler) topologyIndexesFromGateway(ctx context.Context, gw *gatewayapiv1.Gateway) (*kuadrantgatewayapi.TopologyIndexes, error) {
logger, err := logr.FromContext(ctx)
if err != nil {
return nil, err
}

routeList := &gatewayapiv1.HTTPRouteList{}
// Get all the routes having the gateway as parent
err = r.Client().List(ctx, routeList, client.MatchingFields{HTTPRouteGatewayParentField: client.ObjectKeyFromObject(gw).String()})
logger.V(1).Info("topologyIndexesFromGateway: list httproutes from gateway",
"gateway", client.ObjectKeyFromObject(gw),
"#HTTPRoutes", len(routeList.Items),
"err", err)
if err != nil {
return nil, err
}

rlpList := &kuadrantv1beta2.RateLimitPolicyList{}
// Get all the rate limit policies
err = r.Client().List(ctx, rlpList)
logger.V(1).Info("topologyIndexesFromGateway: list rate limit policies",
"#RLPS", len(rlpList.Items),
"err", err)
if err != nil {
return nil, err
}

policies := utils.Map(rlpList.Items, func(p kuadrantv1beta2.RateLimitPolicy) kuadrantgatewayapi.Policy { return &p })

topology, err := kuadrantgatewayapi.NewTopology(
kuadrantgatewayapi.WithGateways([]*gatewayapiv1.Gateway{gw}),
kuadrantgatewayapi.WithRoutes(utils.Map(routeList.Items, ptr.To[gatewayapiv1.HTTPRoute])),
kuadrantgatewayapi.WithPolicies(policies),
kuadrantgatewayapi.WithLogger(logger),
)
if err != nil {
return nil, err
}

overriddenTopology, err := rlptools.ApplyOverrides(topology, gw)
if err != nil {
return nil, err
config.RateLimitPolicies = append(config.RateLimitPolicies, *wasmRLP)
}

return kuadrantgatewayapi.NewTopologyIndexes(overriddenTopology), nil
return config, nil
}

func (r *RateLimitingWASMPluginReconciler) wasmRateLimitPolicy(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*wasm.RateLimitPolicy, error) {
func (r *RateLimitingIstioWASMPluginReconciler) wasmRateLimitPolicy(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*wasm.RateLimitPolicy, error) {
route, err := r.routeFromRLP(ctx, t, rlp, gw)
if err != nil {
return nil, err
Expand Down Expand Up @@ -271,7 +228,7 @@ func (r *RateLimitingWASMPluginReconciler) wasmRateLimitPolicy(ctx context.Conte
routeWithEffectiveHostnames := route.DeepCopy()
routeWithEffectiveHostnames.Spec.Hostnames = hostnames

rules := rlptools.WasmRules(rlp, routeWithEffectiveHostnames)
rules := wasm.Rules(rlp, routeWithEffectiveHostnames)
if len(rules) == 0 {
// no need to add the policy if there are no rules; a rlp can return no rules if all its limits fail to match any route rule
return nil, nil
Expand All @@ -286,7 +243,7 @@ func (r *RateLimitingWASMPluginReconciler) wasmRateLimitPolicy(ctx context.Conte
}, nil
}

func (r *RateLimitingWASMPluginReconciler) routeFromRLP(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*gatewayapiv1.HTTPRoute, error) {
func (r *RateLimitingIstioWASMPluginReconciler) routeFromRLP(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*gatewayapiv1.HTTPRoute, error) {
logger, err := logr.FromContext(ctx)
if err != nil {
return nil, err
Expand Down Expand Up @@ -325,34 +282,8 @@ func (r *RateLimitingWASMPluginReconciler) routeFromRLP(ctx context.Context, t *
return route, nil
}

// addHTTPRouteByGatewayIndexer declares an index key that we can later use with the client as a pseudo-field name,
// allowing to query all the routes parented by a given gateway
// to prevent creating the same index field multiple times, the function is declared private to be
// called only by this controller
func addHTTPRouteByGatewayIndexer(mgr ctrl.Manager, baseLogger logr.Logger) error {
if err := mgr.GetFieldIndexer().IndexField(context.Background(), &gatewayapiv1.HTTPRoute{}, HTTPRouteGatewayParentField, func(rawObj client.Object) []string {
// grab the route object, extract the parents
route, assertionOk := rawObj.(*gatewayapiv1.HTTPRoute)
if !assertionOk {
baseLogger.V(1).Error(fmt.Errorf("%T is not a *gatewayapiv1.HTTPRoute", rawObj), "cannot map")
return nil
}

logger := baseLogger.WithValues("route", client.ObjectKeyFromObject(route).String())

return utils.Map(kuadrantgatewayapi.GetRouteAcceptedGatewayParentKeys(route), func(key client.ObjectKey) string {
logger.V(1).Info("new gateway added", "key", key.String())
return key.String()
})
}); err != nil {
return err
}

return nil
}

// SetupWithManager sets up the controller with the Manager.
func (r *RateLimitingWASMPluginReconciler) SetupWithManager(mgr ctrl.Manager) error {
func (r *RateLimitingIstioWASMPluginReconciler) SetupWithManager(mgr ctrl.Manager) error {
ok, err := kuadrantistioutils.IsWASMPluginInstalled(mgr.GetRESTMapper())
if err != nil {
return err
Expand All @@ -371,12 +302,6 @@ func (r *RateLimitingWASMPluginReconciler) SetupWithManager(mgr ctrl.Manager) er
return nil
}

// Add custom indexer
err = addHTTPRouteByGatewayIndexer(mgr, r.Logger().WithName("routeByGatewayIndexer"))
if err != nil {
return err
}

httpRouteToParentGatewaysEventMapper := mappers.NewHTTPRouteToParentGatewaysEventMapper(
mappers.WithLogger(r.Logger().WithName("httpRouteToParentGatewaysEventMapper")),
)
Expand Down
31 changes: 16 additions & 15 deletions controllers/ratelimitpolicy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/kuadrant/kuadrant-operator/pkg/common"
"github.com/kuadrant/kuadrant-operator/pkg/library/kuadrant"
"github.com/kuadrant/kuadrant-operator/pkg/rlptools"
"github.com/kuadrant/kuadrant-operator/pkg/rlptools/wasm"
"github.com/kuadrant/kuadrant-operator/tests"
)

Expand Down Expand Up @@ -160,7 +161,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1,
Seconds: 3 * 60,
Namespace: rlptools.LimitsNamespaceFromRLP(rlp),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(rlpKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(rlpKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(rlp),
}))
Expand Down Expand Up @@ -246,7 +247,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1,
Seconds: 3 * 60,
Namespace: rlptools.LimitsNamespaceFromRLP(rlp),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(rlpKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(rlpKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(rlp),
}))
Expand Down Expand Up @@ -296,7 +297,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1,
Seconds: 3 * 60,
Namespace: rlptools.LimitsNamespaceFromRLP(rlp),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(rlpKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(rlpKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(rlp),
}))
Expand Down Expand Up @@ -371,7 +372,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 10,
Seconds: 5,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand Down Expand Up @@ -486,7 +487,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1,
Seconds: 180,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand All @@ -508,7 +509,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 10,
Seconds: 5,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "route"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "route"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand Down Expand Up @@ -543,7 +544,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1,
Seconds: 180,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand Down Expand Up @@ -582,7 +583,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 10,
Seconds: 5,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "route"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "route"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand All @@ -605,7 +606,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1,
Seconds: 180,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand All @@ -631,7 +632,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1,
Seconds: 180,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "l1"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand All @@ -654,7 +655,7 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 10,
Seconds: 5,
Namespace: rlptools.LimitsNamespaceFromRLP(routeRLP),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(routeRLPKey, "route"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(routeRLPKey, "route"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(routeRLP),
})).WithContext(ctx).Should(Succeed())
Expand Down Expand Up @@ -1322,31 +1323,31 @@ var _ = Describe("RateLimitPolicy controller", Ordered, func() {
MaxValue: 1000,
Seconds: 1,
Namespace: rlptools.LimitsNamespaceFromRLP(rlpTargetedRoute),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpTargetedRoute), "gw-a-1000rps"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpTargetedRoute), "gw-a-1000rps"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(rlpTargetedRoute),
},
limitadorv1alpha1.RateLimit{
MaxValue: 100,
Seconds: 1,
Namespace: rlptools.LimitsNamespaceFromRLP(rlpTargetedRoute),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpTargetedRoute), "gw-b-100rps"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpTargetedRoute), "gw-b-100rps"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(rlpTargetedRoute),
},
limitadorv1alpha1.RateLimit{ // FIXME(@guicassolato): we need to create one limit definition per gateway × route combination, not one per gateway × policy combination
MaxValue: 1000,
Seconds: 1,
Namespace: rlptools.LimitsNamespaceFromRLP(rlpGatewayA),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpGatewayA), "gw-a-1000rps"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpGatewayA), "gw-a-1000rps"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(rlpGatewayA),
},
limitadorv1alpha1.RateLimit{
MaxValue: 100,
Seconds: 1,
Namespace: rlptools.LimitsNamespaceFromRLP(rlpGatewayB),
Conditions: []string{fmt.Sprintf(`%s == "1"`, rlptools.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpGatewayB), "gw-b-100rps"))},
Conditions: []string{fmt.Sprintf(`%s == "1"`, wasm.LimitNameToLimitadorIdentifier(client.ObjectKeyFromObject(rlpGatewayB), "gw-b-100rps"))},
Variables: []string{},
Name: rlptools.LimitsNameFromRLP(rlpGatewayB),
},
Expand Down
8 changes: 7 additions & 1 deletion controllers/ratelimitpolicy_enforced_status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2"
"github.com/kuadrant/kuadrant-operator/pkg/library/fieldindexers"
kuadrantgatewayapi "github.com/kuadrant/kuadrant-operator/pkg/library/gatewayapi"
"github.com/kuadrant/kuadrant-operator/pkg/library/kuadrant"
"github.com/kuadrant/kuadrant-operator/pkg/library/mappers"
Expand Down Expand Up @@ -180,7 +181,12 @@ func (r *RateLimitPolicyEnforcedStatusReconciler) buildTopology(ctx context.Cont

routeList := &gatewayapiv1.HTTPRouteList{}
// Get all the routes having the gateway as parent
err = r.Client().List(ctx, routeList, client.MatchingFields{HTTPRouteGatewayParentField: client.ObjectKeyFromObject(gw).String()})
err = r.Client().List(
ctx,
routeList,
client.MatchingFields{
fieldindexers.HTTPRouteGatewayParentField: client.ObjectKeyFromObject(gw).String(),
})
logger.V(1).Info("list routes by gateway", "#routes", len(routeList.Items), "err", err)
if err != nil {
return nil, err
Expand Down
Loading

0 comments on commit 3855421

Please sign in to comment.