@@ -29,12 +29,12 @@ import (
29
29
"k8s.io/apimachinery/pkg/types"
30
30
"k8s.io/client-go/util/flowcontrol"
31
31
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
32
- . "k8s.io/kubernetes/pkg/kubelet/container"
32
+ kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
33
33
"k8s.io/kubernetes/pkg/volume"
34
34
)
35
35
36
36
type FakePod struct {
37
- Pod * Pod
37
+ Pod * kubecontainer. Pod
38
38
NetnsPath string
39
39
}
40
40
@@ -44,14 +44,14 @@ type FakeRuntime struct {
44
44
CalledFunctions []string
45
45
PodList []* FakePod
46
46
AllPodList []* FakePod
47
- ImageList []Image
47
+ ImageList []kubecontainer. Image
48
48
APIPodStatus v1.PodStatus
49
- PodStatus PodStatus
49
+ PodStatus kubecontainer. PodStatus
50
50
StartedPods []string
51
51
KilledPods []string
52
52
StartedContainers []string
53
53
KilledContainers []string
54
- RuntimeStatus * RuntimeStatus
54
+ RuntimeStatus * kubecontainer. RuntimeStatus
55
55
VersionInfo string
56
56
APIVersionInfo string
57
57
RuntimeType string
@@ -66,10 +66,10 @@ type FakeStreamingRuntime struct {
66
66
* FakeRuntime
67
67
}
68
68
69
- var _ StreamingRuntime = & FakeStreamingRuntime {}
69
+ var _ kubecontainer. StreamingRuntime = & FakeStreamingRuntime {}
70
70
71
71
// FakeRuntime should implement Runtime.
72
- var _ Runtime = & FakeRuntime {}
72
+ var _ kubecontainer. Runtime = & FakeRuntime {}
73
73
74
74
type FakeVersion struct {
75
75
Version string
@@ -90,18 +90,18 @@ func (fv *FakeVersion) Compare(other string) (int, error) {
90
90
}
91
91
92
92
type podsGetter interface {
93
- GetPods (bool ) ([]* Pod , error )
93
+ GetPods (bool ) ([]* kubecontainer. Pod , error )
94
94
}
95
95
96
96
type FakeRuntimeCache struct {
97
97
getter podsGetter
98
98
}
99
99
100
- func NewFakeRuntimeCache (getter podsGetter ) RuntimeCache {
100
+ func NewFakeRuntimeCache (getter podsGetter ) kubecontainer. RuntimeCache {
101
101
return & FakeRuntimeCache {getter }
102
102
}
103
103
104
- func (f * FakeRuntimeCache ) GetPods () ([]* Pod , error ) {
104
+ func (f * FakeRuntimeCache ) GetPods () ([]* kubecontainer. Pod , error ) {
105
105
return f .getter .GetPods (false )
106
106
}
107
107
@@ -177,35 +177,35 @@ func (f *FakeRuntime) Type() string {
177
177
return f .RuntimeType
178
178
}
179
179
180
- func (f * FakeRuntime ) Version () (Version , error ) {
180
+ func (f * FakeRuntime ) Version () (kubecontainer. Version , error ) {
181
181
f .Lock ()
182
182
defer f .Unlock ()
183
183
184
184
f .CalledFunctions = append (f .CalledFunctions , "Version" )
185
185
return & FakeVersion {Version : f .VersionInfo }, f .Err
186
186
}
187
187
188
- func (f * FakeRuntime ) APIVersion () (Version , error ) {
188
+ func (f * FakeRuntime ) APIVersion () (kubecontainer. Version , error ) {
189
189
f .Lock ()
190
190
defer f .Unlock ()
191
191
192
192
f .CalledFunctions = append (f .CalledFunctions , "APIVersion" )
193
193
return & FakeVersion {Version : f .APIVersionInfo }, f .Err
194
194
}
195
195
196
- func (f * FakeRuntime ) Status () (* RuntimeStatus , error ) {
196
+ func (f * FakeRuntime ) Status () (* kubecontainer. RuntimeStatus , error ) {
197
197
f .Lock ()
198
198
defer f .Unlock ()
199
199
200
200
f .CalledFunctions = append (f .CalledFunctions , "Status" )
201
201
return f .RuntimeStatus , f .StatusErr
202
202
}
203
203
204
- func (f * FakeRuntime ) GetPods (all bool ) ([]* Pod , error ) {
204
+ func (f * FakeRuntime ) GetPods (all bool ) ([]* kubecontainer. Pod , error ) {
205
205
f .Lock ()
206
206
defer f .Unlock ()
207
207
208
- var pods []* Pod
208
+ var pods []* kubecontainer. Pod
209
209
210
210
f .CalledFunctions = append (f .CalledFunctions , "GetPods" )
211
211
if all {
@@ -220,7 +220,7 @@ func (f *FakeRuntime) GetPods(all bool) ([]*Pod, error) {
220
220
return pods , f .Err
221
221
}
222
222
223
- func (f * FakeRuntime ) SyncPod (pod * v1.Pod , _ * PodStatus , _ []v1.Secret , backOff * flowcontrol.Backoff ) (result PodSyncResult ) {
223
+ func (f * FakeRuntime ) SyncPod (pod * v1.Pod , _ * kubecontainer. PodStatus , _ []v1.Secret , backOff * flowcontrol.Backoff ) (result kubecontainer. PodSyncResult ) {
224
224
f .Lock ()
225
225
defer f .Unlock ()
226
226
@@ -236,7 +236,7 @@ func (f *FakeRuntime) SyncPod(pod *v1.Pod, _ *PodStatus, _ []v1.Secret, backOff
236
236
return
237
237
}
238
238
239
- func (f * FakeRuntime ) KillPod (pod * v1.Pod , runningPod Pod , gracePeriodOverride * int64 ) error {
239
+ func (f * FakeRuntime ) KillPod (pod * v1.Pod , runningPod kubecontainer. Pod , gracePeriodOverride * int64 ) error {
240
240
f .Lock ()
241
241
defer f .Unlock ()
242
242
@@ -274,7 +274,7 @@ func (f *FakeRuntime) KillContainerInPod(container v1.Container, pod *v1.Pod) er
274
274
return f .Err
275
275
}
276
276
277
- func (f * FakeRuntime ) GetPodStatus (uid types.UID , name , namespace string ) (* PodStatus , error ) {
277
+ func (f * FakeRuntime ) GetPodStatus (uid types.UID , name , namespace string ) (* kubecontainer. PodStatus , error ) {
278
278
f .Lock ()
279
279
defer f .Unlock ()
280
280
@@ -283,23 +283,23 @@ func (f *FakeRuntime) GetPodStatus(uid types.UID, name, namespace string) (*PodS
283
283
return & status , f .Err
284
284
}
285
285
286
- func (f * FakeRuntime ) GetContainerLogs (_ context.Context , pod * v1.Pod , containerID ContainerID , logOptions * v1.PodLogOptions , stdout , stderr io.Writer ) (err error ) {
286
+ func (f * FakeRuntime ) GetContainerLogs (_ context.Context , pod * v1.Pod , containerID kubecontainer. ContainerID , logOptions * v1.PodLogOptions , stdout , stderr io.Writer ) (err error ) {
287
287
f .Lock ()
288
288
defer f .Unlock ()
289
289
290
290
f .CalledFunctions = append (f .CalledFunctions , "GetContainerLogs" )
291
291
return f .Err
292
292
}
293
293
294
- func (f * FakeRuntime ) PullImage (image ImageSpec , pullSecrets []v1.Secret , podSandboxConfig * runtimeapi.PodSandboxConfig ) (string , error ) {
294
+ func (f * FakeRuntime ) PullImage (image kubecontainer. ImageSpec , pullSecrets []v1.Secret , podSandboxConfig * runtimeapi.PodSandboxConfig ) (string , error ) {
295
295
f .Lock ()
296
296
defer f .Unlock ()
297
297
298
298
f .CalledFunctions = append (f .CalledFunctions , "PullImage" )
299
299
return image .Image , f .Err
300
300
}
301
301
302
- func (f * FakeRuntime ) GetImageRef (image ImageSpec ) (string , error ) {
302
+ func (f * FakeRuntime ) GetImageRef (image kubecontainer. ImageSpec ) (string , error ) {
303
303
f .Lock ()
304
304
defer f .Unlock ()
305
305
@@ -312,15 +312,15 @@ func (f *FakeRuntime) GetImageRef(image ImageSpec) (string, error) {
312
312
return "" , f .InspectErr
313
313
}
314
314
315
- func (f * FakeRuntime ) ListImages () ([]Image , error ) {
315
+ func (f * FakeRuntime ) ListImages () ([]kubecontainer. Image , error ) {
316
316
f .Lock ()
317
317
defer f .Unlock ()
318
318
319
319
f .CalledFunctions = append (f .CalledFunctions , "ListImages" )
320
320
return f .ImageList , f .Err
321
321
}
322
322
323
- func (f * FakeRuntime ) RemoveImage (image ImageSpec ) error {
323
+ func (f * FakeRuntime ) RemoveImage (image kubecontainer. ImageSpec ) error {
324
324
f .Lock ()
325
325
defer f .Unlock ()
326
326
@@ -337,39 +337,39 @@ func (f *FakeRuntime) RemoveImage(image ImageSpec) error {
337
337
return f .Err
338
338
}
339
339
340
- func (f * FakeRuntime ) GarbageCollect (gcPolicy ContainerGCPolicy , ready bool , evictNonDeletedPods bool ) error {
340
+ func (f * FakeRuntime ) GarbageCollect (gcPolicy kubecontainer. ContainerGCPolicy , ready bool , evictNonDeletedPods bool ) error {
341
341
f .Lock ()
342
342
defer f .Unlock ()
343
343
344
344
f .CalledFunctions = append (f .CalledFunctions , "GarbageCollect" )
345
345
return f .Err
346
346
}
347
347
348
- func (f * FakeRuntime ) DeleteContainer (containerID ContainerID ) error {
348
+ func (f * FakeRuntime ) DeleteContainer (containerID kubecontainer. ContainerID ) error {
349
349
f .Lock ()
350
350
defer f .Unlock ()
351
351
352
352
f .CalledFunctions = append (f .CalledFunctions , "DeleteContainer" )
353
353
return f .Err
354
354
}
355
355
356
- func (f * FakeRuntime ) ImageStats () (* ImageStats , error ) {
356
+ func (f * FakeRuntime ) ImageStats () (* kubecontainer. ImageStats , error ) {
357
357
f .Lock ()
358
358
defer f .Unlock ()
359
359
360
360
f .CalledFunctions = append (f .CalledFunctions , "ImageStats" )
361
361
return nil , f .Err
362
362
}
363
363
364
- func (f * FakeStreamingRuntime ) GetExec (id ContainerID , cmd []string , stdin , stdout , stderr , tty bool ) (* url.URL , error ) {
364
+ func (f * FakeStreamingRuntime ) GetExec (id kubecontainer. ContainerID , cmd []string , stdin , stdout , stderr , tty bool ) (* url.URL , error ) {
365
365
f .Lock ()
366
366
defer f .Unlock ()
367
367
368
368
f .CalledFunctions = append (f .CalledFunctions , "GetExec" )
369
369
return & url.URL {Host : FakeHost }, f .Err
370
370
}
371
371
372
- func (f * FakeStreamingRuntime ) GetAttach (id ContainerID , stdin , stdout , stderr , tty bool ) (* url.URL , error ) {
372
+ func (f * FakeStreamingRuntime ) GetAttach (id kubecontainer. ContainerID , stdin , stdout , stderr , tty bool ) (* url.URL , error ) {
373
373
f .Lock ()
374
374
defer f .Unlock ()
375
375
@@ -391,13 +391,13 @@ type FakeContainerCommandRunner struct {
391
391
Err error
392
392
393
393
// actual values when invoked
394
- ContainerID ContainerID
394
+ ContainerID kubecontainer. ContainerID
395
395
Cmd []string
396
396
}
397
397
398
- var _ ContainerCommandRunner = & FakeContainerCommandRunner {}
398
+ var _ kubecontainer. ContainerCommandRunner = & FakeContainerCommandRunner {}
399
399
400
- func (f * FakeContainerCommandRunner ) RunInContainer (containerID ContainerID , cmd []string , timeout time.Duration ) ([]byte , error ) {
400
+ func (f * FakeContainerCommandRunner ) RunInContainer (containerID kubecontainer. ContainerID , cmd []string , timeout time.Duration ) ([]byte , error ) {
401
401
// record invoked values
402
402
f .ContainerID = containerID
403
403
f .Cmd = cmd
0 commit comments