@@ -423,8 +423,7 @@ func NewCmdConfigImagesPull() *cobra.Command {
423
423
kubeadmutil .CheckErr (err )
424
424
containerRuntime , err := utilruntime .NewContainerRuntime (utilsexec .New (), internalcfg .NodeRegistration .CRISocket )
425
425
kubeadmutil .CheckErr (err )
426
- imagesPull := NewImagesPull (containerRuntime , images .GetAllImages (& internalcfg .ClusterConfiguration ))
427
- kubeadmutil .CheckErr (imagesPull .PullAll ())
426
+ PullControlPlaneImages (containerRuntime , & internalcfg .ClusterConfiguration )
428
427
},
429
428
}
430
429
AddImagesCommonConfigFlags (cmd .PersistentFlags (), externalcfg , & cfgPath , & featureGatesString )
@@ -447,10 +446,11 @@ func NewImagesPull(runtime utilruntime.ContainerRuntime, images []string) *Image
447
446
}
448
447
}
449
448
450
- // PullAll pulls all images that the ImagesPull knows about
451
- func (ip * ImagesPull ) PullAll () error {
452
- for _ , image := range ip .images {
453
- if err := ip .runtime .PullImage (image ); err != nil {
449
+ // PullControlPlaneImages pulls all images that the ImagesPull knows about
450
+ func PullControlPlaneImages (runtime utilruntime.ContainerRuntime , cfg * kubeadmapi.ClusterConfiguration ) error {
451
+ images := images .GetControlPlaneImages (cfg )
452
+ for _ , image := range images {
453
+ if err := runtime .PullImage (image ); err != nil {
454
454
return errors .Wrapf (err , "failed to pull image %q" , image )
455
455
}
456
456
fmt .Printf ("[config/images] Pulled %s\n " , image )
@@ -505,7 +505,7 @@ type ImagesList struct {
505
505
506
506
// Run runs the images command and writes the result to the io.Writer passed in
507
507
func (i * ImagesList ) Run (out io.Writer ) error {
508
- imgs := images .GetAllImages (& i .cfg .ClusterConfiguration )
508
+ imgs := images .GetControlPlaneImages (& i .cfg .ClusterConfiguration )
509
509
for _ , img := range imgs {
510
510
fmt .Fprintln (out , img )
511
511
}
0 commit comments