agent

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package agent contains the libraries that drive the antrea-agent binary. antrea-agent is responsible for the Pod networking and policy implementation on a Kubernetes Node.

Index

Constants

View Source
const (
	TunPortName = "tun0"

	NodeNameEnvKey = "NODE_NAME"
	IPSecPSKEnvKey = "ANTREA_IPSEC_PSK"
)
View Source
const (
	OVSExternalIDMAC          = "attached-mac"
	OVSExternalIDIP           = "ip-address"
	OVSExternalIDContainerID  = "container-id"
	OVSExternalIDPodName      = "pod-name"
	OVSExternalIDPodNamespace = "pod-namespace"
)

Variables

This section is empty.

Functions

func BuildOVSPortExternalIDs

func BuildOVSPortExternalIDs(containerConfig *InterfaceConfig) map[string]interface{}

BuildOVSPortExternalIDs parses OVS port external_ids from local cache, it is used to check container configuration

func CreateAntreaClient

func CreateAntreaClient(config config.ClientConnectionConfiguration) (versioned.Interface, error)

CreateAntreaClient creates an Antrea client from the given config.

Types

type Gateway

type Gateway struct {
	IP   net.IP
	MAC  net.HardwareAddr
	Name string
}

type Initializer

type Initializer struct {
	MTU int
	// contains filtered or unexported fields
}

Initializer knows how to setup host networking, OpenVSwitch, and Openflow.

func NewInitializer

func NewInitializer(
	ovsBridgeClient ovsconfig.OVSBridgeClient,
	ofClient openflow.Client,
	k8sClient clientset.Interface,
	ifaceStore InterfaceStore,
	ovsBridge, serviceCIDR, hostGateway, tunnelType string,
	MTU int,
	enableIPSecTunnel bool) *Initializer

func (*Initializer) GetIPSecPSK

func (i *Initializer) GetIPSecPSK() string

GetIPSecPSK returns PSK used for IPSec tunnel.

func (*Initializer) GetNodeConfig

func (i *Initializer) GetNodeConfig() *NodeConfig

GetNodeConfig returns the NodeConfig.

func (*Initializer) Initialize

func (i *Initializer) Initialize() error

type InterfaceConfig

type InterfaceConfig struct {
	ID           string
	Type         InterfaceType
	IP           net.IP
	MAC          net.HardwareAddr
	PodName      string
	PodNamespace string
	NetNS        string
	*OVSPortConfig
}

func NewContainerInterface

func NewContainerInterface(containerID string, podName string, podNamespace string, containerNetNS string, mac net.HardwareAddr, ip net.IP) *InterfaceConfig

NewContainerInterface creates container interface configuration

func NewGatewayInterface

func NewGatewayInterface(gatewayName string) *InterfaceConfig

NewGatewayInterface creates host gateway interface configuration

func NewTunnelInterface

func NewTunnelInterface(tunnelName string) *InterfaceConfig

NewTunnelInterface creates tunnel port interface configuration

type InterfaceStore

type InterfaceStore interface {
	Initialize(ovsBridgeClient ovsconfig.OVSBridgeClient, gatewayPort string, tunnelPort string) error
	AddInterface(ifaceID string, interfaceConfig *InterfaceConfig)
	DeleteInterface(ifaceID string)
	GetInterface(ifaceID string) (*InterfaceConfig, bool)
	GetContainerInterface(podName string, podNamespace string) (*InterfaceConfig, bool)
	GetContainerInterfaceNum() int
	Len() int
	GetInterfaceIDs() []string
}

InterfaceStore is a service interface to create local interfaces for container, host gateway, and tunnel port. Support add/delete/get operations

func NewInterfaceStore

func NewInterfaceStore() InterfaceStore

type InterfaceType

type InterfaceType uint8
const (
	// ContainerInterface is used to mark current interface is for container
	ContainerInterface InterfaceType = iota
	// GatewayInterface is used to mark current interface is for host gateway
	GatewayInterface
	// TunnelInterface is used to mark current interface is for tunnel port
	TunnelInterface
)

type NodeConfig

type NodeConfig struct {
	Bridge  string
	Name    string
	PodCIDR *net.IPNet
	*Gateway
}

type OVSPortConfig

type OVSPortConfig struct {
	IfaceName string
	PortUUID  string
	OFPort    int32
}

Directories

Path Synopsis
ipam/testing
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.
controller
testing
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL