Documentation ¶
Overview ¶
Package routing defines a common interface used to configure the routing tables and policy routing rules in order to reach the remote networks of the peering clusters. Based on the operator the routes are handled differently hence different implementation of the interfaces lives in this package.
Index ¶
- Constants
- func AddPolicyRoutingRule(fromSubnet, toSubnet string, tableID int) (bool, error)
- func AddRoute(dstNet, gwIP string, iFaceIndex, tableID, flags int, scope netlink.Scope) (bool, error)
- func DelPolicyRoutingRule(fromSubnet, toSubnet string, tableID int) (bool, error)
- func DelRoute(dstNet, gwIP string, iFaceIndex, tableID int) (bool, error)
- func EnableIPForwarding() error
- type DirectRoutingManager
- func (drm *DirectRoutingManager) CleanPolicyRules() error
- func (drm *DirectRoutingManager) CleanRoutingTable() error
- func (drm *DirectRoutingManager) EnsureRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
- func (drm *DirectRoutingManager) RemoveRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
- type GatewayRoutingManager
- func (grm *GatewayRoutingManager) CleanPolicyRules() error
- func (grm *GatewayRoutingManager) CleanRoutingTable() error
- func (grm *GatewayRoutingManager) EnsureRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
- func (grm *GatewayRoutingManager) RemoveRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
- type Routing
- type VxlanRoutingManager
- func (vrm *VxlanRoutingManager) CleanPolicyRules() error
- func (vrm *VxlanRoutingManager) CleanRoutingTable() error
- func (vrm *VxlanRoutingManager) EnsureRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
- func (vrm *VxlanRoutingManager) RemoveRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
Constants ¶
const ( // DefaultScope is the default value for the route scope. DefaultScope netlink.Scope = 0 // DefaultFlags is the default value for the route flags. DefaultFlags int = 0 )
Variables ¶
This section is empty.
Functions ¶
func AddPolicyRoutingRule ¶
AddPolicyRoutingRule adds a new policy routing rule.
func AddRoute ¶
func AddRoute(dstNet, gwIP string, iFaceIndex, tableID, flags int, scope netlink.Scope) (bool, error)
AddRoute adds a new route on the given interface.
func DelPolicyRoutingRule ¶
DelPolicyRoutingRule removes a policy routing rule described by the given parameters.
func EnableIPForwarding ¶
func EnableIPForwarding() error
EnableIPForwarding enables ipv4 forwarding in the current network namespace.
Types ¶
type DirectRoutingManager ¶
type DirectRoutingManager struct {
// contains filtered or unexported fields
}
DirectRoutingManager implements the routing manager interface. Nodes has to be on the same network otherwise this solution will not work.
func (*DirectRoutingManager) CleanPolicyRules ¶
func (drm *DirectRoutingManager) CleanPolicyRules() error
CleanPolicyRules removes all the policy rules pointing to the custom routing table used by the route manager.
func (*DirectRoutingManager) CleanRoutingTable ¶
func (drm *DirectRoutingManager) CleanRoutingTable() error
CleanRoutingTable removes all the routes from the custom routing table used by the route manager.
func (*DirectRoutingManager) EnsureRoutesPerCluster ¶
func (drm *DirectRoutingManager) EnsureRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
EnsureRoutesPerCluster accepts as input a netv1alpha.tunnelendpoint. It inserts the routes if they do not exist or updates them if they are outdated. Returns true if the routes have been configured, false if the routes are already configured. An error if something goes wrong and the routes can not be configured.
func (*DirectRoutingManager) RemoveRoutesPerCluster ¶
func (drm *DirectRoutingManager) RemoveRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
RemoveRoutesPerCluster accepts as input a netv1alpha.tunnelendpoint. It deletes the routes if they do exist. Returns true if the routes exist and have been deleted, false if nothing is removed. An error if something goes wrong and the routes can not be removed.
type GatewayRoutingManager ¶
type GatewayRoutingManager struct {
// contains filtered or unexported fields
}
GatewayRoutingManager implements the routing manager interface. Used by the gateway operator to configure the routes for remote clusters.
func (*GatewayRoutingManager) CleanPolicyRules ¶
func (grm *GatewayRoutingManager) CleanPolicyRules() error
CleanPolicyRules stub function, as the gateway only operates in custom network namespace.
func (*GatewayRoutingManager) CleanRoutingTable ¶
func (grm *GatewayRoutingManager) CleanRoutingTable() error
CleanRoutingTable stub function, as the gateway only operates in custom network namespace.
func (*GatewayRoutingManager) EnsureRoutesPerCluster ¶
func (grm *GatewayRoutingManager) EnsureRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
EnsureRoutesPerCluster accepts as input a netv1alpha.tunnelendpoint. It inserts the routes if they do not exist or updates them if they are outdated. Returns true if the routes have been configured, false if the routes are already configured. An error if something goes wrong and the routes can not be configured.
func (*GatewayRoutingManager) RemoveRoutesPerCluster ¶
func (grm *GatewayRoutingManager) RemoveRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
RemoveRoutesPerCluster accepts as input a netv1alpha.tunnelendpoint. It deletes the routes if they do exist. Returns true if the routes exist and have been deleted, false if nothing is removed. An error if something goes wrong and the routes can not be removed.
type Routing ¶
type Routing interface { EnsureRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error) RemoveRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error) CleanRoutingTable() error CleanPolicyRules() error }
Routing interface used to configure the routing rules for peering clusters.
func NewDirectRoutingManager ¶
NewDirectRoutingManager accepts as input a routing table ID and the IP address of the pod. Returns a DirectRoutingManager ready to be used or an error.
func NewGatewayRoutingManager ¶
NewGatewayRoutingManager returns a GatewayRoutingManager ready to be used or an error.
func NewVxlanRoutingManager ¶
func NewVxlanRoutingManager(routingTableID int, podIP, vxlanNetPrefix string, vxlanDevice *overlay.VxlanDevice) (Routing, error)
NewVxlanRoutingManager returns a VxlanRoutingManager ready to be used or an error.
type VxlanRoutingManager ¶
type VxlanRoutingManager struct {
// contains filtered or unexported fields
}
VxlanRoutingManager implements the routing manager interface. Used when nodes are not in the same network.
func (*VxlanRoutingManager) CleanPolicyRules ¶
func (vrm *VxlanRoutingManager) CleanPolicyRules() error
CleanPolicyRules removes all the policy rules pointing to the custom routing table used by the route manager.
func (*VxlanRoutingManager) CleanRoutingTable ¶
func (vrm *VxlanRoutingManager) CleanRoutingTable() error
CleanRoutingTable removes all the routes from the custom routing table used by the route manager.
func (*VxlanRoutingManager) EnsureRoutesPerCluster ¶
func (vrm *VxlanRoutingManager) EnsureRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
EnsureRoutesPerCluster accepts as input a netv1alpha.tunnelendpoint. It inserts the routes if they do not exist or updates them if they are outdated. Returns true if the routes have been configured, false if the routes are already configured. An error if something goes wrong and the routes can not be configured.
func (*VxlanRoutingManager) RemoveRoutesPerCluster ¶
func (vrm *VxlanRoutingManager) RemoveRoutesPerCluster(tep *netv1alpha1.TunnelEndpoint) (bool, error)
RemoveRoutesPerCluster accepts as input a netv1alpha.tunnelendpoint. It deletes the routes if they do exist. Returns true if the routes exist and have been deleted, false if nothing is removed. An error if something goes wrong and the routes can not be removed.