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
5552d700
Commit
5552d700
authored
Nov 14, 2015
by
Harry Zhang
Committed by
harry
Nov 30, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default when latest not claimed
parent
121c7046
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
13 deletions
+11
-13
images.md
docs/user-guide/images.md
+3
-0
defaults.go
pkg/api/v1/defaults.go
+4
-5
file_test.go
pkg/kubelet/config/file_test.go
+1
-1
http_test.go
pkg/kubelet/config/http_test.go
+2
-2
docker.go
pkg/kubelet/dockertools/docker.go
+1
-5
No files found.
docs/user-guide/images.md
View file @
5552d700
...
...
@@ -60,6 +60,9 @@ pull an image if it already exists. If you would like to always force a pull
you must set a pull image policy of
`Always`
or specify a
`:latest`
tag on
your image.
If you did not specify tag of your image, it will be assumed as
`:latest`
, with
pull image policy of
`Always`
correspondingly.
## Using a Private Registry
Private registries may require keys to read images from them.
...
...
pkg/api/v1/defaults.go
View file @
5552d700
...
...
@@ -17,11 +17,10 @@ limitations under the License.
package
v1
import
(
"strings"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/intstr"
"k8s.io/kubernetes/pkg/util/parsers"
)
func
addDefaultingFuncs
()
{
...
...
@@ -59,10 +58,10 @@ func addDefaultingFuncs() {
},
func
(
obj
*
Container
)
{
if
obj
.
ImagePullPolicy
==
""
{
// TODO(dchen1107): Move ParseImageName code to pkg/util
parts
:=
strings
.
Split
(
obj
.
Image
,
":"
)
_
,
tag
:=
parsers
.
ParseImageName
(
obj
.
Image
)
// Check image tag
if
parts
[
len
(
parts
)
-
1
]
==
"latest"
{
if
tag
==
"latest"
{
obj
.
ImagePullPolicy
=
PullAlways
}
else
{
obj
.
ImagePullPolicy
=
PullIfNotPresent
...
...
pkg/kubelet/config/file_test.go
View file @
5552d700
...
...
@@ -111,7 +111,7 @@ func TestReadPodsFromFile(t *testing.T) {
Name
:
"image"
,
Image
:
"test/image"
,
TerminationMessagePath
:
"/dev/termination-log"
,
ImagePullPolicy
:
"
IfNotPresent
"
,
ImagePullPolicy
:
"
Always
"
,
SecurityContext
:
securitycontext
.
ValidSecurityContextWithContainerDefaults
()}},
SecurityContext
:
&
api
.
PodSecurityContext
{},
},
...
...
pkg/kubelet/config/http_test.go
View file @
5552d700
...
...
@@ -199,7 +199,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
},
Spec
:
api
.
PodSpec
{
NodeName
:
hostname
,
Containers
:
[]
api
.
Container
{{
Name
:
"2"
,
Image
:
"bar"
,
ImagePullPolicy
:
""
}},
Containers
:
[]
api
.
Container
{{
Name
:
"2"
,
Image
:
"bar
:bartag
"
,
ImagePullPolicy
:
""
}},
SecurityContext
:
&
api
.
PodSecurityContext
{},
},
},
...
...
@@ -247,7 +247,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
Containers
:
[]
api
.
Container
{{
Name
:
"2"
,
Image
:
"bar"
,
Image
:
"bar
:bartag
"
,
TerminationMessagePath
:
"/dev/termination-log"
,
ImagePullPolicy
:
"IfNotPresent"
,
}},
...
...
pkg/kubelet/dockertools/docker.go
View file @
5552d700
...
...
@@ -132,12 +132,8 @@ func filterHTTPError(err error, image string) error {
}
func
(
p
dockerPuller
)
Pull
(
image
string
,
secrets
[]
api
.
Secret
)
error
{
repoToPull
,
tag
:=
parsers
.
ParseImageName
(
image
)
// If no tag was specified, use the default "latest".
if
len
(
tag
)
==
0
{
tag
=
"latest"
}
repoToPull
,
tag
:=
parsers
.
ParseImageName
(
image
)
opts
:=
docker
.
PullImageOptions
{
Repository
:
repoToPull
,
...
...
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