Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kic base image to the cluster config #7985

Merged
merged 2 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/minikube/cmd/start_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
KeepContext: viper.GetBool(keepContext),
EmbedCerts: viper.GetBool(embedCerts),
MinikubeISO: viper.GetString(isoURL),
KicBaseImage: viper.GetString(kicBaseImage),
Memory: mem,
CPUs: viper.GetInt(cpus),
DiskSize: diskSize,
Expand Down Expand Up @@ -543,6 +544,10 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
existing.VerifyComponents = interpretWaitFlag(*cmd)
}

if cmd.Flags().Changed(kicBaseImage) {
existing.KicBaseImage = viper.GetString(kicBaseImage)
}

return *existing
}

Expand Down
7 changes: 4 additions & 3 deletions pkg/minikube/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ type Profile struct {
// ClusterConfig contains the parameters used to start a cluster.
type ClusterConfig struct {
Name string
KeepContext bool // used by start and profile command to or not to switch kubectl's current context
EmbedCerts bool // used by kubeconfig.Setup
MinikubeISO string
KeepContext bool // used by start and profile command to or not to switch kubectl's current context
EmbedCerts bool // used by kubeconfig.Setup
MinikubeISO string // ISO used for VM-drivers.
KicBaseImage string // base-image used for docker/podman drivers.
Memory int
CPUs int
DiskSize int
Expand Down
3 changes: 1 addition & 2 deletions pkg/minikube/node/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ func doCacheBinaries(k8sVersion string) error {
}

// BeginDownloadKicArtifacts downloads the kic image + preload tarball, returns true if preload is available
func beginDownloadKicArtifacts(g *errgroup.Group, driver string, cRuntime string) {
func beginDownloadKicArtifacts(g *errgroup.Group, driver string, cRuntime string, baseImage string) {
glog.Infof("Beginning downloading kic artifacts for %s with %s", driver, cRuntime)
baseImage := viper.GetString("base-image")
if driver == "docker" {
if !image.ExistsImageInDaemon(baseImage) {
out.T(out.Pulling, "Pulling base image ...")
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func Provision(cc *config.ClusterConfig, n *config.Node, apiServer bool) (comman
}

if driver.IsKIC(cc.Driver) {
beginDownloadKicArtifacts(&kicGroup, cc.Driver, cc.KubernetesConfig.ContainerRuntime)
beginDownloadKicArtifacts(&kicGroup, cc.Driver, cc.KubernetesConfig.ContainerRuntime, cc.KicBaseImage)
}

if !driver.BareMetal(cc.Driver) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/minikube/registry/drvs/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

"github.com/docker/machine/libmachine/drivers"
"github.com/golang/glog"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/drivers/kic"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/config"
Expand Down Expand Up @@ -60,7 +59,7 @@ func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
return kic.NewDriver(kic.Config{
MachineName: driver.MachineName(cc, n),
StorePath: localpath.MiniPath(),
ImageDigest: viper.GetString("base-image"),
ImageDigest: cc.KicBaseImage,
CPU: cc.CPUs,
Memory: cc.Memory,
OCIBinary: oci.Docker,
Expand Down
4 changes: 1 addition & 3 deletions pkg/minikube/registry/drvs/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/blang/semver"
"github.com/docker/machine/libmachine/drivers"
"github.com/golang/glog"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/drivers/kic"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/config"
Expand Down Expand Up @@ -60,11 +59,10 @@ func init() {
}

func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
baseImage := viper.GetString("base-image")
return kic.NewDriver(kic.Config{
MachineName: driver.MachineName(cc, n),
StorePath: localpath.MiniPath(),
ImageDigest: strings.Split(baseImage, "@")[0], // for podman does not support docker images references with both a tag and digest.
ImageDigest: strings.Split(cc.KicBaseImage, "@")[0], // for podman does not support docker images references with both a tag and digest.
CPU: cc.CPUs,
Memory: cc.Memory,
OCIBinary: oci.Podman,
Expand Down