Documentation
¶
Index ¶
- Constants
- func DisableFeature(features *Feat, feature Feat)
- func EnableFeature(features *Feat, feature Feat)
- func GetAddonSecret() (string, string, error)
- func IsFeatureEnabled(features Feat, feature Feat) bool
- func SetConfig(c *Config)
- type CNI
- type Config
- type ENI
- type ENIConfig
- type ENIIP
- type EniSelectionPolicy
- type ExtraEipInfo
- type Feat
- type InternetChargeType
- type NetworkResource
- type PodEipInfo
- type PodInfo
- type PodResources
- type PoolConfig
- type Res
- type ResStatus
- type ResourceItem
Constants ¶
const ( PodNetworkTypeVPCENI = "VPCENI" PodNetworkTypeENIMultiIP = "ENIMultiIP" )
const ( ResourceTypeENI = "eni" ResourceTypeENIIP = "eniIp" )
network resource type
const ( ModeVPC = "VPC" ModeENIMultiIP = "ENIMultiIP" ModeENIOnly = "ENIOnly" )
const ( VSwitchSelectionPolicyRandom = "random" VSwitchSelectionPolicyOrdered = "ordered" )
Vswitch Selection Policy
Variables ¶
This section is empty.
Functions ¶
func DisableFeature ¶ added in v1.13.7
func EnableFeature ¶ added in v1.13.7
func GetAddonSecret ¶ added in v1.8.0
GetAddonSecret return ak/sk from file, return nil if not present.
func IsFeatureEnabled ¶ added in v1.13.7
Types ¶
type Config ¶
type Config struct {
Version string `yaml:"version" json:"version"`
AccessID secret.Secret `yaml:"access_key" json:"access_key"`
AccessSecret secret.Secret `yaml:"access_secret" json:"access_secret"`
RegionID string `yaml:"region_id" json:"region_id"`
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"`
IPWarmUpSize *int `yaml:"ip_warm_up_size" json:"ip_warm_up_size"`
IdleIPReclaimAfter *string `yaml:"idle_ip_reclaim_after,omitempty" json:"idle_ip_reclaim_after,omitempty"`
IdleIPReclaimBatchSize int `yaml:"idle_ip_reclaim_batch_size,omitempty" json:"idle_ip_reclaim_batch_size,omitempty"`
IdleIPReclaimInterval *string `yaml:"idle_ip_reclaim_interval,omitempty" json:"idle_ip_reclaim_interval,omitempty"`
IdleIPReclaimJitterFactor *string `yaml:"idle_ip_reclaim_jitter_factor,omitempty" json:"idle_ip_reclaim_jitter_factor,omitempty"`
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" mod:"default=1"`
EniCapShift int `yaml:"eni_cap_shift" json:"eni_cap_shift"`
VSwitchSelectionPolicy string `yaml:"vswitch_selection_policy" json:"vswitch_selection_policy" mod:"default=random"`
EniSelectionPolicy string `yaml:"eni_selection_policy" json:"eni_selection_policy" mod:"default=most_ips"`
IPStack string `yaml:"ip_stack" json:"ip_stack" validate:"oneof=ipv4 ipv6 dual" mod:"default=ipv4"` // default ipv4 , support ipv4 dual
EnableENITrunking bool `yaml:"enable_eni_trunking" json:"enable_eni_trunking"`
EnableERDMA bool `yaml:"enable_erdma" json:"enable_erdma"`
CustomStatefulWorkloadKinds []string `yaml:"custom_stateful_workload_kinds" json:"custom_stateful_workload_kinds"`
IPAMType types.IPAMType `yaml:"ipam_type" json:"ipam_type"` // crd or default
BackoffOverride map[string]backoff.ExtendedBackoff `json:"backoff_override,omitempty"`
ExtraRoutes []route.Route `json:"extra_routes,omitempty"`
DisableDevicePlugin bool `json:"disable_device_plugin"`
ENITagFilter map[string]string `json:"eni_tag_filter"` // if set , only enis match filter, will be managed
KubeClientQPS float32 `json:"kube_client_qps"`
KubeClientBurst int `json:"kube_client_burst"`
ResourceGroupID string `json:"resource_group_id"`
RateLimit map[string]int `json:"rate_limit"`
EnablePatchPodIPs *bool `json:"enable_patch_pod_ips,omitempty" mod:"default=true"`
IPPoolSyncPeriod string `json:"ip_pool_sync_period"`
}
Config configuration of terway daemon
func ConfigFromConfigMap ¶
func ConfigFromConfigMap(ctx context.Context, client client.Client, nodeName string) (*Config, error)
ConfigFromConfigMap get eni-config form configmap if nodeName is not empty dynamic config is read
func GetConfigFromFileWithMerge ¶
GetConfigFromFileWithMerge parse Config from file
func MergeConfigAndUnmarshal ¶
func (*Config) GetExtraRoutes ¶
func (*Config) GetIPPoolSYncPeriod ¶ added in v1.15.0
func (*Config) GetIPStack ¶ added in v1.15.0
func (*Config) GetSecurityGroups ¶
func (*Config) GetVSwitchIDs ¶
type ENI ¶ added in v1.7.0
type ENI struct {
ID string
MAC string
SecurityGroupIDs []string
Trunk bool
ERdma bool
PrimaryIP types.IPSet
GatewayIP types.IPSet
VSwitchCIDR types.IPNetSet
VSwitchID string
}
ENI aliyun ENI resource
func (*ENI) GetResourceID ¶ added in v1.7.0
GetResourceID return mac address of eni
func (*ENI) ToResItems ¶ added in v1.7.0
func (e *ENI) ToResItems() []ResourceItem
type ENIConfig ¶ added in v1.13.7
type ENIConfig struct {
ZoneID string
VSwitchOptions []string
ENITags map[string]string
SecurityGroupIDs []string
InstanceID string
VSwitchSelectionPolicy vswitch.SelectionPolicy
EniSelectionPolicy EniSelectionPolicy
ResourceGroupID string
EniTypeAttr Feat
EnableIPv4 bool
EnableIPv6 bool
TagFilter map[string]string
}
type ENIIP ¶ added in v1.7.0
ENIIP aliyun secondary IP resource
func (*ENIIP) GetResourceID ¶ added in v1.7.0
GetResourceID return mac address of eni and secondary ip address
func (*ENIIP) ToResItems ¶ added in v1.7.0
func (e *ENIIP) ToResItems() []ResourceItem
type EniSelectionPolicy ¶ added in v1.13.7
type EniSelectionPolicy string
const ( EniSelectionPolicyLeastIPs EniSelectionPolicy = "least_ips" EniSelectionPolicyMostIPs EniSelectionPolicy = "most_ips" )
Network interface Selection Policy
type ExtraEipInfo ¶ added in v1.7.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 NetworkResource ¶ added in v1.7.0
type NetworkResource interface {
GetResourceID() string
GetType() string
ToResItems() []ResourceItem
}
NetworkResource interface of network resources
type PodEipInfo ¶ added in v1.7.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 DEPRECATED
type PodInfo ¶ added in v1.7.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 types.IPSet // used for eip and mip
SandboxExited bool
EipInfo PodEipInfo // deprecated
IPStickTime time.Duration // deprecated
PodENI bool
PodUID string
NetworkPriority string
ERdma bool
CreateTime time.Time // pod creation timestamp
}
PodInfo store the pod info NOTE: this is the type store in db
type PodResources ¶ added in v1.7.0
type PodResources struct {
Resources []ResourceItem
PodInfo *PodInfo
NetNs *string
ContainerID *string
NetConf string
}
PodResources pod resources related
func (PodResources) GetResourceItemByType ¶ added in v1.7.0
func (p PodResources) GetResourceItemByType(resType string) []ResourceItem
GetResourceItemByType get pod resource by resource type
type PoolConfig ¶ added in v1.13.7
type PoolConfig struct {
EnableIPv4 bool
EnableIPv6 bool
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
ERdmaCapacity int // the max erdma res can be created
MaxIPPerENI int
BatchSize int
MaxPoolSize int
MinPoolSize int
ReclaimBatchSize int
ReclaimInterval time.Duration
ReclaimAfter time.Duration
ReclaimFactor float64
}
PoolConfig configuration of pool and resource factory
type ResourceItem ¶ added in v1.7.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