add kic base image to the cluster config
parent
453b5e6321
commit
ddd3c72f9d
|
@ -283,6 +283,7 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
|
||||||
KeepContext: viper.GetBool(keepContext),
|
KeepContext: viper.GetBool(keepContext),
|
||||||
EmbedCerts: viper.GetBool(embedCerts),
|
EmbedCerts: viper.GetBool(embedCerts),
|
||||||
MinikubeISO: viper.GetString(isoURL),
|
MinikubeISO: viper.GetString(isoURL),
|
||||||
|
KicBaseImage: viper.GetString(kicBaseImage),
|
||||||
Memory: mem,
|
Memory: mem,
|
||||||
CPUs: viper.GetInt(cpus),
|
CPUs: viper.GetInt(cpus),
|
||||||
DiskSize: diskSize,
|
DiskSize: diskSize,
|
||||||
|
@ -543,6 +544,10 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
|
||||||
existing.VerifyComponents = interpretWaitFlag(*cmd)
|
existing.VerifyComponents = interpretWaitFlag(*cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cmd.Flags().Changed(kicBaseImage) {
|
||||||
|
existing.KicBaseImage = viper.GetString(kicBaseImage)
|
||||||
|
}
|
||||||
|
|
||||||
return *existing
|
return *existing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,10 @@ type Profile struct {
|
||||||
// ClusterConfig contains the parameters used to start a cluster.
|
// ClusterConfig contains the parameters used to start a cluster.
|
||||||
type ClusterConfig struct {
|
type ClusterConfig struct {
|
||||||
Name string
|
Name string
|
||||||
KeepContext bool // used by start and profile command to or not to switch kubectl's current context
|
KeepContext bool // used by start and profile command to or not to switch kubectl's current context
|
||||||
EmbedCerts bool // used by kubeconfig.Setup
|
EmbedCerts bool // used by kubeconfig.Setup
|
||||||
MinikubeISO string
|
MinikubeISO string // ISO used for VM-drivers
|
||||||
|
KicBaseImage string // bage image used for docker/podman drivers
|
||||||
Memory int
|
Memory int
|
||||||
CPUs int
|
CPUs int
|
||||||
DiskSize int
|
DiskSize int
|
||||||
|
|
|
@ -99,9 +99,8 @@ func doCacheBinaries(k8sVersion string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// BeginDownloadKicArtifacts downloads the kic image + preload tarball, returns true if preload is available
|
// 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)
|
glog.Infof("Beginning downloading kic artifacts for %s with %s", driver, cRuntime)
|
||||||
baseImage := viper.GetString("base-image")
|
|
||||||
if driver == "docker" {
|
if driver == "docker" {
|
||||||
if !image.ExistsImageInDaemon(baseImage) {
|
if !image.ExistsImageInDaemon(baseImage) {
|
||||||
out.T(out.Pulling, "Pulling base image ...")
|
out.T(out.Pulling, "Pulling base image ...")
|
||||||
|
|
|
@ -196,7 +196,7 @@ func Provision(cc *config.ClusterConfig, n *config.Node, apiServer bool) (comman
|
||||||
}
|
}
|
||||||
|
|
||||||
if driver.IsKIC(cc.Driver) {
|
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) {
|
if !driver.BareMetal(cc.Driver) {
|
||||||
|
|
|
@ -26,7 +26,6 @@ import (
|
||||||
|
|
||||||
"github.com/docker/machine/libmachine/drivers"
|
"github.com/docker/machine/libmachine/drivers"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/spf13/viper"
|
|
||||||
"k8s.io/minikube/pkg/drivers/kic"
|
"k8s.io/minikube/pkg/drivers/kic"
|
||||||
"k8s.io/minikube/pkg/drivers/kic/oci"
|
"k8s.io/minikube/pkg/drivers/kic/oci"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
|
@ -60,7 +59,7 @@ func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
|
||||||
return kic.NewDriver(kic.Config{
|
return kic.NewDriver(kic.Config{
|
||||||
MachineName: driver.MachineName(cc, n),
|
MachineName: driver.MachineName(cc, n),
|
||||||
StorePath: localpath.MiniPath(),
|
StorePath: localpath.MiniPath(),
|
||||||
ImageDigest: viper.GetString("base-image"),
|
ImageDigest: cc.KicBaseImage,
|
||||||
CPU: cc.CPUs,
|
CPU: cc.CPUs,
|
||||||
Memory: cc.Memory,
|
Memory: cc.Memory,
|
||||||
OCIBinary: oci.Docker,
|
OCIBinary: oci.Docker,
|
||||||
|
|
|
@ -29,7 +29,6 @@ import (
|
||||||
"github.com/blang/semver"
|
"github.com/blang/semver"
|
||||||
"github.com/docker/machine/libmachine/drivers"
|
"github.com/docker/machine/libmachine/drivers"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/spf13/viper"
|
|
||||||
"k8s.io/minikube/pkg/drivers/kic"
|
"k8s.io/minikube/pkg/drivers/kic"
|
||||||
"k8s.io/minikube/pkg/drivers/kic/oci"
|
"k8s.io/minikube/pkg/drivers/kic/oci"
|
||||||
"k8s.io/minikube/pkg/minikube/config"
|
"k8s.io/minikube/pkg/minikube/config"
|
||||||
|
@ -60,11 +59,10 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
|
func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
|
||||||
baseImage := viper.GetString("base-image")
|
|
||||||
return kic.NewDriver(kic.Config{
|
return kic.NewDriver(kic.Config{
|
||||||
MachineName: driver.MachineName(cc, n),
|
MachineName: driver.MachineName(cc, n),
|
||||||
StorePath: localpath.MiniPath(),
|
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,
|
CPU: cc.CPUs,
|
||||||
Memory: cc.Memory,
|
Memory: cc.Memory,
|
||||||
OCIBinary: oci.Podman,
|
OCIBinary: oci.Podman,
|
||||||
|
|
Loading…
Reference in New Issue