-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathconfig.go
68 lines (51 loc) · 1.37 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package types
import (
"github.com/AliyunContainerService/terway/pkg/vswitch"
)
type EniSelectionPolicy string
// Network interface Selection Policy
const (
EniSelectionPolicyLeastIPs EniSelectionPolicy = "least_ips"
EniSelectionPolicyMostIPs EniSelectionPolicy = "most_ips"
)
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
}
// PoolConfig configuration of pool and resource factory
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
}
type Feat uint8
const (
FeatTrunk Feat = 1 << iota
FeatERDMA
)
func EnableFeature(features *Feat, feature Feat) {
*features |= feature
}
func DisableFeature(features *Feat, feature Feat) {
*features &= ^feature
}
func IsFeatureEnabled(features Feat, feature Feat) bool {
return features&feature != 0
}