mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #105162 from MadhavJivrajani/migrate-clock-pkg
migrate k8s.io/apimachinery/util/clock -> k8s.io/utils/clock
This commit is contained in:
commit
bf77f8ff43
@ -25,13 +25,13 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/record/util"
|
"k8s.io/client-go/tools/record/util"
|
||||||
ref "k8s.io/client-go/tools/reference"
|
ref "k8s.io/client-go/tools/reference"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
"k8s.io/utils/clock"
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxTriesPerEvent = 12
|
const maxTriesPerEvent = 12
|
||||||
|
@ -29,11 +29,11 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
k8sruntime "k8s.io/apimachinery/pkg/runtime"
|
k8sruntime "k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
|
||||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||||
"k8s.io/client-go/kubernetes/scheme"
|
"k8s.io/client-go/kubernetes/scheme"
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
ref "k8s.io/client-go/tools/reference"
|
ref "k8s.io/client-go/tools/reference"
|
||||||
|
"k8s.io/utils/clock"
|
||||||
testclocks "k8s.io/utils/clock/testing"
|
testclocks "k8s.io/utils/clock/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ func TestNonRacyShutdown(t *testing.T) {
|
|||||||
// in a goroutine.
|
// in a goroutine.
|
||||||
|
|
||||||
caster := NewBroadcasterForTests(0)
|
caster := NewBroadcasterForTests(0)
|
||||||
clock := clock.NewFakeClock(time.Now())
|
clock := testclocks.NewFakeClock(time.Now())
|
||||||
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, caster, clock)
|
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, caster, clock)
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
@ -374,7 +374,7 @@ func TestEventf(t *testing.T) {
|
|||||||
eventBroadcaster := NewBroadcasterForTests(0)
|
eventBroadcaster := NewBroadcasterForTests(0)
|
||||||
sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)
|
sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)
|
||||||
|
|
||||||
clock := clock.NewFakeClock(time.Now())
|
clock := testclocks.NewFakeClock(time.Now())
|
||||||
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)
|
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)
|
||||||
for index, item := range table {
|
for index, item := range table {
|
||||||
clock.Step(1 * time.Second)
|
clock.Step(1 * time.Second)
|
||||||
@ -619,7 +619,7 @@ func TestEventfNoNamespace(t *testing.T) {
|
|||||||
eventBroadcaster := NewBroadcasterForTests(0)
|
eventBroadcaster := NewBroadcasterForTests(0)
|
||||||
sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)
|
sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)
|
||||||
|
|
||||||
clock := clock.NewFakeClock(time.Now())
|
clock := testclocks.NewFakeClock(time.Now())
|
||||||
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)
|
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)
|
||||||
|
|
||||||
for index, item := range table {
|
for index, item := range table {
|
||||||
@ -907,7 +907,7 @@ func TestMultiSinkCache(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eventBroadcaster := NewBroadcasterForTests(0)
|
eventBroadcaster := NewBroadcasterForTests(0)
|
||||||
clock := clock.NewFakeClock(time.Now())
|
clock := testclocks.NewFakeClock(time.Now())
|
||||||
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)
|
recorder := recorderWithFakeClock(v1.EventSource{Component: "eventTest"}, eventBroadcaster, clock)
|
||||||
|
|
||||||
sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)
|
sinkWatcher := eventBroadcaster.StartRecordingToSink(&testEvents)
|
||||||
|
@ -27,10 +27,10 @@ import (
|
|||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
"k8s.io/apimachinery/pkg/util/strategicpatch"
|
||||||
"k8s.io/client-go/util/flowcontrol"
|
"k8s.io/client-go/util/flowcontrol"
|
||||||
|
"k8s.io/utils/clock"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -26,7 +26,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
|
||||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
genericfeatures "k8s.io/apiserver/pkg/features"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
utilfc "k8s.io/apiserver/pkg/util/flowcontrol"
|
utilfc "k8s.io/apiserver/pkg/util/flowcontrol"
|
||||||
@ -37,6 +36,8 @@ import (
|
|||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
|
"k8s.io/utils/clock"
|
||||||
|
testclocks "k8s.io/utils/clock/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
/* fightTest configures a test of how API Priority and Fairness config
|
/* fightTest configures a test of how API Priority and Fairness config
|
||||||
@ -63,7 +64,7 @@ type fightTest struct {
|
|||||||
teamSize int
|
teamSize int
|
||||||
stopCh chan struct{}
|
stopCh chan struct{}
|
||||||
now time.Time
|
now time.Time
|
||||||
clk *clock.FakeClock
|
clk *testclocks.FakeClock
|
||||||
ctlrs map[bool][]utilfc.Interface
|
ctlrs map[bool][]utilfc.Interface
|
||||||
|
|
||||||
countsMutex sync.Mutex
|
countsMutex sync.Mutex
|
||||||
@ -81,7 +82,7 @@ func newFightTest(t *testing.T, loopbackConfig *rest.Config, teamSize int) *figh
|
|||||||
teamSize: teamSize,
|
teamSize: teamSize,
|
||||||
stopCh: make(chan struct{}),
|
stopCh: make(chan struct{}),
|
||||||
now: now,
|
now: now,
|
||||||
clk: clock.NewFakeClock(now),
|
clk: testclocks.NewFakeClock(now),
|
||||||
ctlrs: map[bool][]utilfc.Interface{
|
ctlrs: map[bool][]utilfc.Interface{
|
||||||
false: make([]utilfc.Interface, teamSize),
|
false: make([]utilfc.Interface, teamSize),
|
||||||
true: make([]utilfc.Interface, teamSize)},
|
true: make([]utilfc.Interface, teamSize)},
|
||||||
|
Loading…
Reference in New Issue
Block a user