diff --git a/internal/liqonet/tunnel-operator/tunnel-operator.go b/internal/liqonet/tunnel-operator/tunnel-operator.go index 5ed64e0d8d..fc544ab821 100644 --- a/internal/liqonet/tunnel-operator/tunnel-operator.go +++ b/internal/liqonet/tunnel-operator/tunnel-operator.go @@ -50,6 +50,10 @@ var ( result = ctrl.Result{} ) +// Constant used for add/deletion of policy routing rules +// to specify any network. +const anyNetwork = "" + // TunnelController type of the tunnel controller. type TunnelController struct { client.Client @@ -189,7 +193,7 @@ func (tc *TunnelController) Reconcile(ctx context.Context, req ctrl.Request) (ct return nil } var configHNetns = func(netNamespace ns.NetNS) error { - added, err := liqorouting.AddPolicyRoutingRule(remotePodCIDR, "", liqoconst.RoutingTableID) + added, err := liqorouting.AddPolicyRoutingRule(remotePodCIDR, anyNetwork, liqoconst.RoutingTableID) if err != nil { klog.Errorf("%s -> unable to configure policy routing rule for subnet {%s}: %s", clusterID, remotePodCIDR, err) return err @@ -197,7 +201,7 @@ func (tc *TunnelController) Reconcile(ctx context.Context, req ctrl.Request) (ct if added { klog.Infof("%s -> policy routing rule for subnet {%s} correctly configured", clusterID, remotePodCIDR) } - added, err = liqorouting.AddPolicyRoutingRule(remoteExternalCIDR, "", liqoconst.RoutingTableID) + added, err = liqorouting.AddPolicyRoutingRule(remoteExternalCIDR, anyNetwork, liqoconst.RoutingTableID) if err != nil { klog.Errorf("%s -> unable to configure policy routing rule for subnet {%s}: %s", clusterID, remoteExternalCIDR, err) return err @@ -208,7 +212,7 @@ func (tc *TunnelController) Reconcile(ctx context.Context, req ctrl.Request) (ct return nil } var unconfigHNetns = func(netNamespace ns.NetNS) error { - deleted, err := liqorouting.DelPolicyRoutingRule(remotePodCIDR, "", liqoconst.RoutingTableID) + deleted, err := liqorouting.DelPolicyRoutingRule(remotePodCIDR, anyNetwork, liqoconst.RoutingTableID) if err != nil { klog.Errorf("%s -> unable to remove policy routing rule for subnet {%s}: %s", clusterID, remotePodCIDR, err) return err @@ -216,7 +220,7 @@ func (tc *TunnelController) Reconcile(ctx context.Context, req ctrl.Request) (ct if deleted { klog.Infof("%s -> policy routing rule for subnet {%s} correctly removed", clusterID, remotePodCIDR) } - deleted, err = liqorouting.DelPolicyRoutingRule(remoteExternalCIDR, "", liqoconst.RoutingTableID) + deleted, err = liqorouting.DelPolicyRoutingRule(remoteExternalCIDR, anyNetwork, liqoconst.RoutingTableID) if err != nil { klog.Errorf("%s -> unable to remove policy routing rule for subnet {%s}: %s", clusterID, remoteExternalCIDR, err) return err