Merge pull request #13168 from spowelljr/supressDockerPerformance
Added env to suppress Docker performance messagespull/13182/head
commit
9200267c04
|
@ -29,6 +29,7 @@ function Write-GithubStatus {
|
|||
|
||||
$env:SHORT_COMMIT=$env:COMMIT.substring(0, 7)
|
||||
$gcs_bucket="minikube-builds/logs/$env:MINIKUBE_LOCATION/$env:ROOT_JOB_ID"
|
||||
$env:MINIKUBE_SUPPRESS_DOCKER_PERFORMANCE=true
|
||||
|
||||
# Docker's kubectl breaks things, and comes earlier in the path than the regular kubectl. So download the expected kubectl and replace Docker's version.
|
||||
(New-Object Net.WebClient).DownloadFile("https://dl.k8s.io/release/v1.20.0/bin/windows/amd64/kubectl.exe", "C:\Program Files\Docker\Docker\resources\bin\kubectl.exe")
|
||||
|
|
|
@ -33,6 +33,7 @@ readonly TEST_HOME="${TEST_ROOT}/${OS_ARCH}-${DRIVER}-${CONTAINER_RUNTIME}-${MIN
|
|||
export GOPATH="$HOME/go"
|
||||
export KUBECONFIG="${TEST_HOME}/kubeconfig"
|
||||
export PATH=$PATH:"/usr/local/bin/:/usr/local/go/bin/:$GOPATH/bin"
|
||||
export MINIKUBE_SUPPRESS_DOCKER_PERFORMANCE=true
|
||||
|
||||
readonly TIMEOUT=${1:-120m}
|
||||
|
||||
|
|
|
@ -21,8 +21,10 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -84,6 +86,19 @@ func PrefixCmd(cmd *exec.Cmd) *exec.Cmd {
|
|||
return cmd
|
||||
}
|
||||
|
||||
func suppressDockerMessage() bool {
|
||||
envKey := "MINIKUBE_SUPPRESS_DOCKER_PERFORMANCE"
|
||||
env := os.Getenv(envKey)
|
||||
suppress, err := strconv.ParseBool(env)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("failed to parse bool from the %s env, defaulting to 'false'; received: %s: %v", envKey, env, err)
|
||||
klog.Warning(msg)
|
||||
out.Styled(style.Warning, msg)
|
||||
return false
|
||||
}
|
||||
return suppress
|
||||
}
|
||||
|
||||
// runCmd runs a command exec.Command against docker daemon or podman
|
||||
func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
|
||||
cmd = PrefixCmd(cmd)
|
||||
|
@ -135,7 +150,7 @@ func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
|
|||
start := time.Now()
|
||||
err := cmd.Run()
|
||||
elapsed := time.Since(start)
|
||||
if warn && !out.JSON {
|
||||
if warn && !out.JSON && !suppressDockerMessage() {
|
||||
if elapsed > warnTime {
|
||||
warnLock.Lock()
|
||||
_, ok := alreadyWarnedCmds[rr.Command()]
|
||||
|
|
|
@ -114,14 +114,12 @@ Some features can only be accessed by minikube specific environment variables, h
|
|||
|
||||
* **MINIKUBE_IN_STYLE** - (bool) manually sets whether or not emoji and colors should appear in minikube. Set to false or 0 to disable this feature, true or 1 to force it to be turned on.
|
||||
|
||||
* **MINIKUBE_WANTUPDATENOTIFICATION** - (bool) sets whether the user wants an update notification for new minikube versions
|
||||
|
||||
* **MINIKUBE_REMINDERWAITPERIODINHOURS** - (int) sets the number of hours to check for an update notification
|
||||
|
||||
* **CHANGE_MINIKUBE_NONE_USER** - (bool) automatically change ownership of ~/.minikube to the value of $SUDO_USER
|
||||
|
||||
* **MINIKUBE_ENABLE_PROFILING** - (int, `1` enables it) enables trace profiling to be generated for minikube
|
||||
|
||||
* **MINIKUBE_SUPPRESS_DOCKER_PERFORMANCE** - (bool) suppresses Docker performance warnings when Docker is slow
|
||||
|
||||
### Example: Disabling emoji
|
||||
|
||||
{{% tabs %}}
|
||||
|
|
|
@ -46,6 +46,6 @@ curl -LO \
|
|||
https://storage.googleapis.com/kubernetes-release/release/$kv/bin/linux/amd64/kubectl \
|
||||
&& install kubectl /tmp/
|
||||
|
||||
export MINIKUBE_WANTUPDATENOTIFICATION=false
|
||||
/tmp/minikube-linux-amd64 config set WantUpdateNotification false
|
||||
/tmp/minikube-linux-amd64 start --driver=docker
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue