Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) AddClusterIPRoute(svcIP net.IP) error
- func (c *Client) AddLoadBalancer(svcIP net.IP) error
- func (c *Client) AddLocalAntreaFlexibleIPAMPodRule(podAddresses []net.IP) error
- func (c *Client) AddNodePort(nodePortAddresses []net.IP, port uint16, protocol binding.Protocol) error
- func (c *Client) AddRoutes(podCIDR *net.IPNet, nodeName string, nodeIP, nodeGwIP net.IP) error
- func (c *Client) AddSNATRule(snatIP net.IP, mark uint32) error
- func (c *Client) DeleteClusterIPRoute(svcIP net.IP) error
- func (c *Client) DeleteLoadBalancer(svcIP net.IP) error
- func (c *Client) DeleteLocalAntreaFlexibleIPAMPodRule(podAddresses []net.IP) error
- func (c *Client) DeleteNodePort(nodePortAddresses []net.IP, port uint16, protocol binding.Protocol) error
- func (c *Client) DeleteRoutes(podCIDR *net.IPNet) error
- func (c *Client) DeleteSNATRule(mark uint32) error
- func (c *Client) Initialize(nodeConfig *config.NodeConfig, done func()) error
- func (c *Client) MigrateRoutesToGw(linkName string) error
- func (c *Client) Reconcile(podCIDRs []string) error
- func (c *Client) Run(stopCh <-chan struct{})
- func (c *Client) UnMigrateRoutesFromGw(route *net.IPNet, linkName string) error
- type Interface
Constants ¶
This section is empty.
Variables ¶
var ( // IPTablesSyncInterval is exported so that sync interval can be configured for running integration test with // smaller values. It is meant to be used internally by Run. IPTablesSyncInterval = 60 * time.Second )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client takes care of routing container packets in host network, coordinating ip route, ip rule, iptables and ipset.
func NewClient ¶
func NewClient(networkConfig *config.NetworkConfig, noSNAT, proxyAll, connectUplinkToBridge, multicastEnabled bool, serviceCIDRProvider servicecidr.Interface) (*Client, error)
NewClient returns a route client.
func (*Client) AddClusterIPRoute ¶ added in v1.4.0
TODO: remove it after unifying Windows and Linux functions.
func (*Client) AddLoadBalancer ¶ added in v1.4.0
AddLoadBalancer is used to add routing entry which is used to route LoadBalancer ingress IP to Antrea gateway on host.
func (*Client) AddLocalAntreaFlexibleIPAMPodRule ¶ added in v1.4.0
AddLocalAntreaFlexibleIPAMPodRule is used to add IP to target ip set when an AntreaFlexibleIPAM Pod is added. An entry is added for every Pod IP.
func (*Client) AddNodePort ¶ added in v1.4.0
func (c *Client) AddNodePort(nodePortAddresses []net.IP, port uint16, protocol binding.Protocol) error
AddNodePort is used to add IP,port:protocol entries to target ip set when a NodePort Service is added. An entry is added for every NodePort IP.
func (*Client) AddRoutes ¶
AddRoutes adds routes to a new podCIDR. It overrides the routes if they already exist.
func (*Client) DeleteClusterIPRoute ¶ added in v1.4.0
func (*Client) DeleteLoadBalancer ¶ added in v1.4.0
DeleteLoadBalancer is used to delete routing entry which is used to route LoadBalancer ingress IP to Antrea gateway on host.
func (*Client) DeleteLocalAntreaFlexibleIPAMPodRule ¶ added in v1.4.0
DeletLocaleAntreaFlexibleIPAMPodRule is used to delete related IP set entries when an AntreaFlexibleIPAM Pod is deleted.
func (*Client) DeleteNodePort ¶ added in v1.4.0
func (c *Client) DeleteNodePort(nodePortAddresses []net.IP, port uint16, protocol binding.Protocol) error
DeleteNodePort is used to delete related IP set entries when a NodePort Service is deleted.
func (*Client) DeleteRoutes ¶
DeleteRoutes deletes routes to a PodCIDR. It does nothing if the routes doesn't exist.
func (*Client) DeleteSNATRule ¶
func (*Client) Initialize ¶
func (c *Client) Initialize(nodeConfig *config.NodeConfig, done func()) error
Initialize initializes all infrastructures required to route container packets in host network. It is idempotent and can be safely called on every startup.
func (*Client) MigrateRoutesToGw ¶
MigrateRoutesToGw moves routes (including assigned IP addresses if any) from link linkName to host gateway.
func (*Client) Reconcile ¶
Reconcile removes orphaned podCIDRs from ipset and removes routes to orphaned podCIDRs based on the desired podCIDRs. svcIPs are used for Windows only.
type Interface ¶
type Interface interface { // Initialize should initialize all infrastructures required to route container packets in host network. // It should be idempotent and can be safely called on every startup. Initialize(nodeConfig *config.NodeConfig, done func()) error // Reconcile should remove orphaned routes and related configuration based on the desired podCIDRs and Service IPs. // If IPv6 is enabled in the cluster, Reconcile should also remove the orphaned IPv6 neighbors. Reconcile(podCIDRs []string) error // AddRoutes should add routes to the provided podCIDR. // It should override the routes if they already exist, without error. AddRoutes(podCIDR *net.IPNet, peerNodeName string, peerNodeIP, peerGwIP net.IP) error // DeleteRoutes should delete routes to the provided podCIDR. // It should do nothing if the routes don't exist, without error. DeleteRoutes(podCIDR *net.IPNet) error // MigrateRoutesToGw should move routes from device linkname to local gateway. MigrateRoutesToGw(linkName string) error // UnMigrateRoutesFromGw should move routes back from local gateway to original device linkName // if linkName is nil, it should remove the routes. UnMigrateRoutesFromGw(route *net.IPNet, linkName string) error // AddSNATRule should add rule to SNAT outgoing traffic with the mark, using the provided SNAT IP. AddSNATRule(snatIP net.IP, mark uint32) error // DeleteSNATRule should delete rule to SNAT outgoing traffic with the mark. DeleteSNATRule(mark uint32) error // AddNodePort adds configurations when a NodePort Service is created. AddNodePort(nodePortAddresses []net.IP, port uint16, protocol binding.Protocol) error // DeleteNodePort deletes related configurations when a NodePort Service is deleted. DeleteNodePort(nodePortAddresses []net.IP, port uint16, protocol binding.Protocol) error // AddClusterIPRoute adds route on K8s node for Service ClusterIP. AddClusterIPRoute(svcIP net.IP) error // DeleteClusterIPRoute deletes route for a Service IP when AntreaProxy is configured to handle // ClusterIP Service traffic from host network. DeleteClusterIPRoute(svcIP net.IP) error // AddLoadBalancer adds configurations when a LoadBalancer IP is added. AddLoadBalancer(externalIP net.IP) error // DeleteLoadBalancer deletes related configurations when a LoadBalancer IP is deleted. DeleteLoadBalancer(externalIP net.IP) error // Run starts the sync loop. Run(stopCh <-chan struct{}) // AddLocalAntreaFlexibleIPAMPodRule is used to add IP to target ip set when an AntreaFlexibleIPAM Pod is added. An entry is added // for every Pod IP. AddLocalAntreaFlexibleIPAMPodRule(podAddresses []net.IP) error // DeleteLocalAntreaFlexibleIPAMPodRule is used to delete related IP set entries when an AntreaFlexibleIPAM Pod is deleted. DeleteLocalAntreaFlexibleIPAMPodRule(podAddresses []net.IP) error }
Interface is the interface for routing container packets in host network.