Skip to content

Commit c13a9e4

Browse files
authored
feat: Remove k8s.io/kubernetes (#1235)
* chore: Update vendor Signed-off-by: cegao <cegao@tencent.com> * chore: Update code and go mod Signed-off-by: cegao <cegao@tencent.com>
1 parent 36d18b6 commit c13a9e4

File tree

209 files changed

+55
-58547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+55
-58547
lines changed

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/golang/protobuf v1.3.2
1010
github.com/google/go-cmp v0.4.1 // indirect
1111
github.com/grpc-ecosystem/grpc-gateway v1.5.0 // indirect
12-
github.com/kubeflow/common v0.3.2
12+
github.com/kubeflow/common v0.3.3-0.20210201092343-3fbe0ce98269
1313
github.com/onrik/logrus v0.2.2-0.20181225141908-a09d5cdcdc62
1414
github.com/pkg/errors v0.9.1 // indirect
1515
github.com/prometheus/client_golang v1.5.1
@@ -25,7 +25,6 @@ require (
2525
k8s.io/component-base v0.18.2 // indirect
2626
k8s.io/klog v1.0.0
2727
k8s.io/kube-openapi v0.0.0-20200410163147-594e756bea31
28-
k8s.io/kubernetes v1.16.9
2928
sigs.k8s.io/yaml v1.2.0 // indirect
3029
volcano.sh/volcano v0.4.0
3130
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
333333
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
334334
github.com/kubeflow/common v0.3.2 h1:XLb7yHvmU+Q2f7XPsKqlMMJ3nHnUrWbWS7+1m3GcQRI=
335335
github.com/kubeflow/common v0.3.2/go.mod h1:OyD4XjYb5+iNI11VwjvvlhjUNqcUF/0dx3AKk9VpyFQ=
336+
github.com/kubeflow/common v0.3.3-0.20210201092343-3fbe0ce98269 h1:DheSN/HVOT5QKibg0ToHVoHLuNvPuM79MPAwK0GnhDs=
337+
github.com/kubeflow/common v0.3.3-0.20210201092343-3fbe0ce98269/go.mod h1:C3LMBqYaF5acdjTPWgdc3cgTDX/nqpKl+7iukAsznSM=
336338
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
337339
github.com/libopenstorage/openstorage v1.0.0/go.mod h1:Sp1sIObHjat1BeXhfMqLZ14wnOzEhNx2YQedreMcUyc=
338340
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=

pkg/controller.v1/tensorflow/controller_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
kubeinformers "k8s.io/client-go/informers"
2525
kubeclientset "k8s.io/client-go/kubernetes"
2626
"k8s.io/client-go/rest"
27-
"k8s.io/kubernetes/pkg/controller"
2827
batchv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1"
2928
volcanoclient "volcano.sh/volcano/pkg/client/clientset/versioned"
3029

@@ -47,19 +46,21 @@ func newTFController(
4746
kubeClientSet kubeclientset.Interface,
4847
volcanoClientSet volcanoclient.Interface,
4948
tfJobClientSet tfjobclientset.Interface,
50-
resyncPeriod controller.ResyncPeriodFunc,
49+
duration time.Duration,
5150
option options.ServerOption,
5251
) (
5352
*TFController,
5453
kubeinformers.SharedInformerFactory, tfjobinformers.SharedInformerFactory,
5554
) {
56-
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClientSet, resyncPeriod())
57-
tfJobInformerFactory := tfjobinformers.NewSharedInformerFactory(tfJobClientSet, resyncPeriod())
55+
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClientSet, duration)
56+
tfJobInformerFactory := tfjobinformers.NewSharedInformerFactory(tfJobClientSet, duration)
5857

5958
tfJobInformer := NewUnstructuredTFJobInformer(config, metav1.NamespaceAll)
6059

61-
ctr := NewTFController(tfJobInformer, kubeClientSet, volcanoClientSet, tfJobClientSet, kubeInformerFactory, tfJobInformerFactory, option)
62-
ctr.PodControl = &controller.FakePodControl{}
60+
ctr := NewTFController(tfJobInformer, kubeClientSet,
61+
volcanoClientSet, tfJobClientSet, kubeInformerFactory,
62+
tfJobInformerFactory, option)
63+
ctr.PodControl = &control.FakePodControl{}
6364
ctr.ServiceControl = &control.FakeServiceControl{}
6465
return ctr, kubeInformerFactory, tfJobInformerFactory
6566
}
@@ -223,7 +224,7 @@ func TestNormalPath(t *testing.T) {
223224
}
224225
option := options.ServerOption{}
225226
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
226-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, option)
227+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, 0, option)
227228
ctr.tfJobInformerSynced = testutil.AlwaysReady
228229
ctr.PodInformerSynced = testutil.AlwaysReady
229230
ctr.ServiceInformerSynced = testutil.AlwaysReady
@@ -251,7 +252,7 @@ func TestNormalPath(t *testing.T) {
251252
//_, err = ctr.syncTFJob(testutil.GetKey(tfJob, t))
252253
_ = ctr.ReconcileJobs(tfJob, tfJob.Spec.TFReplicaSpecs, tfJob.Status, &tfJob.Spec.RunPolicy)
253254

254-
fakePodControl := ctr.PodControl.(*controller.FakePodControl)
255+
fakePodControl := ctr.PodControl.(*control.FakePodControl)
255256
fakeServiceControl := ctr.ServiceControl.(*control.FakeServiceControl)
256257
if int32(len(fakePodControl.Templates)) != tc.expectedPodCreations {
257258
t.Errorf("%s: unexpected number of pod creates. Expected %d, saw %d\n", name, tc.expectedPodCreations, len(fakePodControl.Templates))
@@ -357,7 +358,8 @@ func TestRun(t *testing.T) {
357358
},
358359
}
359360
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
360-
ctr, _, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
361+
ctr, _, _ := newTFController(config, kubeClientSet,
362+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
361363
ctr.tfJobInformerSynced = testutil.AlwaysReady
362364
ctr.PodInformerSynced = testutil.AlwaysReady
363365
ctr.ServiceInformerSynced = testutil.AlwaysReady

pkg/controller.v1/tensorflow/job_test.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
kubeclientset "k8s.io/client-go/kubernetes"
2424
"k8s.io/client-go/rest"
2525
"k8s.io/client-go/tools/record"
26-
"k8s.io/kubernetes/pkg/controller"
2726
batchv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1"
2827
volcanoclient "volcano.sh/volcano/pkg/client/clientset/versioned"
2928

@@ -62,7 +61,9 @@ func TestAddTFJob(t *testing.T) {
6261
},
6362
}
6463
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
65-
ctr, _, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
64+
ctr, _, _ := newTFController(config, kubeClientSet,
65+
volcanoClientSet, tfJobClientSet, 0,
66+
options.ServerOption{})
6667
ctr.tfJobInformerSynced = testutil.AlwaysReady
6768
ctr.PodInformerSynced = testutil.AlwaysReady
6869
ctr.ServiceInformerSynced = testutil.AlwaysReady
@@ -127,8 +128,9 @@ func TestCopyLabelsAndAnnotation(t *testing.T) {
127128
},
128129
}
129130
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
130-
ctr, _, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
131-
fakePodControl := &controller.FakePodControl{}
131+
ctr, _, _ := newTFController(config, kubeClientSet,
132+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
133+
fakePodControl := &control.FakePodControl{}
132134
ctr.PodControl = fakePodControl
133135
ctr.tfJobInformerSynced = testutil.AlwaysReady
134136
ctr.PodInformerSynced = testutil.AlwaysReady
@@ -311,8 +313,9 @@ func TestDeletePodsAndServices(t *testing.T) {
311313
},
312314
}
313315
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
314-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
315-
fakePodControl := &controller.FakePodControl{}
316+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
317+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
318+
fakePodControl := &control.FakePodControl{}
316319
ctr.PodControl = fakePodControl
317320
fakeServiceControl := &control.FakeServiceControl{}
318321
ctr.ServiceControl = fakeServiceControl
@@ -632,8 +635,9 @@ func TestActiveDeadlineSeconds(t *testing.T) {
632635
},
633636
}
634637
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
635-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
636-
fakePodControl := &controller.FakePodControl{}
638+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
639+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
640+
fakePodControl := &control.FakePodControl{}
637641
ctr.PodControl = fakePodControl
638642
fakeServiceControl := &control.FakeServiceControl{}
639643
ctr.ServiceControl = fakeServiceControl
@@ -758,8 +762,9 @@ func TestBackoffForOnFailure(t *testing.T) {
758762
},
759763
}
760764
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
761-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
762-
fakePodControl := &controller.FakePodControl{}
765+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
766+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
767+
fakePodControl := &control.FakePodControl{}
763768
ctr.PodControl = fakePodControl
764769
fakeServiceControl := &control.FakeServiceControl{}
765770
ctr.ServiceControl = fakeServiceControl

