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
|
@ -1,6 +1,7 @@
|
|||
package kubernetes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -22,7 +23,8 @@ const (
|
|||
func TestDnsProgrammingLatency(t *testing.T) {
|
||||
client := fake.NewSimpleClientset()
|
||||
now := time.Now()
|
||||
controller := newdnsController(client, dnsControlOpts{
|
||||
ctx := context.TODO()
|
||||
controller := newdnsController(ctx, client, dnsControlOpts{
|
||||
initEndpointsCache: true,
|
||||
// This is needed as otherwise the fake k8s client doesn't work properly.
|
||||
skipAPIObjectsCleanup: true,
|
||||
|
@ -104,24 +106,27 @@ func buildEndpoints(name string, lastChangeTriggerTime interface{}, subsets []ap
|
|||
}
|
||||
|
||||
func createEndpoints(t *testing.T, client kubernetes.Interface, name string, triggerTime interface{}, subsets []api.EndpointSubset) {
|
||||
_, err := client.CoreV1().Endpoints(namespace).Create(buildEndpoints(name, triggerTime, subsets))
|
||||
ctx := context.TODO()
|
||||
_, err := client.CoreV1().Endpoints(namespace).Create(ctx, buildEndpoints(name, triggerTime, subsets), meta.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func updateEndpoints(t *testing.T, client kubernetes.Interface, name string, triggerTime interface{}, subsets []api.EndpointSubset) {
|
||||
_, err := client.CoreV1().Endpoints(namespace).Update(buildEndpoints(name, triggerTime, subsets))
|
||||
ctx := context.TODO()
|
||||
_, err := client.CoreV1().Endpoints(namespace).Update(ctx, buildEndpoints(name, triggerTime, subsets), meta.UpdateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func createService(t *testing.T, client kubernetes.Interface, controller dnsController, name string, clusterIp string) {
|
||||
if _, err := client.CoreV1().Services(namespace).Create(&api.Service{
|
||||
ctx := context.TODO()
|
||||
if _, err := client.CoreV1().Services(namespace).Create(ctx, &api.Service{
|
||||
ObjectMeta: meta.ObjectMeta{Namespace: namespace, Name: name},
|
||||
Spec: api.ServiceSpec{ClusterIP: clusterIp},
|
||||
}); err != nil {
|
||||
}, meta.CreateOptions{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := wait.PollImmediate(10*time.Millisecond, 10*time.Second, func() (bool, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue