...
1
16
17 package ipamperf
18
19 import (
20 "flag"
21 "testing"
22
23 "k8s.io/klog/v2"
24 "k8s.io/kubernetes/pkg/controller/nodeipam/ipam"
25 "k8s.io/kubernetes/test/integration/framework"
26 )
27
28 var (
29 resultsLogFile string
30 isCustom bool
31 customConfig = &Config{
32 NumNodes: 10,
33 KubeQPS: 30,
34 CloudQPS: 30,
35 CreateQPS: 100,
36 AllocatorType: ipam.RangeAllocatorType,
37 }
38 )
39
40 func TestMain(m *testing.M) {
41 allocator := string(ipam.RangeAllocatorType)
42
43 flag.StringVar(&resultsLogFile, "log", "", "log file to write JSON results to")
44 flag.BoolVar(&isCustom, "custom", false, "enable custom test configuration")
45 flag.StringVar(&allocator, "allocator", allocator, "allocator to use")
46 flag.IntVar(&customConfig.KubeQPS, "kube-qps", customConfig.KubeQPS, "API server qps for allocations")
47 flag.IntVar(&customConfig.NumNodes, "num-nodes", 10, "number of nodes to simulate")
48 flag.IntVar(&customConfig.CreateQPS, "create-qps", customConfig.CreateQPS, "API server qps for node creation")
49 flag.IntVar(&customConfig.CloudQPS, "cloud-qps", customConfig.CloudQPS, "GCE Cloud qps limit")
50 flag.Parse()
51
52 switch allocator {
53 case string(ipam.RangeAllocatorType):
54 customConfig.AllocatorType = ipam.RangeAllocatorType
55 case string(ipam.CloudAllocatorType):
56 customConfig.AllocatorType = ipam.CloudAllocatorType
57 case string(ipam.IPAMFromCloudAllocatorType):
58 customConfig.AllocatorType = ipam.IPAMFromCloudAllocatorType
59 case string(ipam.IPAMFromClusterAllocatorType):
60 customConfig.AllocatorType = ipam.IPAMFromClusterAllocatorType
61 default:
62 klog.Fatalf("Unknown allocator type: %s", allocator)
63 }
64
65 framework.EtcdMain(m.Run)
66 }
67
View as plain text