Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
cac38615
Commit
cac38615
authored
Dec 29, 2016
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubecontainer: add image ref to ImageService interfaces
parent
9a428cc5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
runtime.go
pkg/kubelet/container/runtime.go
+3
-3
fake_runtime.go
pkg/kubelet/container/testing/fake_runtime.go
+5
-5
runtime_mock.go
pkg/kubelet/container/testing/runtime_mock.go
+4
-4
No files found.
pkg/kubelet/container/runtime.go
View file @
cac38615
...
@@ -146,10 +146,10 @@ type IndirectStreamingRuntime interface {
...
@@ -146,10 +146,10 @@ type IndirectStreamingRuntime interface {
type
ImageService
interface
{
type
ImageService
interface
{
// PullImage pulls an image from the network to local storage using the supplied
// PullImage pulls an image from the network to local storage using the supplied
// secrets if necessary.
// secrets if necessary.
It returns a reference (digest or ID) to the pulled image.
PullImage
(
image
ImageSpec
,
pullSecrets
[]
v1
.
Secret
)
error
PullImage
(
image
ImageSpec
,
pullSecrets
[]
v1
.
Secret
)
(
string
,
error
)
// IsImagePresent checks whether the container image is already in the local storage.
// IsImagePresent checks whether the container image is already in the local storage.
IsImagePresent
(
image
ImageSpec
)
(
bool
,
error
)
IsImagePresent
(
image
ImageSpec
)
(
string
,
error
)
// Gets all images currently on the machine.
// Gets all images currently on the machine.
ListImages
()
([]
Image
,
error
)
ListImages
()
([]
Image
,
error
)
// Removes the specified image.
// Removes the specified image.
...
...
pkg/kubelet/container/testing/fake_runtime.go
View file @
cac38615
...
@@ -348,25 +348,25 @@ func (f *FakeRuntime) GetContainerLogs(pod *v1.Pod, containerID ContainerID, log
...
@@ -348,25 +348,25 @@ func (f *FakeRuntime) GetContainerLogs(pod *v1.Pod, containerID ContainerID, log
return
f
.
Err
return
f
.
Err
}
}
func
(
f
*
FakeRuntime
)
PullImage
(
image
ImageSpec
,
pullSecrets
[]
v1
.
Secret
)
error
{
func
(
f
*
FakeRuntime
)
PullImage
(
image
ImageSpec
,
pullSecrets
[]
v1
.
Secret
)
(
string
,
error
)
{
f
.
Lock
()
f
.
Lock
()
defer
f
.
Unlock
()
defer
f
.
Unlock
()
f
.
CalledFunctions
=
append
(
f
.
CalledFunctions
,
"PullImage"
)
f
.
CalledFunctions
=
append
(
f
.
CalledFunctions
,
"PullImage"
)
return
f
.
Err
return
image
.
Image
,
f
.
Err
}
}
func
(
f
*
FakeRuntime
)
IsImagePresent
(
image
ImageSpec
)
(
bool
,
error
)
{
func
(
f
*
FakeRuntime
)
IsImagePresent
(
image
ImageSpec
)
(
string
,
error
)
{
f
.
Lock
()
f
.
Lock
()
defer
f
.
Unlock
()
defer
f
.
Unlock
()
f
.
CalledFunctions
=
append
(
f
.
CalledFunctions
,
"IsImagePresent"
)
f
.
CalledFunctions
=
append
(
f
.
CalledFunctions
,
"IsImagePresent"
)
for
_
,
i
:=
range
f
.
ImageList
{
for
_
,
i
:=
range
f
.
ImageList
{
if
i
.
ID
==
image
.
Image
{
if
i
.
ID
==
image
.
Image
{
return
true
,
nil
return
i
.
ID
,
nil
}
}
}
}
return
false
,
f
.
InspectErr
return
""
,
f
.
InspectErr
}
}
func
(
f
*
FakeRuntime
)
ListImages
()
([]
Image
,
error
)
{
func
(
f
*
FakeRuntime
)
ListImages
()
([]
Image
,
error
)
{
...
...
pkg/kubelet/container/testing/runtime_mock.go
View file @
cac38615
...
@@ -105,14 +105,14 @@ func (r *Mock) GetContainerLogs(pod *v1.Pod, containerID ContainerID, logOptions
...
@@ -105,14 +105,14 @@ func (r *Mock) GetContainerLogs(pod *v1.Pod, containerID ContainerID, logOptions
return
args
.
Error
(
0
)
return
args
.
Error
(
0
)
}
}
func
(
r
*
Mock
)
PullImage
(
image
ImageSpec
,
pullSecrets
[]
v1
.
Secret
)
error
{
func
(
r
*
Mock
)
PullImage
(
image
ImageSpec
,
pullSecrets
[]
v1
.
Secret
)
(
string
,
error
)
{
args
:=
r
.
Called
(
image
,
pullSecrets
)
args
:=
r
.
Called
(
image
,
pullSecrets
)
return
args
.
Error
(
0
)
return
image
.
Image
,
args
.
Error
(
0
)
}
}
func
(
r
*
Mock
)
IsImagePresent
(
image
ImageSpec
)
(
bool
,
error
)
{
func
(
r
*
Mock
)
IsImagePresent
(
image
ImageSpec
)
(
string
,
error
)
{
args
:=
r
.
Called
(
image
)
args
:=
r
.
Called
(
image
)
return
args
.
Get
(
0
)
.
(
bool
),
args
.
Error
(
1
)
return
args
.
Get
(
0
)
.
(
string
),
args
.
Error
(
1
)
}
}
func
(
r
*
Mock
)
ListImages
()
([]
Image
,
error
)
{
func
(
r
*
Mock
)
ListImages
()
([]
Image
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment