Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidefalcone1 committed Jun 28, 2021
1 parent 58efb48 commit 65085f5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/liqonet/tunnel-operator/tunnel-operator.go
Expand Up @@ -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
Expand Down Expand Up @@ -189,15 +193,15 @@ 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
}
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
Expand All @@ -208,15 +212,15 @@ 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
}
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
Expand Down

0 comments on commit 65085f5

Please sign in to comment.