pkg/controller.v1/tensorflow/pod_test.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import (
2424
kubeclientset "k8s.io/client-go/kubernetes"
2525
"k8s.io/client-go/rest"
2626
"k8s.io/client-go/tools/record"
27-
"k8s.io/kubernetes/pkg/controller"
2827
batchv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1"
2928
volcanoclient "volcano.sh/volcano/pkg/client/clientset/versioned"
3029

3130
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
3231
"github.com/kubeflow/common/pkg/controller.v1/common"
32+
"github.com/kubeflow/common/pkg/controller.v1/control"
3333
"github.com/kubeflow/tf-operator/cmd/tf-operator.v1/app/options"
3434
tfv1 "github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1"
3535
tfjobclientset "github.com/kubeflow/tf-operator/pkg/client/clientset/versioned"
@@ -62,7 +62,8 @@ func TestAddPod(t *testing.T) {
6262
},
6363
}
6464
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
65-
ctr, _, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
65+
ctr, _, _ := newTFController(config, kubeClientSet,
66+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
6667
ctr.tfJobInformerSynced = testutil.AlwaysReady
6768
ctr.PodInformerSynced = testutil.AlwaysReady
6869
ctr.ServiceInformerSynced = testutil.AlwaysReady
@@ -181,7 +182,8 @@ func TestClusterSpec(t *testing.T) {
181182
},
182183
}
183184
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
184-
ctr, _, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
185+
ctr, _, _ := newTFController(config, kubeClientSet,
186+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
185187
ctr.tfJobInformerSynced = testutil.AlwaysReady
186188
ctr.PodInformerSynced = testutil.AlwaysReady
187189
ctr.ServiceInformerSynced = testutil.AlwaysReady
@@ -340,8 +342,9 @@ func TestExitCode(t *testing.T) {
340342
},
341343
}
342344
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
343-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
344-
fakePodControl := &controller.FakePodControl{}
345+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
346+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
347+
fakePodControl := &control.FakePodControl{}
345348
ctr.PodControl = fakePodControl
346349
ctr.tfJobInformerSynced = testutil.AlwaysReady
347350
ctr.PodInformerSynced = testutil.AlwaysReady
@@ -427,8 +430,9 @@ func TestScaleDown(t *testing.T) {
427430
},
428431
}
429432
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
430-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
431-
fakePodControl := &controller.FakePodControl{}
433+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
434+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
435+
fakePodControl := &control.FakePodControl{}
432436
ctr.PodControl = fakePodControl
433437
ctr.Recorder = &record.FakeRecorder{}
434438
ctr.tfJobInformerSynced = testutil.AlwaysReady
@@ -510,8 +514,9 @@ func TestScaleUp(t *testing.T) {
510514
},
511515
}
512516
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
513-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
514-
fakePodControl := &controller.FakePodControl{}
517+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
518+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
519+
fakePodControl := &control.FakePodControl{}
515520
ctr.PodControl = fakePodControl
516521
ctr.tfJobInformerSynced = testutil.AlwaysReady
517522
ctr.PodInformerSynced = testutil.AlwaysReady
@@ -671,7 +676,8 @@ func TestIsWorker0Completed(t *testing.T) {
671676
},
672677
}
673678
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
674-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
679+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
680+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
675681
ctr.tfJobInformerSynced = testutil.AlwaysReady
676682
ctr.PodInformerSynced = testutil.AlwaysReady
677683
ctr.ServiceInformerSynced = testutil.AlwaysReady

pkg/controller.v1/tensorflow/status_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ import (
2525
"k8s.io/client-go/rest"
2626
"k8s.io/client-go/tools/cache"
2727
"k8s.io/client-go/tools/record"
28-
"k8s.io/kubernetes/pkg/controller"
2928

3029
batchv1beta1 "volcano.sh/volcano/pkg/apis/scheduling/v1beta1"
3130
volcanoclient "volcano.sh/volcano/pkg/client/clientset/versioned"
3231

3332
commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
33+
"github.com/kubeflow/common/pkg/controller.v1/control"
3434
"github.com/kubeflow/tf-operator/cmd/tf-operator.v1/app/options"
3535
tfv1 "github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1"
3636
tfjobclientset "github.com/kubeflow/tf-operator/pkg/client/clientset/versioned"
@@ -63,7 +63,8 @@ func TestFailed(t *testing.T) {
6363
},
6464
}
6565
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
66-
ctr, _, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
66+
ctr, _, _ := newTFController(config, kubeClientSet,
67+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
6768
ctr.tfJobInformerSynced = testutil.AlwaysReady
6869
ctr.PodInformerSynced = testutil.AlwaysReady
6970
ctr.ServiceInformerSynced = testutil.AlwaysReady
@@ -449,8 +450,9 @@ func TestStatus(t *testing.T) {
449450
},
450451
}
451452
tfJobClientSet := tfjobclientset.NewForConfigOrDie(config)
452-
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet, volcanoClientSet, tfJobClientSet, controller.NoResyncPeriodFunc, options.ServerOption{})
453-
fakePodControl := &controller.FakePodControl{}
453+
ctr, kubeInformerFactory, _ := newTFController(config, kubeClientSet,
454+
volcanoClientSet, tfJobClientSet, 0, options.ServerOption{})
455+
fakePodControl := &control.FakePodControl{}
454456
ctr.PodControl = fakePodControl
455457
ctr.Recorder = &record.FakeRecorder{}
456458
ctr.tfJobInformerSynced = testutil.AlwaysReady

0 commit comments

Comments
 (0)