Documentation
¶
Index ¶
- Constants
- func GetAddonSecret() (string, string, error)
- func SetConfig(c *Config)
- type CNI
- type Config
- type ENI
- type ENICapPolicy
- type ENIIP
- type ExtraEipInfo
- type InternetChargeType
- type NetworkResource
- type PodEipInfo
- type PodInfo
- type PodResources
- type Res
- type ResStatus
- type ResourceItem
- type Veth
Constants ¶
const ( PodNetworkTypeVPCIP = "VPCIP" PodNetworkTypeVPCENI = "VPCENI" PodNetworkTypeENIMultiIP = "ENIMultiIP" )
const ( ResourceTypeVeth = "veth" ResourceTypeENI = "eni" ResourceTypeENIIP = "eniIp" ResourceTypeEIP = "eip" )
network resource type
const ( ModeVPC = "VPC" ModeENIMultiIP = "ENIMultiIP" ModeENIOnly = "ENIOnly" )
const ( VSwitchSelectionPolicyRandom = "random" VSwitchSelectionPolicyOrdered = "ordered" )
Vswitch Selection Policy
const ( ENICapPolicyPreferTrunk = "preferTrunk" ENICapPolicyDefault = "" )
how eni cap is calculated
Variables ¶
This section is empty.
Functions ¶
func GetAddonSecret ¶ added in v1.8.0
GetAddonSecret return ak/sk from file, return nil if not present.
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"`
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
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"`
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"`
}
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) 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 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 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
PodENI bool
PodUID string
NetworkPriority string
ERdma bool
}
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 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
type Veth ¶ added in v1.7.0
type Veth struct {
HostVeth string
}
Veth veth pair resource on system
func (*Veth) GetResourceID ¶ added in v1.7.0
GetResourceID return host veth name of veth resource
func (*Veth) ToResItems ¶ added in v1.7.0
func (e *Veth) ToResItems() []ResourceItem