Documentation
¶
Index ¶
- Constants
- func IgnoredByTerway(labels map[string]string) bool
- func PodUseENI(pod *corev1.Pod) bool
- type EIP
- type ENI
- type ENICapPolicy
- type ENIIP
- type ExtraEipInfo
- type FakeRes
- type IPAMType
- type IPFamily
- type IPInsufficientError
- type IPNetSet
- type IPSet
- type IPStack
- type InternetChargeType
- type NetworkPrio
- type NetworkResource
- type PodEipInfo
- type PodIPTypeIPs
- 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" TagENIAllocPolicy = "eni-alloc-policy" TagK8SNodeName = "node-name" 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" // PodENIAllocated pod annotation for allocated eni PodENIAllocated = AnnotationPrefix + "allocated" // PodUID store pod uid PodUID = AnnotationPrefix + "pod-uid" // NetworkPriority set pod network priority NetworkPriority = AnnotationPrefix + "network-priority" ENIAllocFromPool = AnnotationPrefix + "eni-alloc-from-pool" ENIRelatedNodeName = AnnotationPrefix + "node" PodIPs = AnnotationPrefix + "pod-ips" // IgnoreByTerway if the label exist , terway will not handle this kind of res IgnoreByTerway = LabelPrefix + "ignore-by-terway" )
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 ( SufficientIPCondition corev1.NodeConditionType = "SufficientIP" IPResInsufficientReason string = "InsufficientIP" IPResSufficientReason string = "SufficientIP" )
SufficientIPCondition definitions
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
const LabelPrefix = "k8s.aliyun.com/"
Variables ¶
This section is empty.
Functions ¶
func IgnoredByTerway ¶ added in v1.5.5
IgnoredByTerway for both pods and nodes
Types ¶
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 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 IPInsufficientError ¶ added in v1.5.7
func (*IPInsufficientError) Error ¶ added in v1.5.7
func (e *IPInsufficientError) Error() string
type InternetChargeType ¶ added in v1.1.0
type InternetChargeType string
type NetworkPrio ¶ added in v1.3.0
type NetworkPrio string
NetworkPrio network priority for pod
const ( NetworkPrioBestEffort NetworkPrio = "best-effort" NetworkPrioBurstable NetworkPrio = "burstable" NetworkPrioGuaranteed NetworkPrio = "guaranteed" )
NetworkPrio val
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 PodIPTypeIPs ¶ added in v1.5.7
type PodIPTypeIPs string
PodIPTypeIPs Pod IP address type
const ( NormalIPTypeIPs PodIPTypeIPs = AnnotationPrefix + "max-available-ip" MemberENIIPTypeIPs PodIPTypeIPs = AnnotationPrefix + "max-member-eni-ip" ERDMAIPTypeIPs PodIPTypeIPs = AnnotationPrefix + "max-erdma-ip" )
PodIPTypeIPs val
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
NetworkPriority 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
ContainerID *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 {
Capacity int // the max res can hold in the pool
MaxENI int // the max eni terway can be created (already exclude main eni)
MaxMemberENI int // the max member eni can be created
MaxIPPerENI int
MaxPoolSize int
MinPoolSize int
ZoneID string
VSwitchOptions []string
ENITags map[string]string
SecurityGroupIDs []string
InstanceID string
VSwitchSelectionPolicy string
DisableSecurityGroupCheck bool
TrunkENIID string
}
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