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
7131617d
Unverified
Commit
7131617d
authored
Mar 27, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74399 from RA489/runpullimagescleanup
Rename RunPullImagesCheck to PullControlPlaneImages
parents
b9dbb458
8bcc82a9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
16 deletions
+16
-16
config.go
cmd/kubeadm/app/cmd/config.go
+7
-7
config_test.go
cmd/kubeadm/app/cmd/config_test.go
+5
-5
images.go
cmd/kubeadm/app/images/images.go
+2
-2
images_test.go
cmd/kubeadm/app/images/images_test.go
+1
-1
checks.go
cmd/kubeadm/app/preflight/checks.go
+1
-1
No files found.
cmd/kubeadm/app/cmd/config.go
View file @
7131617d
...
@@ -423,8 +423,7 @@ func NewCmdConfigImagesPull() *cobra.Command {
...
@@ -423,8 +423,7 @@ func NewCmdConfigImagesPull() *cobra.Command {
kubeadmutil
.
CheckErr
(
err
)
kubeadmutil
.
CheckErr
(
err
)
containerRuntime
,
err
:=
utilruntime
.
NewContainerRuntime
(
utilsexec
.
New
(),
internalcfg
.
NodeRegistration
.
CRISocket
)
containerRuntime
,
err
:=
utilruntime
.
NewContainerRuntime
(
utilsexec
.
New
(),
internalcfg
.
NodeRegistration
.
CRISocket
)
kubeadmutil
.
CheckErr
(
err
)
kubeadmutil
.
CheckErr
(
err
)
imagesPull
:=
NewImagesPull
(
containerRuntime
,
images
.
GetAllImages
(
&
internalcfg
.
ClusterConfiguration
))
PullControlPlaneImages
(
containerRuntime
,
&
internalcfg
.
ClusterConfiguration
)
kubeadmutil
.
CheckErr
(
imagesPull
.
PullAll
())
},
},
}
}
AddImagesCommonConfigFlags
(
cmd
.
PersistentFlags
(),
externalcfg
,
&
cfgPath
,
&
featureGatesString
)
AddImagesCommonConfigFlags
(
cmd
.
PersistentFlags
(),
externalcfg
,
&
cfgPath
,
&
featureGatesString
)
...
@@ -447,10 +446,11 @@ func NewImagesPull(runtime utilruntime.ContainerRuntime, images []string) *Image
...
@@ -447,10 +446,11 @@ func NewImagesPull(runtime utilruntime.ContainerRuntime, images []string) *Image
}
}
}
}
// PullAll pulls all images that the ImagesPull knows about
// PullControlPlaneImages pulls all images that the ImagesPull knows about
func
(
ip
*
ImagesPull
)
PullAll
()
error
{
func
PullControlPlaneImages
(
runtime
utilruntime
.
ContainerRuntime
,
cfg
*
kubeadmapi
.
ClusterConfiguration
)
error
{
for
_
,
image
:=
range
ip
.
images
{
images
:=
images
.
GetControlPlaneImages
(
cfg
)
if
err
:=
ip
.
runtime
.
PullImage
(
image
);
err
!=
nil
{
for
_
,
image
:=
range
images
{
if
err
:=
runtime
.
PullImage
(
image
);
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"failed to pull image %q"
,
image
)
return
errors
.
Wrapf
(
err
,
"failed to pull image %q"
,
image
)
}
}
fmt
.
Printf
(
"[config/images] Pulled %s
\n
"
,
image
)
fmt
.
Printf
(
"[config/images] Pulled %s
\n
"
,
image
)
...
@@ -505,7 +505,7 @@ type ImagesList struct {
...
@@ -505,7 +505,7 @@ type ImagesList struct {
// Run runs the images command and writes the result to the io.Writer passed in
// Run runs the images command and writes the result to the io.Writer passed in
func
(
i
*
ImagesList
)
Run
(
out
io
.
Writer
)
error
{
func
(
i
*
ImagesList
)
Run
(
out
io
.
Writer
)
error
{
imgs
:=
images
.
Get
All
Images
(
&
i
.
cfg
.
ClusterConfiguration
)
imgs
:=
images
.
Get
ControlPlane
Images
(
&
i
.
cfg
.
ClusterConfiguration
)
for
_
,
img
:=
range
imgs
{
for
_
,
img
:=
range
imgs
{
fmt
.
Fprintln
(
out
,
img
)
fmt
.
Fprintln
(
out
,
img
)
}
}
...
...
cmd/kubeadm/app/cmd/config_test.go
View file @
7131617d
...
@@ -244,11 +244,11 @@ func TestImagesPull(t *testing.T) {
...
@@ -244,11 +244,11 @@ func TestImagesPull(t *testing.T) {
}
}
images
:=
[]
string
{
"a"
,
"b"
,
"c"
,
"d"
,
"a"
}
images
:=
[]
string
{
"a"
,
"b"
,
"c"
,
"d"
,
"a"
}
ip
:=
NewImagesPull
(
containerRuntime
,
images
)
for
_
,
image
:=
range
images
{
if
err
:=
containerRuntime
.
PullImage
(
image
);
err
!=
nil
{
err
=
ip
.
PullAll
(
)
t
.
Fatalf
(
"expected nil but found %v"
,
err
)
if
err
!=
nil
{
}
t
.
Fatalf
(
"expected nil but found %v"
,
err
)
fmt
.
Printf
(
"[config/images] Pulled %s
\n
"
,
image
)
}
}
if
fcmd
.
CombinedOutputCalls
!=
len
(
images
)
{
if
fcmd
.
CombinedOutputCalls
!=
len
(
images
)
{
...
...
cmd/kubeadm/app/images/images.go
View file @
7131617d
...
@@ -85,8 +85,8 @@ func GetPauseImage(cfg *kubeadmapi.ClusterConfiguration) string {
...
@@ -85,8 +85,8 @@ func GetPauseImage(cfg *kubeadmapi.ClusterConfiguration) string {
return
GetGenericImage
(
cfg
.
ImageRepository
,
"pause"
,
constants
.
PauseVersion
)
return
GetGenericImage
(
cfg
.
ImageRepository
,
"pause"
,
constants
.
PauseVersion
)
}
}
// Get
All
Images returns a list of container images kubeadm expects to use on a control plane node
// Get
ControlPlane
Images returns a list of container images kubeadm expects to use on a control plane node
func
Get
All
Images
(
cfg
*
kubeadmapi
.
ClusterConfiguration
)
[]
string
{
func
Get
ControlPlane
Images
(
cfg
*
kubeadmapi
.
ClusterConfiguration
)
[]
string
{
imgs
:=
[]
string
{}
imgs
:=
[]
string
{}
// start with core kubernetes images
// start with core kubernetes images
...
...
cmd/kubeadm/app/images/images_test.go
View file @
7131617d
...
@@ -254,7 +254,7 @@ func TestGetAllImages(t *testing.T) {
...
@@ -254,7 +254,7 @@ func TestGetAllImages(t *testing.T) {
}
}
for
_
,
tc
:=
range
testcases
{
for
_
,
tc
:=
range
testcases
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
imgs
:=
Get
All
Images
(
tc
.
cfg
)
imgs
:=
Get
ControlPlane
Images
(
tc
.
cfg
)
for
_
,
img
:=
range
imgs
{
for
_
,
img
:=
range
imgs
{
if
strings
.
Contains
(
img
,
tc
.
expect
)
{
if
strings
.
Contains
(
img
,
tc
.
expect
)
{
return
return
...
...
cmd/kubeadm/app/preflight/checks.go
View file @
7131617d
...
@@ -1074,7 +1074,7 @@ func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigur
...
@@ -1074,7 +1074,7 @@ func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigur
}
}
checks
:=
[]
Checker
{
checks
:=
[]
Checker
{
ImagePullCheck
{
runtime
:
containerRuntime
,
imageList
:
images
.
Get
All
Images
(
&
cfg
.
ClusterConfiguration
)},
ImagePullCheck
{
runtime
:
containerRuntime
,
imageList
:
images
.
Get
ControlPlane
Images
(
&
cfg
.
ClusterConfiguration
)},
}
}
return
RunChecks
(
checks
,
os
.
Stderr
,
ignorePreflightErrors
)
return
RunChecks
(
checks
,
os
.
Stderr
,
ignorePreflightErrors
)
}
}
...
...
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