Skip to content

Commit

Permalink
Merge branch 'master' of github.com:kubernetes/minikube into gvisor-i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
Priya Wadhwa committed Jul 11, 2019
2 parents d68e054 + 65c6f9e commit 1ec4012
Show file tree
Hide file tree
Showing 56 changed files with 713 additions and 277 deletions.
1 change: 0 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Balint Pato <balintp@google.com> (@balopat)
Thomas Stromberg <tstromberg@google.com> (@tstromberg)
Anders F Björklund <anders.f.bjorklund@gmail.com> (@afbjorklund)
Sharif Elgamal <selgamal@google.com> (@sharifelgamal)
Expand Down
3 changes: 1 addition & 2 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# See the OWNERS docs at https://go.k8s.io/owners

reviewers:
- balopat
- tstromberg
- afbjorklund
- sharifelgamal
- RA489
- medyagh
approvers:
- balopat
- tstromberg
- afbjorklund
- sharifelgamal
Expand All @@ -18,3 +16,4 @@ emeritus_approvers:
- dlorenc
- luxas
- jimmidyson
- r2d4
6 changes: 4 additions & 2 deletions SECURITY_CONTACTS
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
# INSTRUCTIONS AT https://kubernetes.io/security/

dlorenc
gbraad
tstromberg
afbjorklund
medyagh
sharifelgamal
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var addonsOpenCmd = &cobra.Command{
exit.Usage("usage: minikube addons open ADDON_NAME")
}
addonName := args[0]
//TODO(r2d4): config should not reference API, pull this out
// TODO(r2d4): config should not reference API, pull this out
api, err := machine.NewAPIClient()
if err != nil {
exit.WithError("Error getting client", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func EnableOrDisableAddon(name string, val string) error {
return errors.Wrapf(err, "parsing bool: %s", name)
}

//TODO(r2d4): config package should not reference API, pull this out
// TODO(r2d4): config package should not reference API, pull this out
api, err := machine.NewAPIClient()
if err != nil {
return errors.Wrap(err, "machine client")
Expand Down
5 changes: 4 additions & 1 deletion cmd/minikube/cmd/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ import (
var kubectlCmd = &cobra.Command{
Use: "kubectl",
Short: "Run kubectl",
Long: `Run the kubernetes client, download it if necessary.`,
Long: `Run the kubernetes client, download it if necessary.
Examples:
minikube kubectl -- --help
kubectl get pods --namespace kube-system`,
Run: func(cmd *cobra.Command, args []string) {
api, err := machine.NewAPIClient()
if err != nil {
Expand Down
8 changes: 1 addition & 7 deletions cmd/minikube/cmd/service_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"os"
"strings"

"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
core "k8s.io/api/core/v1"
"k8s.io/minikube/pkg/minikube/console"
Expand Down Expand Up @@ -59,12 +58,7 @@ var serviceListCmd = &cobra.Command{

}

table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Namespace", "Name", "URL"})
table.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
table.SetCenterSeparator("|")
table.AppendBulk(data) // Add Bulk Data
table.Render()
service.PrintServiceList(os.Stdout, data)
},
}

Expand Down
34 changes: 19 additions & 15 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ assumes you have already installed one of the VM drivers: virtualbox/parallels/v

// runStart handles the executes the flow of "minikube start"
func runStart(cmd *cobra.Command, args []string) {
console.OutStyle(console.Happy, "minikube %s on %s (%s)", version.GetVersion(), runtime.GOOS, runtime.GOARCH)
console.OutT(console.Happy, "minikube {{.version}} on {{.os}} ({{.arch}})", console.Arg{"version": version.GetVersion(), "os": runtime.GOOS, "arch": runtime.GOARCH})
validateConfig()

validateUser()
Expand Down Expand Up @@ -239,7 +239,7 @@ func runStart(cmd *cobra.Command, args []string) {
// Bypass proxy for minikube's vm ip
err = proxy.ExcludeIP(ip)
if err != nil {
console.ErrStyle(console.FailureType, "Failed to set NO_PROXY Env. Please use `export NO_PROXY=$NO_PROXY,%s`.", ip)
console.ErrT(console.FailureType, "Failed to set NO_PROXY Env. Please use `export NO_PROXY=$NO_PROXY,{{.ip}}`.", console.Arg{"ip": ip})
}

// Save IP to configuration file for subsequent use
Expand Down Expand Up @@ -297,7 +297,7 @@ func skipCache(config cfg.Config) {

func showVersionInfo(k8sVersion string, cr cruntime.Manager) {
version, _ := cr.Version()
console.OutStyle(cr.Style(), "Configuring environment for Kubernetes %s on %s %s", k8sVersion, cr.Name(), version)
console.OutT(cr.Style(), "Configuring environment for Kubernetes {{.k8sVersion}} on {{.runtime}} {{.runtimeVersion}}", console.Arg{"k8sVersion": k8sVersion, "runtime": cr.Name(), "runtimeVersion": version})
for _, v := range dockerOpt {
console.OutStyle(console.Option, "opt %s", v)
}
Expand All @@ -308,9 +308,9 @@ func showVersionInfo(k8sVersion string, cr cruntime.Manager) {

func showKubectlConnectInfo(kubeconfig *pkgutil.KubeConfigSetup) {
if kubeconfig.KeepContext {
console.OutStyle(console.Kubectl, "To connect to this cluster, use: kubectl --context=%s", kubeconfig.ClusterName)
console.OutT(console.Kubectl, "To connect to this cluster, use: kubectl --context={{.name}}", console.Arg{"name": kubeconfig.ClusterName})
} else {
console.OutStyle(console.Ready, "Done! kubectl is now configured to use %q", cfg.GetMachineName())
console.OutT(console.Ready, "Done! kubectl is now configured to use {{.name}}", console.Arg{"name": cfg.GetMachineName()})
}
_, err := exec.LookPath("kubectl")
if err != nil {
Expand Down Expand Up @@ -380,7 +380,7 @@ func validateUser() {
exit.Usage("Please run with sudo. the vm-driver %q requires sudo.", constants.DriverNone)

} else if u.Name == "root" && !(d == constants.DriverHyperv || d == constants.DriverNone) {
console.OutStyle(console.WarningType, "Please don't run minikube as root or with 'sudo' privileges. It isn't necessary with %s driver.", d)
console.OutT(console.WarningType, "Please don't run minikube as root or with 'sudo' privileges. It isn't necessary with {{.driver}} driver.", console.Arg{"driver": d})
}

} else {
Expand All @@ -406,7 +406,7 @@ func validateConfig() {
exit.Usage("Requested memory allocation (%dMB) is less than the minimum allowed of %dMB", memorySizeMB, pkgutil.CalculateSizeInMB(constants.MinimumMemorySize))
}
if memorySizeMB < pkgutil.CalculateSizeInMB(constants.DefaultMemorySize) {
console.OutStyle(console.Notice, "Requested memory allocation (%dMB) is less than the default memory allocation of (%dMB). Beware that Minikube might not work correctly or crash unexpectedly.", memorySizeMB, pkgutil.CalculateSizeInMB(constants.DefaultMemorySize))
console.OutT(console.Notice, "Requested memory allocation ({{.memory}}MB) is less than the default memory allocation of {{.default}}MB. Beware that minikube might not work correctly or crash unexpectedly.", console.Arg{"memory": memorySizeMB, "default": pkgutil.CalculateSizeInMB(constants.DefaultMemorySize)})
}

// check that kubeadm extra args contain only whitelisted parameters
Expand All @@ -421,7 +421,7 @@ func validateConfig() {
}

// This function validates if the --registry-mirror
//args match the format of http://localhost
// args match the format of http://localhost
func validateRegistryMirror() {

if len(registryMirror) > 0 {
Expand Down Expand Up @@ -515,7 +515,7 @@ func generateConfig(cmd *cobra.Command, k8sVersion string) (cfg.Config, error) {
}

if repository != "" {
console.OutStyle(console.SuccessType, "using image repository %s", repository)
console.OutT(console.SuccessType, "Using image repository {{.name}}", console.Arg{"name": repository})
}

cfg := cfg.Config{
Expand Down Expand Up @@ -686,11 +686,11 @@ func validateKubernetesVersions(old *cfg.Config) (string, bool) {

if nvs.LT(ovs) {
nv = version.VersionPrefix + ovs.String()
console.ErrStyle(console.Conflict, "Kubernetes downgrade is not supported, will continue to use %v", nv)
console.ErrT(console.Conflict, "Kubernetes downgrade is not supported, will continue to use {{.version}}", console.Arg{"version": nv})
return nv, isUpgrade
}
if nvs.GT(ovs) {
console.OutStyle(console.ThumbsUp, "minikube will upgrade the local cluster from Kubernetes %s to %s", ovs, nvs)
console.OutT(console.ThumbsUp, "minikube will upgrade the local cluster from Kubernetes {{.old}} to {{.new}}", console.Arg{"old": ovs, "new": nvs})
isUpgrade = true
}
return nv, isUpgrade
Expand Down Expand Up @@ -751,7 +751,11 @@ func configureRuntimes(runner cruntime.CommandRunner) cruntime.Manager {
exit.WithError(fmt.Sprintf("Failed runtime for %+v", config), err)
}

err = cr.Enable()
disableOthers := true
if viper.GetString(vmDriver) == constants.DriverNone {
disableOthers = false
}
err = cr.Enable(disableOthers)
if err != nil {
exit.WithError("Failed to enable container runtime", err)
}
Expand All @@ -767,12 +771,12 @@ func bootstrapCluster(bs bootstrapper.Bootstrapper, r cruntime.Manager, runner c
if isUpgrade || !preexisting {
console.OutStyle(console.Pulling, "Pulling images ...")
if err := bs.PullImages(kc); err != nil {
console.OutStyle(console.FailureType, "Unable to pull images, which may be OK: %v", err)
console.OutT(console.FailureType, "Unable to pull images, which may be OK: {{.error}}", console.Arg{"error": err})
}
}

if preexisting {
console.OutStyle(console.Restarting, "Relaunching Kubernetes %s using %s ... ", kc.KubernetesVersion, bsName)
console.OutT(console.Restarting, "Relaunching Kubernetes {{.version}} using {{.bootstrapper}} ... ", console.Arg{"version": kc.KubernetesVersion, "bootstrapper": bsName})
if err := bs.RestartCluster(kc); err != nil {
exit.WithLogEntries("Error restarting cluster", err, logs.FindProblems(r, bs, runner))
}
Expand All @@ -791,7 +795,7 @@ func configureMounts() {
return
}

console.OutStyle(console.Mounting, "Creating mount %s ...", viper.GetString(mountString))
console.OutT(console.Mounting, "Creating mount {{.name}} ...", console.Arg{"name": viper.GetString(mountString)})
path := os.Args[0]
mountDebugVal := 0
if glog.V(8) {
Expand Down
62 changes: 14 additions & 48 deletions cmd/minikube/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,28 @@ package cmd

import (
"os"
"text/template"

"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
"github.com/spf13/viper"
cmdcfg "k8s.io/minikube/cmd/minikube/cmd/config"
"k8s.io/minikube/cmd/util"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
pkg_config "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/machine"
pkgutil "k8s.io/minikube/pkg/util"
)

var statusFormat string

// Status represents the status
type Status struct {
Host string
Kubelet string
APIServer string
Kubeconfig string
}

const (
minikubeNotRunningStatusFlag = 1 << 0
clusterNotRunningStatusFlag = 1 << 1
k8sNotRunningStatusFlag = 1 << 2
)

// statusCmd represents the status command
var statusCmd = &cobra.Command{
Use: "status",
Short: "Gets the status of a local kubernetes cluster",
Long: `Gets the status of a local kubernetes cluster.
Exit status contains the status of minikube's VM, cluster and kubernetes encoded on it's bits in this order from right to left.
Eg: 7 meaning: 1 (for minikube NOK) + 2 (for cluster NOK) + 4 (for kubernetes NOK)`,
Long: `Gets the status of a local kubernetes cluster.`,
Run: func(cmd *cobra.Command, args []string) {
var returnCode = 0
api, err := machine.NewAPIClient()
if err != nil {
exit.WithCode(exit.Unavailable, "Error getting client: %v", err)
Expand All @@ -79,12 +60,10 @@ var statusCmd = &cobra.Command{
if err != nil {
exit.WithError("Error getting bootstrapper", err)
}

kubeletSt, err = clusterBootstrapper.GetKubeletStatus()
if err != nil {
glog.Warningf("kubelet err: %v", err)
returnCode |= clusterNotRunningStatusFlag
} else if kubeletSt != state.Running.String() {
returnCode |= clusterNotRunningStatusFlag
}

ip, err := cluster.GetHostDriverIP(api, config.GetMachineName())
Expand All @@ -101,47 +80,34 @@ var statusCmd = &cobra.Command{
apiserverSt, err = clusterBootstrapper.GetAPIServerStatus(ip, apiserverPort)
if err != nil {
glog.Errorln("Error apiserver status:", err)
} else if apiserverSt != state.Running.String() {
returnCode |= clusterNotRunningStatusFlag
}

ks, err := pkgutil.GetKubeConfigStatus(ip, util.GetKubeConfigPath(), config.GetMachineName())
if err != nil {
glog.Errorln("Error kubeconfig status:", err)
}

if ks {
kubeconfigSt = "Correctly Configured: pointing to minikube-vm at " + ip.String()
} else {
kubeconfigSt = "Misconfigured: pointing to stale minikube-vm." +
"\nTo fix the kubectl context, run minikube update-context"
returnCode |= k8sNotRunningStatusFlag
}
} else {
returnCode |= minikubeNotRunningStatusFlag
}

status := Status{
Host: hostSt,
Kubelet: kubeletSt,
APIServer: apiserverSt,
Kubeconfig: kubeconfigSt,
}
tmpl, err := template.New("status").Parse(statusFormat)
if err != nil {
exit.WithError("Error creating status template", err)
}
err = tmpl.Execute(os.Stdout, status)
if err != nil {
exit.WithError("Error executing status template", err)
}
var data [][]string
data = append(data, []string{pkg_config.GetMachineName(), hostSt, kubeletSt, apiserverSt, kubeconfigSt})

os.Exit(returnCode)
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Profile", "Host", "Kubelet", "APIServer", "Kubectl"})
table.SetAutoFormatHeaders(false)
table.SetBorders(tablewriter.Border{Left: true, Top: true, Right: true, Bottom: true})
table.SetCenterSeparator("|")
table.AppendBulk(data) // Add Bulk Data
table.Render()
},
}

func init() {
statusCmd.Flags().StringVar(&statusFormat, "format", constants.DefaultStatusFormat,
`Go template format string for the status output. The format for Go templates can be found here: https://golang.org/pkg/text/template/
For the list accessible variables for the template, see the struct values here: https://godoc.org/k8s.io/minikube/cmd/minikube/cmd#Status`)
RootCmd.AddCommand(statusCmd)
}
1 change: 1 addition & 0 deletions cmd/minikube/cmd/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func runStop(cmd *cobra.Command, args []string) {
exit.WithError("update config", err)
}
}

func init() {
RootCmd.AddCommand(stopCmd)
}
8 changes: 4 additions & 4 deletions cmd/minikube/cmd/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ var tunnelCmd = &cobra.Command{
}
glog.Infof("Creating k8s client...")

//Tunnel uses the k8s clientset to query the API server for services in the LoadBalancerEmulator.
//We define the tunnel and minikube error free if the API server responds within a second.
//This also contributes to better UX, the tunnel status check can happen every second and
//doesn't hang on the API server call during startup and shutdown time or if there is a temporary error.
// Tunnel uses the k8s clientset to query the API server for services in the LoadBalancerEmulator.
// We define the tunnel and minikube error free if the API server responds within a second.
// This also contributes to better UX, the tunnel status check can happen every second and
// doesn't hang on the API server call during startup and shutdown time or if there is a temporary error.
clientset, err := service.K8s.GetClientset(1 * time.Second)
if err != nil {
exit.WithError("error creating clientset", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sha256 8565a655345f3db2f7b78b77a2cd3103895229aa44cd0e4c710ba3559e344b5a v1.2.0.tar.gz
sha256 b92819bde71de947329814a3c649b8adb106cc03be16aae217b94297f4b843a1 v1.2.5.tar.gz
sha256 f2d578b743fb9faa5b3477b7cf4b33d00501087043a53b27754f14bbe741f891 v1.2.6.tar.gz
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# containerd
#
################################################################################
CONTAINERD_BIN_VERSION = v1.2.5
CONTAINERD_BIN_COMMIT = bb71b10fd8f58240ca47fbb579b9d1028eea7c84
CONTAINERD_BIN_VERSION = v1.2.6
CONTAINERD_BIN_COMMIT = 894b81a4b802e4eb2a91d1ce216b8817763c29fb
CONTAINERD_BIN_SITE = https://github.com/containerd/containerd/archive
CONTAINERD_BIN_SOURCE = $(CONTAINERD_BIN_VERSION).tar.gz
CONTAINERD_BIN_DEPENDENCIES = host-go libgpgme
Expand Down
1 change: 1 addition & 0 deletions deploy/iso/minikube-iso/package/docker-bin/docker-bin.hash
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ sha256 a979d9a952fae474886c7588da692ee00684cb2421d2c633c7ed415948cf0b10 docker-
sha256 346f9394393ee8db5f8bd1e229ee9d90e5b36931bdd754308b2ae68884dd6822 docker-18.06.3-ce.tgz
sha256 99ca9395e9c7ffbf75537de71aa828761f492491d02bc6e29db2920fa582c6c5 docker-18.09.5.tgz
sha256 1f3f6774117765279fce64ee7f76abbb5f260264548cf80631d68fb2d795bb09 docker-18.09.6.tgz
sha256 e106ccfa2b1f60794faaa6bae57a2dac9dc4cb33e5541fad6a826ea525d01cc4 docker-18.09.7.tgz
2 changes: 1 addition & 1 deletion deploy/iso/minikube-iso/package/docker-bin/docker-bin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
################################################################################

DOCKER_BIN_VERSION = 18.09.6
DOCKER_BIN_VERSION = 18.09.7
DOCKER_BIN_SITE = https://download.docker.com/linux/static/stable/x86_64
DOCKER_BIN_SOURCE = docker-$(DOCKER_BIN_VERSION).tgz

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ sha256 9318fa9de6e3b2c89760f08d73bf718c97c93d683611716e024d2f3283c96d90 c1e454b2
sha256 a960decadf6bd5d3cee1ca7b94455d37cc921c964061428bd9f3dd17a13c8bb3 6635b4f0c6af3810594d2770f662f34ddc15b40d.tar.gz
sha256 ad41ae930059fef18de1926cd78e00474c89290248fecdcc0e431c8aefee1deb 0a012df867a2d525f62a146d8ebdf2e6ab8a5ad5.tar.gz
sha256 e52c5d7365b2b9048f977bac8f06bf626dccb4d816d0947ec8523f543272f4ff 2b18fe1d885ee5083ef9f0838fee39b62d653e30.tar.gz
sha256 257ac2c2bbc9770998f31b73f587718848ebb09465ce2cd20fbac198ebd5726e 425e105d5a03fabd737a126ad93d62a9eeede87f.tar.gz
Loading

0 comments on commit 1ec4012

Please sign in to comment.