unexport func cacheImage

pull/6051/head
Medya Gh 2019-12-10 16:06:19 -08:00
parent 193d16dd0c
commit 71a896fc0a
2 changed files with 8 additions and 8 deletions

View File

@ -94,7 +94,7 @@ func cacheImagesInConfigFile() error {
if len(images) == 0 { if len(images) == 0 {
return nil return nil
} }
return machine.CacheImages(images, constants.ImageCacheDir) return machine.CacheImagesToHostDisk(images, constants.ImageCacheDir)
} }
// loadCachedImagesInConfigFile loads the images currently in the config file (minikube start) // loadCachedImagesInConfigFile loads the images currently in the config file (minikube start)

View File

@ -63,26 +63,26 @@ func CacheImagesForBootstrapper(imageRepository string, version string, clusterB
return errors.Wrap(err, "cached images list") return errors.Wrap(err, "cached images list")
} }
if err := CacheImages(images, constants.ImageCacheDir); err != nil { if err := CacheImagesToHostDisk(images, constants.ImageCacheDir); err != nil {
return errors.Wrapf(err, "Caching images for %s", clusterBootstrapper) return errors.Wrapf(err, "Caching images for %s", clusterBootstrapper)
} }
return nil return nil
} }
// CacheImages will cache images on the host // CacheImagesToHostDisk will cache images on the host
// //
// The cache directory currently caches images using the imagename_tag // The cache directory currently caches images using the imagename_tag
// For example, k8s.gcr.io/kube-addon-manager:v6.5 would be // For example, k8s.gcr.io/kube-addon-manager:v6.5 would be
// stored at $CACHE_DIR/k8s.gcr.io/kube-addon-manager_v6.5 // stored at $CACHE_DIR/k8s.gcr.io/kube-addon-manager_v6.5
func CacheImages(images []string, cacheDir string) error { func CacheImagesToHostDisk(images []string, cacheDir string) error {
var g errgroup.Group var g errgroup.Group
for _, image := range images { for _, image := range images {
image := image image := image
g.Go(func() error { g.Go(func() error {
dst := filepath.Join(cacheDir, image) dst := filepath.Join(cacheDir, image)
dst = sanitizeCacheDir(dst) dst = sanitizeCacheDir(dst)
if err := CacheImage(image, dst); err != nil { if err := cacheImage(image, dst); err != nil {
glog.Errorf("CacheImage %s -> %s failed: %v", image, dst, err) glog.Errorf("CacheImage %s -> %s failed: %v", image, dst, err)
return errors.Wrapf(err, "caching image %s", dst) return errors.Wrapf(err, "caching image %s", dst)
} }
@ -150,7 +150,7 @@ func needsTransfer(image string, cr cruntime.Manager) error {
// CacheAndLoadImages caches and loads images to all profiles // CacheAndLoadImages caches and loads images to all profiles
func CacheAndLoadImages(images []string) error { func CacheAndLoadImages(images []string) error {
if err := CacheImages(images, constants.ImageCacheDir); err != nil { if err := CacheImagesToHostDisk(images, constants.ImageCacheDir); err != nil {
return err return err
} }
api, err := NewAPIClient() api, err := NewAPIClient()
@ -341,8 +341,8 @@ func getDstPath(dst string) (string, error) {
return dst, nil return dst, nil
} }
// CacheImage caches an image // cacheImage caches an image
func CacheImage(image, dst string) error { func cacheImage(image, dst string) error {
start := time.Now() start := time.Now()
glog.Infof("CacheImage: %s -> %s", image, dst) glog.Infof("CacheImage: %s -> %s", image, dst)
defer func() { defer func() {