Repository: knative/serving
Pull request #13301 (2022-09-12 22:41:22)

Update to use k8s.io/utils/clock package
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>

Missed a few on #13300 

knative-prow[bot]: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/serving/pull/13301#" title="Author self-approved">psschwei</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fserving).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[pkg/OWNERS](https://github.com/knative/serving/blob/main/pkg/OWNERS)~~ [psschwei]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
codecov[bot]: # [Codecov](https://codecov.io/gh/knative/serving/pull/13301?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) Report
> Merging [#13301](https://codecov.io/gh/knative/serving/pull/13301?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) (d9cebfe) into [main](https://codecov.io/gh/knative/serving/commit/67255a6d0acbf9bb4442879dbde802af75ab695f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) (67255a6) will **increase** coverage by `0.00%`.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##             main   #13301   +/-   ##
=======================================
  Coverage   86.49%   86.50%           
=======================================
  Files         196      196           
  Lines       14526    14526           
=======================================
+ Hits        12564    12565    +1     
- Misses       1662     1663    +1     
+ Partials      300      298    -2     
```


| [Impacted Files](https://codecov.io/gh/knative/serving/pull/13301?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) | Coverage Δ | |
|---|---|---|
| [pkg/autoscaler/metrics/collector.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL2F1dG9zY2FsZXIvbWV0cmljcy9jb2xsZWN0b3IuZ28=) | `98.53% <ø> (ø)` | |
| [pkg/reconciler/configuration/configuration.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL3JlY29uY2lsZXIvY29uZmlndXJhdGlvbi9jb25maWd1cmF0aW9uLmdv) | `85.20% <ø> (ø)` | |
| [pkg/reconciler/configuration/controller.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL3JlY29uY2lsZXIvY29uZmlndXJhdGlvbi9jb250cm9sbGVyLmdv) | `100.00% <ø> (ø)` | |
| [pkg/reconciler/labeler/accessors.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL3JlY29uY2lsZXIvbGFiZWxlci9hY2Nlc3NvcnMuZ28=) | `88.13% <ø> (ø)` | |
| [pkg/reconciler/labeler/controller.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL3JlY29uY2lsZXIvbGFiZWxlci9jb250cm9sbGVyLmdv) | `100.00% <ø> (ø)` | |
| [pkg/reconciler/route/controller.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL3JlY29uY2lsZXIvcm91dGUvY29udHJvbGxlci5nbw==) | `100.00% <ø> (ø)` | |
| [pkg/reconciler/route/route.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL3JlY29uY2lsZXIvcm91dGUvcm91dGUuZ28=) | `80.06% <ø> (ø)` | |
| [pkg/activator/net/revision\_backends.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL2FjdGl2YXRvci9uZXQvcmV2aXNpb25fYmFja2VuZHMuZ28=) | `92.19% <0.00%> (-0.58%)` | :arrow_down: |
| [pkg/autoscaler/statserver/server.go](https://codecov.io/gh/knative/serving/pull/13301/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-cGtnL2F1dG9zY2FsZXIvc3RhdHNlcnZlci9zZXJ2ZXIuZ28=) | `77.77% <0.00%> (+2.22%)` | :arrow_up: |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative)

dprotaso: /lgtm
/approve

Yeah running golangci-lint doesn't print all errors by default which is annoying - I had to keep re-running the tool until all the warnings went away
knative-prow[bot]: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/serving/pull/13301#issuecomment-1245521467" title="Approved">dprotaso</a>*, *<a href="https://github.com/knative/serving/pull/13301#" title="Author self-approved">psschwei</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fserving).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[pkg/OWNERS](https://github.com/knative/serving/blob/main/pkg/OWNERS)~~ [dprotaso,psschwei]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/pkg/autoscaler/fake/fakes.go b/pkg/autoscaler/fake/fakes.go
index 60b649db2..7a3dd282d 100644
--- a/pkg/autoscaler/fake/fakes.go
+++ b/pkg/autoscaler/fake/fakes.go
@@ -19,7 +19,8 @@ package fake
 import (
 	"time"
 
-	"k8s.io/apimachinery/pkg/util/clock"
+	"k8s.io/utils/clock"
+	clocktest "k8s.io/utils/clock/testing"
 )
 
 // A ManualTickProvider holds a channel that delivers `ticks' of a clock at intervals.
@@ -46,7 +47,7 @@ func (mtp *ManualTickProvider) Stop() {}
 // Clock is K8s clock.Clock but it overrides tick provider
 // with ManualTickProvider above.
 type Clock struct {
-	*clock.FakeClock
+	*clocktest.FakeClock
 	TP *ManualTickProvider
 }
 
diff --git a/pkg/autoscaler/metrics/collector.go b/pkg/autoscaler/metrics/collector.go
index 5f13f27f5..9719fac38 100644
--- a/pkg/autoscaler/metrics/collector.go
+++ b/pkg/autoscaler/metrics/collector.go
@@ -23,7 +23,7 @@ import (
 
 	"go.uber.org/zap"
 	"k8s.io/apimachinery/pkg/types"
-	"k8s.io/apimachinery/pkg/util/clock"
+	"k8s.io/utils/clock"
 	"knative.dev/pkg/logging/logkey"
 	"knative.dev/serving/pkg/apis/autoscaling"
 	autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1"
@@ -87,7 +87,7 @@ type MetricCollector struct {
 	logger *zap.SugaredLogger
 
 	statsScraperFactory StatsScraperFactory
-	clock               clock.Clock
+	clock               clock.WithTicker
 
 	collectionsMutex sync.RWMutex
 	collections      map[types.NamespacedName]*collection
@@ -262,7 +262,7 @@ func (c *collection) getScraper() StatsScraper {
 
 // newCollection creates a new collection, which uses the given scraper to
 // collect stats every scrapeTickInterval.
-func newCollection(metric *autoscalingv1alpha1.Metric, scraper StatsScraper, clock clock.Clock,
+func newCollection(metric *autoscalingv1alpha1.Metric, scraper StatsScraper, clock clock.WithTicker,
 	callback func(types.NamespacedName), logger *zap.SugaredLogger) *collection {
 	// Pick the constructor to use to build the buckets.
 	// NB: this relies on the fact that aggregation algorithm is set on annotation of revision
diff --git a/pkg/reconciler/configuration/configuration.go b/pkg/reconciler/configuration/configuration.go
index ecda5aa71..d7081b27c 100644
--- a/pkg/reconciler/configuration/configuration.go
+++ b/pkg/reconciler/configuration/configuration.go
@@ -29,7 +29,7 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/labels"
 	"k8s.io/apimachinery/pkg/selection"
-	"k8s.io/apimachinery/pkg/util/clock"
+	"k8s.io/utils/clock"
 
 	"knative.dev/pkg/controller"
 	"knative.dev/pkg/kmp"
diff --git a/pkg/reconciler/configuration/controller.go b/pkg/reconciler/configuration/controller.go
index e7b63976d..31d27c6ea 100644
--- a/pkg/reconciler/configuration/controller.go
+++ b/pkg/reconciler/configuration/controller.go
@@ -19,8 +19,8 @@ package configuration
 import (
 	"context"
 
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/client-go/tools/cache"
+	"k8s.io/utils/clock"
 	"knative.dev/pkg/configmap"
 	"knative.dev/pkg/controller"
 	"knative.dev/pkg/logging"
diff --git a/pkg/reconciler/labeler/accessors.go b/pkg/reconciler/labeler/accessors.go
index 194ac3b7e..3e982c6b7 100644
--- a/pkg/reconciler/labeler/accessors.go
+++ b/pkg/reconciler/labeler/accessors.go
@@ -23,9 +23,9 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/labels"
 	"k8s.io/apimachinery/pkg/types"
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/apimachinery/pkg/util/sets"
 	"k8s.io/client-go/tools/cache"
+	"k8s.io/utils/clock"
 	"knative.dev/pkg/kmeta"
 
 	"knative.dev/pkg/tracker"
diff --git a/pkg/reconciler/labeler/controller.go b/pkg/reconciler/labeler/controller.go
index 211fc365e..3585aab86 100644
--- a/pkg/reconciler/labeler/controller.go
+++ b/pkg/reconciler/labeler/controller.go
@@ -19,8 +19,8 @@ package labeler
 import (
 	"context"
 
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/client-go/tools/cache"
+	"k8s.io/utils/clock"
 
 	v1 "knative.dev/serving/pkg/apis/serving/v1"
 	servingclient "knative.dev/serving/pkg/client/injection/client"
diff --git a/pkg/reconciler/route/controller.go b/pkg/reconciler/route/controller.go
index 6f72831ef..e9f621ae6 100644
--- a/pkg/reconciler/route/controller.go
+++ b/pkg/reconciler/route/controller.go
@@ -31,8 +31,8 @@ import (
 	routeinformer "knative.dev/serving/pkg/client/injection/informers/serving/v1/route"
 	routereconciler "knative.dev/serving/pkg/client/injection/reconciler/serving/v1/route"
 
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/client-go/tools/cache"
+	"k8s.io/utils/clock"
 	netcfg "knative.dev/networking/pkg/config"
 	"knative.dev/pkg/configmap"
 	"knative.dev/pkg/controller"
diff --git a/pkg/reconciler/route/route.go b/pkg/reconciler/route/route.go
index d3c845a7e..d171b5cc0 100644
--- a/pkg/reconciler/route/route.go
+++ b/pkg/reconciler/route/route.go
@@ -28,10 +28,10 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	kubelabels "k8s.io/apimachinery/pkg/labels"
 	"k8s.io/apimachinery/pkg/runtime/schema"
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/apimachinery/pkg/util/sets"
 	"k8s.io/client-go/kubernetes"
 	corev1listers "k8s.io/client-go/listers/core/v1"
+	"k8s.io/utils/clock"
 
 	"knative.dev/networking/pkg/apis/networking"
 	netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"


Test patch:
diff --git a/pkg/autoscaler/metrics/collector_test.go b/pkg/autoscaler/metrics/collector_test.go
index 61388fb81..50458764d 100644
--- a/pkg/autoscaler/metrics/collector_test.go
+++ b/pkg/autoscaler/metrics/collector_test.go
@@ -27,8 +27,8 @@ import (
 
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/types"
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/apimachinery/pkg/util/wait"
+	clocktest "k8s.io/utils/clock/testing"
 
 	. "knative.dev/pkg/logging/testing"
 	"knative.dev/serving/pkg/apis/autoscaling"
@@ -146,7 +146,7 @@ func TestMetricCollectorScraperMovingTime(t *testing.T) {
 	}
 	now := time.Now()
 	fc := fake.Clock{
-		FakeClock: clock.NewFakeClock(now),
+		FakeClock: clocktest.NewFakeClock(now),
 		TP:        mtp,
 	}
 	metricKey := types.NamespacedName{Namespace: defaultNamespace, Name: defaultName}
@@ -222,7 +222,7 @@ func TestMetricCollectorScraper(t *testing.T) {
 	}
 	now := time.Now()
 	fc := fake.Clock{
-		FakeClock: clock.NewFakeClock(now),
+		FakeClock: clocktest.NewFakeClock(now),
 		TP:        mtp,
 	}
 	metricKey := types.NamespacedName{Namespace: defaultNamespace, Name: defaultName}
@@ -321,7 +321,7 @@ func TestMetricCollectorNoScraper(t *testing.T) {
 	}
 	now := time.Now()
 	fc := fake.Clock{
-		FakeClock: clock.NewFakeClock(now),
+		FakeClock: clocktest.NewFakeClock(now),
 		TP:        mtp,
 	}
 	metricKey := types.NamespacedName{Namespace: defaultNamespace, Name: defaultName}
@@ -452,7 +452,7 @@ func TestMetricCollectorRecord(t *testing.T) {
 		Channel: make(chan time.Time),
 	}
 	fc := fake.Clock{
-		FakeClock: clock.NewFakeClock(now),
+		FakeClock: clocktest.NewFakeClock(now),
 		TP:        mtp,
 	}
 	coll.clock = fc
@@ -560,7 +560,7 @@ func TestMetricCollectorError(t *testing.T) {
 			}
 			now := time.Now()
 			fc := fake.Clock{
-				FakeClock: clock.NewFakeClock(now),
+				FakeClock: clocktest.NewFakeClock(now),
 				TP:        mtp,
 			}
 			coll := NewMetricCollector(factory, logger)
diff --git a/pkg/reconciler/configuration/configuration_test.go b/pkg/reconciler/configuration/configuration_test.go
index e9ba36714..7b0afde2a 100644
--- a/pkg/reconciler/configuration/configuration_test.go
+++ b/pkg/reconciler/configuration/configuration_test.go
@@ -30,8 +30,9 @@ import (
 	apierrs "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"
 	clientgotesting "k8s.io/client-go/testing"
+	"k8s.io/utils/clock"
+	clocktest "k8s.io/utils/clock/testing"
 	duckv1 "knative.dev/pkg/apis/duck/v1"
 	"knative.dev/pkg/configmap"
 	"knative.dev/pkg/controller"
@@ -64,7 +65,7 @@ var (
 
 // This is heavily based on the way the OpenShift Ingress controller tests its reconciliation method.
 func TestReconcile(t *testing.T) {
-	testClock = clock.NewFakePassiveClock(time.Now())
+	testClock = clocktest.NewFakePassiveClock(time.Now())
 	testCtx = context.Background()
 	retryAttempted := false
 
diff --git a/pkg/reconciler/gc/gc_test.go b/pkg/reconciler/gc/gc_test.go
index 2f516f9c0..d6ae5f579 100644
--- a/pkg/reconciler/gc/gc_test.go
+++ b/pkg/reconciler/gc/gc_test.go
@@ -22,8 +22,9 @@ import (
 
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-	"k8s.io/apimachinery/pkg/util/clock"
+
 	clientgotesting "k8s.io/client-go/testing"
+	clocktest "k8s.io/utils/clock/testing"
 	duckv1 "knative.dev/pkg/apis/duck/v1"
 	"knative.dev/pkg/ptr"
 	v1 "knative.dev/serving/pkg/apis/serving/v1"
@@ -62,7 +63,7 @@ func TestCollectMin(t *testing.T) {
 	old := now.Add(-11 * time.Minute)
 	older := now.Add(-12 * time.Minute)
 	oldest := now.Add(-13 * time.Minute)
-	fc := clock.NewFakePassiveClock(now)
+	fc := clocktest.NewFakePassiveClock(now)
 
 	table := []struct {
 		name        string
@@ -226,7 +227,7 @@ func TestCollectMax(t *testing.T) {
 	old := now.Add(-11 * time.Minute)
 	older := now.Add(-12 * time.Minute)
 	oldest := now.Add(-13 * time.Minute)
-	fc := clock.NewFakePassiveClock(now)
+	fc := clocktest.NewFakePassiveClock(now)
 
 	table := []struct {
 		name        string
@@ -326,7 +327,7 @@ func TestCollectSettings(t *testing.T) {
 	old := now.Add(-11 * time.Minute)
 	older := now.Add(-12 * time.Minute)
 	oldest := now.Add(-13 * time.Minute)
-	fc := clock.NewFakePassiveClock(now)
+	fc := clocktest.NewFakePassiveClock(now)
 
 	cfg := cfg("settings-test", "foo", 5556,
 		WithLatestCreated("5556"),
@@ -411,7 +412,7 @@ func TestGCInOrder(t *testing.T) {
 	old3 := now.Add(-13 * time.Minute)
 	old4 := now.Add(-14 * time.Minute)
 	old5 := now.Add(-15 * time.Minute)
-	fc := clock.NewFakePassiveClock(now)
+	fc := clocktest.NewFakePassiveClock(now)
 
 	cfg := cfg("gc-order-test", "foo", 5557,
 		WithLatestCreated("5557"),
diff --git a/pkg/reconciler/gc/reconciler_test.go b/pkg/reconciler/gc/reconciler_test.go
index 7439bd37d..5bf753b32 100644
--- a/pkg/reconciler/gc/reconciler_test.go
+++ b/pkg/reconciler/gc/reconciler_test.go
@@ -23,8 +23,8 @@ import (
 
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
-	"k8s.io/apimachinery/pkg/util/clock"
 	clientgotesting "k8s.io/client-go/testing"
+	clocktest "k8s.io/utils/clock/testing"
 
 	"knative.dev/pkg/configmap"
 	"knative.dev/pkg/controller"
@@ -64,7 +64,7 @@ func TestGCReconcile(t *testing.T) {
 			},
 		}}
 
-	fc := clock.NewFakePassiveClock(time.Now())
+	fc := clocktest.NewFakePassiveClock(time.Now())
 	table := TableTest{{
 		Name: "delete oldest, keep two V2",
 		Objects: []runtime.Object{
diff --git a/pkg/reconciler/labeler/labeler_test.go b/pkg/reconciler/labeler/labeler_test.go
index f3621d825..da0d82aee 100644
--- a/pkg/reconciler/labeler/labeler_test.go
+++ b/pkg/reconciler/labeler/labeler_test.go
@@ -31,8 +31,8 @@ import (
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
-	"k8s.io/apimachinery/pkg/util/clock"
 	clientgotesting "k8s.io/client-go/testing"
+	clocktest "k8s.io/utils/clock/testing"
 	routereconciler "knative.dev/serving/pkg/client/injection/reconciler/serving/v1/route"
 
 	"knative.dev/pkg/configmap"
@@ -53,7 +53,7 @@ import (
 func TestV2Reconcile(t *testing.T) {
 	now := metav1.Now()
 	fakeTime := now.Time
-	clock := clock.NewFakePassiveClock(fakeTime)
+	clock := clocktest.NewFakePassiveClock(fakeTime)
 
 	table := TableTest{{
 		Name: "bad workqueue key",
diff --git a/pkg/reconciler/revision/table_test.go b/pkg/reconciler/revision/table_test.go
index 55ee2a922..026854c90 100644
--- a/pkg/reconciler/revision/table_test.go
+++ b/pkg/reconciler/revision/table_test.go
@@ -25,8 +25,8 @@ import (
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
-	"k8s.io/apimachinery/pkg/util/clock"
 	clientgotesting "k8s.io/client-go/testing"
+	clocktest "k8s.io/utils/clock/testing"
 
 	caching "knative.dev/caching/pkg/apis/caching/v1alpha1"
 	cachingclient "knative.dev/caching/pkg/client/injection/client"
@@ -58,7 +58,7 @@ import (
 func TestReconcile(t *testing.T) {
 	// We don't care about the value, but that it does not change,
 	// since it leads to flakes.
-	fc := clock.NewFakePassiveClock(time.Now())
+	fc := clocktest.NewFakePassiveClock(time.Now())
 
 	table := TableTest{{
 		Name: "bad workqueue key",
diff --git a/pkg/reconciler/route/reconcile_resources_test.go b/pkg/reconciler/route/reconcile_resources_test.go
index 7e8335bfb..3ad86c76c 100644
--- a/pkg/reconciler/route/reconcile_resources_test.go
+++ b/pkg/reconciler/route/reconcile_resources_test.go
@@ -26,7 +26,7 @@ import (
 
 	"github.com/google/go-cmp/cmp"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-	"k8s.io/apimachinery/pkg/util/clock"
+	clocktest "k8s.io/utils/clock/testing"
 
 	"knative.dev/networking/pkg/apis/networking"
 	netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"
@@ -70,7 +70,7 @@ func TestReconcileIngressUpdateReenqueueRollout(t *testing.T) {
 		fakeCurTime      = fakeCurSecs*1_000_000_000 + fakeCurNsec // *1e9
 		allocatedTraffic = 48
 	)
-	fakeClock := clock.NewFakePassiveClock(time.Unix(fakeCurSecs, fakeCurNsec))
+	fakeClock := clocktest.NewFakePassiveClock(time.Unix(fakeCurSecs, fakeCurNsec))
 	baseCtx, _, _, _, cancel := newTestSetup(t, func(r *Reconciler) {
 		r.clock = fakeClock
 		reconciler = r
@@ -229,7 +229,7 @@ func TestReconcileIngressUpdateReenqueueRolloutAnnotation(t *testing.T) {
 		fakeCurTime      = fakeCurSecs*1_000_000_000 + fakeCurNsec // *1e9
 		allocatedTraffic = 48
 	)
-	fakeClock := clock.NewFakePassiveClock(time.Unix(fakeCurSecs, fakeCurNsec))
+	fakeClock := clocktest.NewFakePassiveClock(time.Unix(fakeCurSecs, fakeCurNsec))
 	baseCtx, _, _, _, cancel := newTestSetup(t, func(r *Reconciler) {
 		r.clock = fakeClock
 		reconciler = r
diff --git a/pkg/reconciler/route/route_test.go b/pkg/reconciler/route/route_test.go
index 2e0b1929f..dca464aea 100644
--- a/pkg/reconciler/route/route_test.go
+++ b/pkg/reconciler/route/route_test.go
@@ -43,10 +43,10 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/labels"
 	"k8s.io/apimachinery/pkg/types"
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/apimachinery/pkg/util/intstr"
 	"k8s.io/apimachinery/pkg/util/wait"
 	"k8s.io/client-go/tools/record"
+	"k8s.io/utils/clock"
 
 	"knative.dev/networking/pkg/apis/networking"
 	"knative.dev/networking/pkg/apis/networking/v1alpha1"
diff --git a/pkg/reconciler/route/table_test.go b/pkg/reconciler/route/table_test.go
index 53507213a..279a5c6d9 100644
--- a/pkg/reconciler/route/table_test.go
+++ b/pkg/reconciler/route/table_test.go
@@ -27,9 +27,9 @@ import (
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
-	"k8s.io/apimachinery/pkg/util/clock"
 	"k8s.io/apimachinery/pkg/util/intstr"
 	clientgotesting "k8s.io/client-go/testing"
+	clocktest "k8s.io/utils/clock/testing"
 
 	netapi "knative.dev/networking/pkg/apis/networking"
 	netv1alpha1 "knative.dev/networking/pkg/apis/networking/v1alpha1"
@@ -3035,7 +3035,7 @@ func NewTestReconciler(ctx context.Context, listers *Listers, cmw configmap.Watc
 		ingressLister:       listers.GetIngressLister(),
 		certificateLister:   listers.GetCertificateLister(),
 		tracker:             ctx.Value(TrackerKey).(tracker.Interface),
-		clock:               clock.NewFakePassiveClock(fakeCurTime),
+		clock:               clocktest.NewFakePassiveClock(fakeCurTime),
 		enqueueAfter:        func(interface{}, time.Duration) {},
 	}
 
diff --git a/pkg/testing/v1/revision.go b/pkg/testing/v1/revision.go
index 6a5cdfa82..19fa8a270 100644
--- a/pkg/testing/v1/revision.go
+++ b/pkg/testing/v1/revision.go
@@ -22,7 +22,7 @@ import (
 
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-	"k8s.io/apimachinery/pkg/util/clock"
+	"k8s.io/utils/clock"
 	"knative.dev/pkg/kmeta"
 	"knative.dev/serving/pkg/apis/serving"
 	v1 "knative.dev/serving/pkg/apis/serving/v1"