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
5b3a44fd
Commit
5b3a44fd
authored
Apr 11, 2019
by
Alok Kumar Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use docker api IsErrNotFound(). String handling is not required anymore
Why?
https://github.com/kubernetes/kubernetes/pull/75843#discussion_r273785877
Moby support:
https://github.com/moby/moby/pull/38689
Moby def:
https://github.com/moby/moby/blob/053c6f097a1af7047e831094c0dfa3408a2c9d2b/client/errors.go#L44-L49
parent
5c113cf4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
10 deletions
+1
-10
helpers.go
pkg/kubelet/dockershim/libdocker/helpers.go
+0
-9
kube_docker_client.go
pkg/kubelet/dockershim/libdocker/kube_docker_client.go
+1
-1
No files found.
pkg/kubelet/dockershim/libdocker/helpers.go
View file @
5b3a44fd
...
...
@@ -161,12 +161,3 @@ func matchImageIDOnly(inspected dockertypes.ImageInspect, image string) bool {
klog
.
V
(
4
)
.
Infof
(
"The reference %s does not directly refer to the given image's ID (%q)"
,
image
,
inspected
.
ID
)
return
false
}
// isImageNotFoundError returns whether the err is caused by image not found in docker
// TODO: Use native error tester once ImageNotFoundError is supported in docker-engine client(eg. ImageRemove())
func
isImageNotFoundError
(
err
error
)
bool
{
if
err
!=
nil
{
return
strings
.
Contains
(
err
.
Error
(),
"No such image:"
)
}
return
false
}
pkg/kubelet/dockershim/libdocker/kube_docker_client.go
View file @
5b3a44fd
...
...
@@ -399,7 +399,7 @@ func (d *kubeDockerClient) RemoveImage(image string, opts dockertypes.ImageRemov
if
ctxErr
:=
contextError
(
ctx
);
ctxErr
!=
nil
{
return
nil
,
ctxErr
}
if
isImageNotFoundError
(
err
)
{
if
dockerapi
.
IsErrNotFound
(
err
)
{
return
nil
,
ImageNotFoundError
{
ID
:
image
}
}
return
resp
,
err
...
...
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