diff --git a/go.mod b/go.mod index 9fafef91..2757a1df 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac google.golang.org/protobuf v1.26.0 k8s.io/api v0.0.0-20210917114730-87c4113e35a1 - k8s.io/apimachinery v0.0.0-20210917114041-87fb71e8a0dc + k8s.io/apimachinery v0.0.0-20210917114042-f7f8dd8e6c3d k8s.io/klog/v2 v2.20.0 k8s.io/kube-openapi v0.0.0-20210817084001-7fbd8d59e5b8 k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a @@ -41,5 +41,5 @@ require ( replace ( k8s.io/api => k8s.io/api v0.0.0-20210917114730-87c4113e35a1 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210917114041-87fb71e8a0dc + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210917114042-f7f8dd8e6c3d ) diff --git a/go.sum b/go.sum index 25fd9605..66b18e6c 100644 --- a/go.sum +++ b/go.sum @@ -601,8 +601,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.0.0-20210917114730-87c4113e35a1 h1:c5smJttDF8/Ols66NZM4olxSwIEa3p0fklSgV9WA9K8= k8s.io/api v0.0.0-20210917114730-87c4113e35a1/go.mod h1:NPiqbLN26Y6vkL9V/SbA6NtBMKgFkdVKnh5Drj9GgMo= -k8s.io/apimachinery v0.0.0-20210917114041-87fb71e8a0dc h1:3YtYaYOdmmzFpv6HYFzod3i7+3NNlPY7zEyjt9TY1Gk= -k8s.io/apimachinery v0.0.0-20210917114041-87fb71e8a0dc/go.mod h1:CimYO7ypGwnQeTeoJQ8Jht0OVH2glTFHGy7xEhLj3sk= +k8s.io/apimachinery v0.0.0-20210917114042-f7f8dd8e6c3d h1:rzQUQhOqvkyS9IyueD34dF0WoXiIJ0gANDzmxLS1kJ8= +k8s.io/apimachinery v0.0.0-20210917114042-f7f8dd8e6c3d/go.mod h1:CimYO7ypGwnQeTeoJQ8Jht0OVH2glTFHGy7xEhLj3sk= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.20.0 h1:tlyxlSvd63k7axjhuchckaRJm+a92z5GSOrTOQY5sHw= diff --git a/plugin/pkg/client/auth/exec/exec.go b/plugin/pkg/client/auth/exec/exec.go index 7a098462..229a4cca 100644 --- a/plugin/pkg/client/auth/exec/exec.go +++ b/plugin/pkg/client/auth/exec/exec.go @@ -38,7 +38,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" - "k8s.io/apimachinery/pkg/util/clock" "k8s.io/client-go/pkg/apis/clientauthentication" "k8s.io/client-go/pkg/apis/clientauthentication/install" clientauthenticationv1 "k8s.io/client-go/pkg/apis/clientauthentication/v1" @@ -49,6 +48,7 @@ import ( "k8s.io/client-go/transport" "k8s.io/client-go/util/connrotation" "k8s.io/klog/v2" + "k8s.io/utils/clock" ) const execInfoEnv = "KUBERNETES_EXEC_INFO" diff --git a/plugin/pkg/client/auth/exec/exec_test.go b/plugin/pkg/client/auth/exec/exec_test.go index e55e845d..6698fb4e 100644 --- a/plugin/pkg/client/auth/exec/exec_test.go +++ b/plugin/pkg/client/auth/exec/exec_test.go @@ -39,10 +39,10 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/clock" "k8s.io/client-go/pkg/apis/clientauthentication" "k8s.io/client-go/tools/clientcmd/api" "k8s.io/client-go/transport" + testingclock "k8s.io/utils/clock/testing" ) var ( @@ -1421,7 +1421,7 @@ func TestInstallHintRateLimit(t *testing.T) { a.sometimes.threshold = test.threshold a.sometimes.interval = test.interval - clock := clock.NewFakeClock(time.Now()) + clock := testingclock.NewFakeClock(time.Now()) a.sometimes.clock = clock count := 0 diff --git a/rest/request.go b/rest/request.go index e5a8100b..5cc9900b 100644 --- a/rest/request.go +++ b/rest/request.go @@ -39,13 +39,13 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer/streaming" - utilclock "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/watch" restclientwatch "k8s.io/client-go/rest/watch" "k8s.io/client-go/tools/metrics" "k8s.io/client-go/util/flowcontrol" "k8s.io/klog/v2" + "k8s.io/utils/clock" ) var ( @@ -619,12 +619,12 @@ type throttleSettings struct { } type throttledLogger struct { - clock utilclock.PassiveClock + clock clock.PassiveClock settings []*throttleSettings } var globalThrottledLogger = &throttledLogger{ - clock: utilclock.RealClock{}, + clock: clock.RealClock{}, settings: []*throttleSettings{ { logLevel: 2, diff --git a/rest/request_test.go b/rest/request_test.go index dcdc0edb..ab2df1b5 100644 --- a/rest/request_test.go +++ b/rest/request_test.go @@ -45,7 +45,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer/streaming" - "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/intstr" @@ -2485,7 +2484,7 @@ func TestThrottledLogger(t *testing.T) { defer func() { globalThrottledLogger.clock = oldClock }() - clock := clock.NewFakeClock(now) + clock := testingclock.NewFakeClock(now) globalThrottledLogger.clock = clock logMessages := 0 diff --git a/tools/events/event_broadcaster.go b/tools/events/event_broadcaster.go index bde888ee..59adc417 100644 --- a/tools/events/event_broadcaster.go +++ b/tools/events/event_broadcaster.go @@ -29,7 +29,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/json" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/strategicpatch" @@ -43,6 +42,7 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/client-go/tools/record/util" "k8s.io/klog/v2" + "k8s.io/utils/clock" ) const ( diff --git a/tools/events/event_recorder.go b/tools/events/event_recorder.go index c824404e..13284374 100644 --- a/tools/events/event_recorder.go +++ b/tools/events/event_recorder.go @@ -24,12 +24,12 @@ import ( eventsv1 "k8s.io/api/events/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/clock" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/tools/record/util" "k8s.io/client-go/tools/reference" "k8s.io/klog/v2" + "k8s.io/utils/clock" ) type recorderImpl struct { diff --git a/tools/leaderelection/healthzadaptor_test.go b/tools/leaderelection/healthzadaptor_test.go index d92f1336..baf6b5ca 100644 --- a/tools/leaderelection/healthzadaptor_test.go +++ b/tools/leaderelection/healthzadaptor_test.go @@ -24,8 +24,8 @@ import ( "net/http" - "k8s.io/apimachinery/pkg/util/clock" rl "k8s.io/client-go/tools/leaderelection/resourcelock" + testingclock "k8s.io/utils/clock/testing" ) type fakeLock struct { @@ -91,7 +91,7 @@ func TestLeaderElectionHealthChecker(t *testing.T) { HolderIdentity: "healthTest", }, observedTime: current, - clock: clock.NewFakeClock(current.Add(time.Hour)), + clock: testingclock.NewFakeClock(current.Add(time.Hour)), }, }, { @@ -108,7 +108,7 @@ func TestLeaderElectionHealthChecker(t *testing.T) { HolderIdentity: "otherServer", }, observedTime: current, - clock: clock.NewFakeClock(current.Add(time.Hour)), + clock: testingclock.NewFakeClock(current.Add(time.Hour)), }, }, { @@ -125,7 +125,7 @@ func TestLeaderElectionHealthChecker(t *testing.T) { HolderIdentity: "healthTest", }, observedTime: current, - clock: clock.NewFakeClock(current), + clock: testingclock.NewFakeClock(current), }, }, { @@ -142,7 +142,7 @@ func TestLeaderElectionHealthChecker(t *testing.T) { HolderIdentity: "healthTest", }, observedTime: current, - clock: clock.NewFakeClock(current.Add(time.Minute).Add(time.Second)), + clock: testingclock.NewFakeClock(current.Add(time.Minute).Add(time.Second)), }, }, } diff --git a/tools/leaderelection/leaderelection.go b/tools/leaderelection/leaderelection.go index e7dd3252..03a13e6b 100644 --- a/tools/leaderelection/leaderelection.go +++ b/tools/leaderelection/leaderelection.go @@ -61,10 +61,10 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" rl "k8s.io/client-go/tools/leaderelection/resourcelock" + "k8s.io/utils/clock" "k8s.io/klog/v2" ) diff --git a/tools/leaderelection/leaderelection_test.go b/tools/leaderelection/leaderelection_test.go index 24095e7d..8fba412c 100644 --- a/tools/leaderelection/leaderelection_test.go +++ b/tools/leaderelection/leaderelection_test.go @@ -30,12 +30,12 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/diff" "k8s.io/client-go/kubernetes/fake" fakeclient "k8s.io/client-go/testing" rl "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/client-go/tools/record" + "k8s.io/utils/clock" ) func createLockObject(t *testing.T, objectType, namespace, name string, record *rl.LeaderElectionRecord) (obj runtime.Object) {