@@ -31,6 +31,7 @@ import (
31
31
restclient "k8s.io/client-go/rest"
32
32
"k8s.io/client-go/tools/cache"
33
33
kubeapiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
34
+ "k8s.io/kubernetes/pkg/controller/podgc"
34
35
"k8s.io/kubernetes/pkg/controller/volume/attachdetach"
35
36
volumecache "k8s.io/kubernetes/pkg/controller/volume/attachdetach/cache"
36
37
"k8s.io/kubernetes/pkg/controller/volume/persistentvolume"
@@ -326,7 +327,7 @@ func waitForPodFuncInDSWP(t *testing.T, dswp volumecache.DesiredStateOfWorld, ch
326
327
}
327
328
}
328
329
329
- func createAdClients (ctx context.Context , t * testing.T , server * kubeapiservertesting.TestServer , syncPeriod time.Duration , timers attachdetach.TimerConfig ) (* clientset.Clientset , attachdetach.AttachDetachController , * persistentvolume.PersistentVolumeController , clientgoinformers.SharedInformerFactory ) {
330
+ func createAdClients (ctx context.Context , t * testing.T , server * kubeapiservertesting.TestServer , syncPeriod time.Duration , timers attachdetach.TimerConfig ) (* clientset.Clientset , attachdetach.AttachDetachController , * persistentvolume.PersistentVolumeController , * podgc. PodGCController , clientgoinformers.SharedInformerFactory ) {
330
331
config := restclient .CopyConfig (server .ClientConfig )
331
332
config .QPS = 1000000
332
333
config .Burst = 1000000
@@ -383,11 +384,20 @@ func createAdClients(ctx context.Context, t *testing.T, server *kubeapiservertes
383
384
NodeInformer : informers .Core ().V1 ().Nodes (),
384
385
EnableDynamicProvisioning : false ,
385
386
}
387
+ podgcCtrl := podgc .NewPodGCInternal (
388
+ ctx ,
389
+ testClient ,
390
+ informers .Core ().V1 ().Pods (),
391
+ informers .Core ().V1 ().Nodes (),
392
+ 0 ,
393
+ 500 * time .Millisecond ,
394
+ time .Second ,
395
+ )
386
396
pvCtrl , err := persistentvolume .NewController (ctx , params )
387
397
if err != nil {
388
398
t .Fatalf ("Failed to create PV controller: %v" , err )
389
399
}
390
- return testClient , ctrl , pvCtrl , informers
400
+ return testClient , ctrl , pvCtrl , podgcCtrl , informers
391
401
}
392
402
393
403
// Via integration test we can verify that if pod add
0 commit comments