Skip to content

Commit

Permalink
Merge pull request ThalesGroup#10 from cvila84/master
Browse files Browse the repository at this point in the history
Bump to minikube 1.3.0, bump to helm spray 3.4.3
  • Loading branch information
Christophe VILA authored Aug 6, 2019
2 parents 3494752 + 3d02d29 commit 34ae000
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- 1.10.x
- 1.11.x

go_import_path: github.com/gemalto/gokube

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# GoKube Release Notes

## Version 1.7.0 - 08/06/2019
* Bump to minikube v1.3.0 (to benefit from the NAT DNS options), bump to helm spray v3.4.3 [#10](https://github.com/gemalto/gokube/pull/10)

## Version 1.6.2 - 05/29/2019
* kubernetes-dashboard not always patched [#9](https://github.com/gemalto/gokube/pull/9)

## Version 1.6.1 - 05/22/2019
* Fix for kubernetes-dashboard not always patched [#8](https://github.com/gemalto/gokube/issues/8)

## Version 1.6.0 - 04/02/2019
* Bump to minikube v1.0.0 [#7](https://github.com/gemalto/gokube/pull/7)

Expand Down
19 changes: 12 additions & 7 deletions cmd/gokube/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
NGINX_INGRESS_APP_VERSION = "0.23.0"
TPROXY_CHART_VERSION = "1.0.0"
DEFAULT_KUBERNETES_VERSION = "v1.10.13"
DEFAULT_MINIKUBE_VERSION = "v1.1.0"
DEFAULT_MINIKUBE_VERSION = "v1.3.0"
)

var minikubeURL string
Expand All @@ -63,6 +63,8 @@ var imageCache bool
var imageCacheAlternateRepo string
var miniappsRepo string
var ingressController bool
var dnsProxy bool
var hostDNSResolver bool

// initCmd represents the init command
var initCmd = &cobra.Command{
Expand All @@ -87,7 +89,7 @@ func init() {
initCmd.Flags().StringVarP(&kubernetesVersion, "kubernetes-version", "", defaultKubernetesVersion, "The kubernetes version")
initCmd.Flags().StringVarP(&kubectlVersion, "kubectl-version", "", "v1.13.6", "The kubectl version")
initCmd.Flags().StringVarP(&helmVersion, "helm-version", "", "v2.13.1", "The helm version")
initCmd.Flags().StringVarP(&helmSprayVersion, "helm-spray-version", "", "v3.4.2", "The helm version")
initCmd.Flags().StringVarP(&helmSprayVersion, "helm-spray-version", "", "v3.4.3", "The helm version")
initCmd.Flags().StringVarP(&sternVersion, "stern-version", "", "1.10.0", "The stern version")
initCmd.Flags().Int16VarP(&memory, "memory", "", int16(8192), "Amount of RAM allocated to the minikube VM in MB")
initCmd.Flags().Int16VarP(&cpus, "cpus", "", int16(4), "Number of CPUs allocated to the minikube VM")
Expand All @@ -104,6 +106,8 @@ func init() {
initCmd.Flags().StringVarP(&imageCacheAlternateRepo, "image-cache-alternate-repo", "", os.Getenv("ALTERNATE_REPO"), "Alternate docker repo used to download images in cache")
initCmd.Flags().StringVarP(&miniappsRepo, "miniapps-repo", "", "https://gemalto.github.io/miniapps", "Helm repository for miniapps")
initCmd.Flags().BoolVarP(&ingressController, "ingress-controller", "", false, "Deploy ingress controller")
initCmd.Flags().BoolVarP(&dnsProxy, "dns-proxy", "", false, "Use Virtualbox NAT DNS proxy (could be instable)")
initCmd.Flags().BoolVarP(&hostDNSResolver, "host-dns-resolver", "", false, "Use Virtualbox NAT DNS host resolver (could be instable)")
RootCmd.AddCommand(initCmd)
}

Expand All @@ -128,8 +132,7 @@ func cache(originalImagePath string, alternateImagePath string, imageName string
func initRun(cmd *cobra.Command, args []string) {

if len(args) > 0 {
fmt.Fprintln(os.Stderr, "usage: gokube init")
os.Exit(1)
log.Fatalln("usage: gokube init")
}

// TODO add manifest to ask for admin rights
Expand Down Expand Up @@ -166,16 +169,18 @@ func initRun(cmd *cobra.Command, args []string) {
}

// Create virtual machine (minikube)
minikube.Start(memory, cpus, disk, transparentProxy, httpProxy, httpsProxy, noProxy, insecureRegistry, kubernetesVersion, imageCache)
minikube.Start(memory, cpus, disk, transparentProxy, httpProxy, httpsProxy, noProxy, insecureRegistry, kubernetesVersion, imageCache, dnsProxy, hostDNSResolver)
// Disable notification for updates
minikube.ConfigSet("WantUpdateNotification", "false")
// Enable dashboard
minikube.ConfigSet("dashboard", "true")
// Checks minikube IP
var minikubeIP = minikube.Ip()
if strings.Compare("0.0.0.0", checkIP) != 0 && strings.Compare(checkIP, minikubeIP) != 0 {
log.Fatalf("Minikube IP (%s) does not match expected IP (%s)", minikubeIP, checkIP)
os.Exit(1)
log.Println("!!!!!!!!!!!!!!!!!!!!!!!!!")
log.Println("!!!!!!!! CAUTION !!!!!!!!")
log.Println("!!!!!!!!!!!!!!!!!!!!!!!!!")
log.Fatalf("Minikube IP (%s) does not match expected IP (%s), VM post-installation process aborted", minikubeIP, checkIP)
}

if imageCache {
Expand Down
2 changes: 1 addition & 1 deletion cmd/gokube/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

const (
GOKUBE_VERSION = "1.6.2"
GOKUBE_VERSION = "1.7.0"
)

// versionCmd represents the version command
Expand Down
8 changes: 7 additions & 1 deletion pkg/minikube/minikube.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ import (
)

// Start ...
func Start(memory int16, cpus int16, diskSize string, tproxy bool, httpProxy string, httpsProxy string, noProxy string, insecureRegistry string, kubernetesVersion string, cache bool) {
func Start(memory int16, cpus int16, diskSize string, tproxy bool, httpProxy string, httpsProxy string, noProxy string, insecureRegistry string, kubernetesVersion string, cache bool, dnsProxy bool, hostDNSResolver bool) {
var args = []string{"start", "--kubernetes-version", kubernetesVersion, "--insecure-registry", insecureRegistry, "--memory", strconv.FormatInt(int64(memory), 10), "--cpus", strconv.FormatInt(int64(cpus), 10), "--disk-size", diskSize, "--network-plugin=cni", "--enable-default-cni"}
if !tproxy {
args = append(args, "--docker-env", "HTTP_PROXY="+httpProxy, "--docker-env", "HTTPS_PROXY="+httpsProxy, "--docker-env", "NO_PROXY="+noProxy)
}
if !cache {
args = append(args, "--cache-images=false")
}
if dnsProxy {
args = append(args, "--dns-proxy")
}
if !hostDNSResolver {
args = append(args, "--host-dns-resolver=false")
}
cmd := exec.Command("minikube", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand Down
8 changes: 8 additions & 0 deletions pkg/virtualbox/virtualbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ type dhcpServer struct {
var ErrNetworkAddrCidr = errors.New("host-only cidr must be specified with a host address, not a network address")
var vboxManager = NewVBoxManager()

// DeactivateNatDnsHostResolver...
func DeactivateNatDnsHostResolver() {
err := vboxManager.vbm("modifyvm", "minikube", "--natdnshostresolver1", "off")
if err != nil {
panic(err)
}
}

// PurgeHostOnlyNetwork ...
func PurgeHostOnlyNetwork() {
nets, err := listHostOnlyAdapters(vboxManager)
Expand Down

0 comments on commit 34ae000

Please sign in to comment.