Update k8s.io/[api|apimachinery|client-go] to v0.18.0 (#3796)
* Update k8s.io/[api|apimachinery|client-go] to v0.18.0 This PR updates k8s.io/[api|apimachinery|client-go] to v0.18.0 This PR closes 3791 This PR closes 3792 This PR closes 3793 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix test failures Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix failed tests Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix test failure Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
8bbfa19223
commit
ebbfffaf9d
14 changed files with 93 additions and 76 deletions
|
@ -29,7 +29,8 @@ func BenchmarkController(b *testing.B) {
|
|||
dco := dnsControlOpts{
|
||||
zones: []string{"cluster.local."},
|
||||
}
|
||||
controller := newdnsController(client, dco)
|
||||
ctx := context.Background()
|
||||
controller := newdnsController(ctx, client, dco)
|
||||
cidr := "10.0.0.0/19"
|
||||
|
||||
// Add resources
|
||||
|
@ -39,7 +40,6 @@ func BenchmarkController(b *testing.B) {
|
|||
m.SetQuestion("svc1.testns.svc.cluster.local.", dns.TypeA)
|
||||
k := New([]string{"cluster.local."})
|
||||
k.APIConn = controller
|
||||
ctx := context.Background()
|
||||
rw := &test.ResponseWriter{}
|
||||
|
||||
b.ResetTimer()
|
||||
|
@ -70,6 +70,7 @@ func generateEndpoints(cidr string, client kubernetes.Interface) {
|
|||
Namespace: "testns",
|
||||
},
|
||||
}
|
||||
ctx := context.TODO()
|
||||
for ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {
|
||||
ep.Subsets[0].Addresses = []api.EndpointAddress{
|
||||
{
|
||||
|
@ -78,7 +79,7 @@ func generateEndpoints(cidr string, client kubernetes.Interface) {
|
|||
},
|
||||
}
|
||||
ep.ObjectMeta.Name = "svc" + strconv.Itoa(count)
|
||||
client.CoreV1().Endpoints("testns").Create(ep)
|
||||
client.CoreV1().Endpoints("testns").Create(ctx, ep, meta.CreateOptions{})
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +122,8 @@ func generateSvcs(cidr string, svcType string, client kubernetes.Interface) {
|
|||
}
|
||||
|
||||
func createClusterIPSvc(suffix int, client kubernetes.Interface, ip net.IP) {
|
||||
client.CoreV1().Services("testns").Create(&api.Service{
|
||||
ctx := context.TODO()
|
||||
client.CoreV1().Services("testns").Create(ctx, &api.Service{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "svc" + strconv.Itoa(suffix),
|
||||
Namespace: "testns",
|
||||
|
@ -134,11 +136,12 @@ func createClusterIPSvc(suffix int, client kubernetes.Interface, ip net.IP) {
|
|||
Port: 80,
|
||||
}},
|
||||
},
|
||||
})
|
||||
}, meta.CreateOptions{})
|
||||
}
|
||||
|
||||
func createHeadlessSvc(suffix int, client kubernetes.Interface, ip net.IP) {
|
||||
client.CoreV1().Services("testns").Create(&api.Service{
|
||||
ctx := context.TODO()
|
||||
client.CoreV1().Services("testns").Create(ctx, &api.Service{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "hdls" + strconv.Itoa(suffix),
|
||||
Namespace: "testns",
|
||||
|
@ -146,11 +149,12 @@ func createHeadlessSvc(suffix int, client kubernetes.Interface, ip net.IP) {
|
|||
Spec: api.ServiceSpec{
|
||||
ClusterIP: api.ClusterIPNone,
|
||||
},
|
||||
})
|
||||
}, meta.CreateOptions{})
|
||||
}
|
||||
|
||||
func createExternalSvc(suffix int, client kubernetes.Interface, ip net.IP) {
|
||||
client.CoreV1().Services("testns").Create(&api.Service{
|
||||
ctx := context.TODO()
|
||||
client.CoreV1().Services("testns").Create(ctx, &api.Service{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "external" + strconv.Itoa(suffix),
|
||||
Namespace: "testns",
|
||||
|
@ -164,5 +168,5 @@ func createExternalSvc(suffix int, client kubernetes.Interface, ip net.IP) {
|
|||
}},
|
||||
Type: api.ServiceTypeExternalName,
|
||||
},
|
||||
})
|
||||
}, meta.CreateOptions{})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue