Skip to content

Commit

Permalink
Merge pull request #8320 from medyagh/add_dockerhub_img
Browse files Browse the repository at this point in the history
docker driver: add fall back image in docker hub
  • Loading branch information
medyagh authored May 29, 2020
2 parents c539c2b + 488e200 commit 7d6ea69
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/drivers/kic/kic.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (d *Driver) Create() error {
t := time.Now()
glog.Infof("Starting extracting preloaded images to volume ...")
// Extract preloaded images to container
if err := oci.ExtractTarballToVolume(d.NodeConfig.OCIBinary, download.TarballPath(d.NodeConfig.KubernetesVersion, d.NodeConfig.ContainerRuntime), params.Name, BaseImage); err != nil {
if err := oci.ExtractTarballToVolume(d.NodeConfig.OCIBinary, download.TarballPath(d.NodeConfig.KubernetesVersion, d.NodeConfig.ContainerRuntime), params.Name, d.NodeConfig.ImageDigest); err != nil {
glog.Infof("Unable to extract preloaded tarball to volume: %v", err)
} else {
glog.Infof("duration metric: took %f seconds to extract preloaded images to volume", time.Since(t).Seconds())
Expand Down
9 changes: 7 additions & 2 deletions pkg/drivers/kic/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ const (
var (
// BaseImage is the base image is used to spin up kic containers. it uses same base-image as kind.
BaseImage = fmt.Sprintf("gcr.io/k8s-minikube/kicbase:%s@sha256:%s", Version, baseImageSHA)
// BaseImageFallBack the fall back of BaseImage in case gcr.io is not available. stored in github packages https://github.com/kubernetes/minikube/packages/206071

// BaseImageFallBack1 the fall back of BaseImage in case gcr.io is not available. stored in docker hub
// same image is push to https://github.com/kicbase/stable
BaseImageFallBack1 = fmt.Sprintf("kicbase/stable:%s@sha256:%s", Version, baseImageSHA)

// BaseImageFallBack2 the fall back of BaseImage in case gcr.io is not available. stored in github packages https://github.com/kubernetes/minikube/packages/206071
// github packages docker does _NOT_ support pulling by sha as mentioned in the docs:
// https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages
BaseImageFallBack = fmt.Sprintf("docker.pkg.github.com/kubernetes/minikube/kicbase:%s", Version)
BaseImageFallBack2 = fmt.Sprintf("docker.pkg.github.com/kubernetes/minikube/kicbase:%s", Version)
)

// Config is configuration for the kic driver used by registry
Expand Down
10 changes: 7 additions & 3 deletions pkg/minikube/node/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ func beginDownloadKicArtifacts(g *errgroup.Group, cc *config.ClusterConfig) {
glog.Infof("Downloading %s to local daemon", cc.KicBaseImage)
err := image.WriteImageToDaemon(cc.KicBaseImage)
if err != nil {
glog.Infof("failed to download base-image %q will try to download the fallback base-image %q instead.", cc.KicBaseImage, kic.BaseImageFallBack)
cc.KicBaseImage = kic.BaseImageFallBack
return image.WriteImageToDaemon(kic.BaseImageFallBack)
glog.Infof("failed to download base-image %q will try to download the fallback base-image %q instead.", cc.KicBaseImage, kic.BaseImageFallBack1)
cc.KicBaseImage = kic.BaseImageFallBack1
if err := image.WriteImageToDaemon(kic.BaseImageFallBack1); err != nil {
cc.KicBaseImage = kic.BaseImageFallBack2
glog.Infof("failed to docker hub base-image %q will try to download the github packages base-image %q instead.", cc.KicBaseImage, kic.BaseImageFallBack2)
return image.WriteImageToDaemon(kic.BaseImageFallBack2)
}
}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/fn_mount_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
createdByPodRemovedByTest = "created-by-pod-removed-by-test"
)

func validateMountCmd(ctx context.Context, t *testing.T, profile string) { // nolint: cyclomatic complexity 31
func validateMountCmd(ctx context.Context, t *testing.T, profile string) { // nolint
if NoneDriver() {
t.Skip("skipping: none driver does not support mount")
}
Expand Down

0 comments on commit 7d6ea69

Please sign in to comment.