Documentation ¶
Index ¶
- Constants
- func PodUseENI(pod *corev1.Pod) bool
- type Configure
- type EIP
- type EIPInstanceType
- type ENI
- type ENICapPolicy
- type ENIIP
- type ExtraEipInfo
- type FakeRes
- type IPAMType
- type IPFamily
- type IPNetSet
- type IPSet
- type IPStack
- type InternetChargeType
- type NetworkResource
- type PodEipInfo
- type PodInfo
- type PodResources
- type PoolConfig
- type Res
- type ResStatus
- type ResourceItem
- type Veth
Constants ¶
const ( TagKeyClusterID = "ack.aliyun.com" // NetworkInterfaceTagCreatorKey denotes the creator tag's key of network interface NetworkInterfaceTagCreatorKey = "creator" // NetworkInterfaceTagCreatorValue denotes the creator tag's value of network interface NetworkInterfaceTagCreatorValue = "terway" // TagTerwayController terway controller TagTerwayController = "terway-controller" TagKubernetesPodName = "k8s_pod_name" TagKubernetesPodNamespace = "k8s_pod_namespace" )
this keys is used in alibabacloud resource
const ( // TrunkOn is the key for eni TrunkOn = AnnotationPrefix + "trunk-on" // PodENI whether pod is using podENI cr resource PodENI = AnnotationPrefix + "pod-eni" PodNetworking = AnnotationPrefix + "pod-networking" // PodIPReservation whether pod's IP will be reserved for a reuse PodIPReservation = AnnotationPrefix + "pod-ip-reservation" // PodNetworks for additional net config PodNetworks = AnnotationPrefix + "pod-networks" // PodAllocType for additional net config PodAllocType = AnnotationPrefix + "pod-alloc-type" // PodUID store pod uid PodUID = AnnotationPrefix + "pod-uid" )
annotations used by terway
const ( EventCreateENISucceed = "CreateENISucceed" EventCreateENIFailed = "CreateENIFailed" EventAttachENISucceed = "AttachENISucceed" EventAttachENIFailed = "AttachENIFailed" EventDetachENISucceed = "DetachENISucceed" EventDetachENIFailed = "DetachENIFailed" EventDeleteENISucceed = "DeleteENISucceed" EventDeleteENIFailed = "DeleteENIFailed" EventUpdatePodENIFailed = "UpdatePodENIFailed" EventSyncPodNetworkingSucceed = "SyncPodNetworkingSucceed" EventSyncPodNetworkingFailed = "SyncPodNetworkingFailed" )
events for control plane
const ( PayByBandwidth = InternetChargeType("PayByBandwidth") PayByTraffic = InternetChargeType("PayByTraffic") )
EIP pay type
const ( ResourceTypeVeth = "veth" ResourceTypeENI = "eni" ResourceTypeENIIP = "eniIp" ResourceTypeEIP = "eip" )
network resource type
const ( VSwitchSelectionPolicyRandom = "random" VSwitchSelectionPolicyOrdered = "ordered" )
Vswitch Selection Policy
const ( IPAMTypeCRD = "crd" IPAMTypePreferCRD = "preferCRD" IPAMTypeDefault = "" )
how terway deal with ip resource
const ( ENICapPolicyPreferTrunk = "preferTrunk" ENICapPolicyDefault = "" )
how eni cap is calculated
const AnnotationPrefix = "k8s.aliyun.com/"
AnnotationPrefix is the annotation prefix
const FinalizerPodENI = "pod-eni"
FinalizerPodENI finalizer for podENI resource
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configure ¶
type Configure struct { Version string `yaml:"version" json:"version"` AccessID string `yaml:"access_key" json:"access_key"` AccessSecret string `yaml:"access_secret" json:"access_secret"` CredentialPath string `yaml:"credential_path" json:"credential_path"` ServiceCIDR string `yaml:"service_cidr" json:"service_cidr"` VSwitches map[string][]string `yaml:"vswitches" json:"vswitches"` ENITags map[string]string `yaml:"eni_tags" json:"eni_tags"` MaxPoolSize int `yaml:"max_pool_size" json:"max_pool_size"` MinPoolSize int `yaml:"min_pool_size" json:"min_pool_size"` MinENI int `yaml:"min_eni" json:"min_eni"` MaxENI int `yaml:"max_eni" json:"max_eni"` Prefix string `yaml:"prefix" json:"prefix"` SecurityGroup string `yaml:"security_group" json:"security_group"` SecurityGroups []string `yaml:"security_groups" json:"security_groups"` EniCapRatio float64 `yaml:"eni_cap_ratio" json:"eni_cap_ratio"` EniCapShift int `yaml:"eni_cap_shift" json:"eni_cap_shift"` VSwitchSelectionPolicy string `yaml:"vswitch_selection_policy" json:"vswitch_selection_policy"` EnableEIPPool string `yaml:"enable_eip_pool" json:"enable_eip_pool"` IPStack string `yaml:"ip_stack" json:"ip_stack"` // default ipv4 , support ipv4 dual // rob the eip instance even the eip already bound to other resource AllowEIPRob string `yaml:"allow_eip_rob" json:"allow_eip_rob"` EnableENITrunking bool `yaml:"enable_eni_trunking" json:"enable_eni_trunking"` CustomStatefulWorkloadKinds []string `yaml:"custom_stateful_workload_kinds" json:"custom_stateful_workload_kinds"` IPAMType IPAMType `yaml:"ipam_type" json:"ipam_type"` // crd or default ENICapPolicy ENICapPolicy `yaml:"eni_cap_policy" json:"eni_cap_policy"` // prefer trunk or secondary BackoffOverride map[string]wait.Backoff `json:"backoff_override,omitempty"` ExtraRoutes []route.Route `json:"extra_routes,omitempty"` DisableDevicePlugin bool `json:"disable_device_plugin"` WaitTrunkENI bool `json:"wait_trunk_eni"` // true for don't create trunk eni DisableSecurityGroupCheck bool `json:"disable_security_group_check"` }
Configure configuration of terway daemon
func GetConfigFromFileWithMerge ¶ added in v1.1.0
GetConfigFromFileWithMerge parse Configure from file
func MergeConfigAndUnmarshal ¶ added in v1.1.0
func (*Configure) GetExtraRoutes ¶ added in v1.2.1
func (*Configure) GetSecurityGroups ¶ added in v1.2.0
func (*Configure) GetVSwitchIDs ¶ added in v1.2.1
type EIP ¶ added in v1.1.0
type EIP struct { ID string Address net.IP Delete bool // delete related eip on pod deletion AssociateENI string AssociateENIIP net.IP }
EIP Aliyun public ip
func (*EIP) GetResourceID ¶ added in v1.1.0
GetResourceID return eip id
func (*EIP) ToResItems ¶ added in v1.1.0
func (e *EIP) ToResItems() []ResourceItem
type EIPInstanceType ¶ added in v1.1.0
type EIPInstanceType string
const EIPInstanceTypeNetworkInterface EIPInstanceType = "NetworkInterface"
type ENI ¶
type ENI struct { ID string MAC string SecurityGroupIDs []string Trunk bool PrimaryIP IPSet GatewayIP IPSet VSwitchCIDR IPNetSet VSwitchID string }
ENI aliyun ENI resource
func (*ENI) GetResourceID ¶ added in v1.1.0
GetResourceID return mac address of eni
func (*ENI) ToResItems ¶ added in v1.1.0
func (e *ENI) ToResItems() []ResourceItem
type ENIIP ¶ added in v1.0.10
ENIIP aliyun secondary IP resource
func (*ENIIP) GetResourceID ¶ added in v1.1.0
GetResourceID return mac address of eni and secondary ip address
func (*ENIIP) ToResItems ¶ added in v1.1.0
func (e *ENIIP) ToResItems() []ResourceItem
type ExtraEipInfo ¶ added in v1.1.0
type ExtraEipInfo struct { Delete bool `json:"delete"` // delete related eip on pod deletion AssociateENI string `json:"associate_eni"` AssociateENIIP net.IP `json:"associate_eniip"` }
ExtraEipInfo store extra eip info To judge whether delete user eip instance
type FakeRes ¶ added in v1.1.0
FakeRes for test
type IPFamily ¶ added in v1.1.0
func NewIPFamilyFromIPStack ¶ added in v1.1.0
NewIPFamilyFromIPStack parse IPStack to IPFamily
type InternetChargeType ¶ added in v1.1.0
type InternetChargeType string
type NetworkResource ¶ added in v1.0.10
type NetworkResource interface { GetResourceID() string GetType() string ToResItems() []ResourceItem }
NetworkResource interface of network resources
type PodEipInfo ¶ added in v1.1.0
type PodEipInfo struct { PodEip bool PodEipID string PodEipIP string PodEipBandWidth int PodEipChargeType InternetChargeType PodEipISP string PodEipPoolID string PodEipBandwidthPackageID string }
PodEipInfo store pod eip info NOTE: this is the type store in db
type PodInfo ¶ added in v1.1.0
type PodInfo struct { //K8sPod *v1.Pod Name string Namespace string TcIngress uint64 TcEgress uint64 PodNetworkType string PodIP string // used for eip and mip PodIPs IPSet // used for eip and mip SandboxExited bool EipInfo PodEipInfo IPStickTime time.Duration PodENI bool PodUID string }
PodInfo store the pod info NOTE: this is the type store in db
type PodResources ¶ added in v1.1.0
type PodResources struct { Resources []ResourceItem PodInfo *PodInfo NetNs *string }
PodResources pod resources related
func (PodResources) GetResourceItemByType ¶ added in v1.1.0
func (p PodResources) GetResourceItemByType(resType string) []ResourceItem
GetResourceItemByType get pod resource by resource type
type PoolConfig ¶
type PoolConfig struct { MaxPoolSize int MinPoolSize int MinENI int MaxENI int VPC string Zone string VSwitch []string ENITags map[string]string SecurityGroups []string InstanceID string AccessID string AccessSecret string EniCapRatio float64 EniCapShift int VSwitchSelectionPolicy string EnableENITrunking bool ENICapPolicy ENICapPolicy DisableDevicePlugin bool WaitTrunkENI bool DisableSecurityGroupCheck bool }
PoolConfig configuration of pool and resource factory
type ResourceItem ¶ added in v1.1.0
type ResourceItem struct { Type string `json:"type"` ID string `json:"id"` ExtraEipInfo *ExtraEipInfo `json:"extra_eip_info"` ENIID string `json:"eni_id"` ENIMAC string `json:"eni_mac"` IPv4 string `json:"ipv4"` IPv6 string `json:"ipv6"` }
ResourceItem to be store
type Veth ¶ added in v1.0.10
type Veth struct {
HostVeth string
}
Veth veth pair resource on system
func (*Veth) GetResourceID ¶ added in v1.1.0
GetResourceID return host veth name of veth resource
func (*Veth) ToResItems ¶ added in v1.1.0
func (e *Veth) ToResItems() []ResourceItem