Skip to content

Commit

Permalink
Merge pull request #4364 from tstromberg/no-docker-version
Browse files Browse the repository at this point in the history
docker-env: Remove DOCKER_API_VERSION
  • Loading branch information
tstromberg authored May 29, 2019
2 parents c83d5f7 + a3f557d commit db37c03
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 78 deletions.
31 changes: 14 additions & 17 deletions cmd/minikube/cmd/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ import (
"github.com/spf13/cobra"
"k8s.io/minikube/pkg/minikube/cluster"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/machine"
)

const (
envTmpl = `{{ .Prefix }}DOCKER_TLS_VERIFY{{ .Delimiter }}{{ .DockerTLSVerify }}{{ .Suffix }}{{ .Prefix }}DOCKER_HOST{{ .Delimiter }}{{ .DockerHost }}{{ .Suffix }}{{ .Prefix }}DOCKER_CERT_PATH{{ .Delimiter }}{{ .DockerCertPath }}{{ .Suffix }}{{ .Prefix }}DOCKER_API_VERSION{{ .Delimiter }}{{ .DockerAPIVersion }}{{ .Suffix }}{{ if .NoProxyVar }}{{ .Prefix }}{{ .NoProxyVar }}{{ .Delimiter }}{{ .NoProxyValue }}{{ .Suffix }}{{end}}{{ .UsageHint }}`
envTmpl = `{{ .Prefix }}DOCKER_TLS_VERIFY{{ .Delimiter }}{{ .DockerTLSVerify }}{{ .Suffix }}{{ .Prefix }}DOCKER_HOST{{ .Delimiter }}{{ .DockerHost }}{{ .Suffix }}{{ .Prefix }}DOCKER_CERT_PATH{{ .Delimiter }}{{ .DockerCertPath }}{{ .Suffix }}{{ if .NoProxyVar }}{{ .Prefix }}{{ .NoProxyVar }}{{ .Delimiter }}{{ .NoProxyValue }}{{ .Suffix }}{{end}}{{ .UsageHint }}`

fishSetPfx = "set -gx "
fishSetSfx = "\";\n"
Expand Down Expand Up @@ -108,16 +107,15 @@ REM @FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i

// ShellConfig represents the shell config
type ShellConfig struct {
Prefix string
Delimiter string
Suffix string
DockerCertPath string
DockerHost string
DockerTLSVerify string
DockerAPIVersion string
UsageHint string
NoProxyVar string
NoProxyValue string
Prefix string
Delimiter string
Suffix string
DockerCertPath string
DockerHost string
DockerTLSVerify string
UsageHint string
NoProxyVar string
NoProxyValue string
}

var (
Expand Down Expand Up @@ -165,11 +163,10 @@ func shellCfgSet(api libmachine.API) (*ShellConfig, error) {
}

shellCfg := &ShellConfig{
DockerCertPath: envMap["DOCKER_CERT_PATH"],
DockerHost: envMap["DOCKER_HOST"],
DockerTLSVerify: envMap["DOCKER_TLS_VERIFY"],
DockerAPIVersion: constants.DockerAPIVersion,
UsageHint: generateUsageHint(userShell),
DockerCertPath: envMap["DOCKER_CERT_PATH"],
DockerHost: envMap["DOCKER_HOST"],
DockerTLSVerify: envMap["DOCKER_TLS_VERIFY"],
UsageHint: generateUsageHint(userShell),
}

if noProxy {
Expand Down
110 changes: 52 additions & 58 deletions cmd/minikube/cmd/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ var defaultAPI = &tests.MockAPI{
// Most of the shell cfg isn't configurable
func newShellCfg(shell, prefix, suffix, delim string) *ShellConfig {
return &ShellConfig{
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
DockerAPIVersion: constants.DockerAPIVersion,
UsageHint: generateUsageHint(shell),
Prefix: prefix,
Suffix: suffix,
Delimiter: delim,
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
UsageHint: generateUsageHint(shell),
Prefix: prefix,
Suffix: suffix,
Delimiter: delim,
}
}

Expand Down Expand Up @@ -141,16 +140,15 @@ func TestShellCfgSet(t *testing.T) {
noProxyValue: "",
noProxyFlag: true,
expectedShellCfg: &ShellConfig{
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
DockerAPIVersion: constants.DockerAPIVersion,
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "NO_PROXY",
NoProxyValue: "127.0.0.1",
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "NO_PROXY",
NoProxyValue: "127.0.0.1",
},
},
{
Expand All @@ -161,16 +159,15 @@ func TestShellCfgSet(t *testing.T) {
noProxyValue: "",
noProxyFlag: true,
expectedShellCfg: &ShellConfig{
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
DockerAPIVersion: constants.DockerAPIVersion,
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "127.0.0.1",
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "127.0.0.1",
},
},
{
Expand All @@ -181,16 +178,15 @@ func TestShellCfgSet(t *testing.T) {
noProxyValue: "127.0.0.1",
noProxyFlag: true,
expectedShellCfg: &ShellConfig{
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
DockerAPIVersion: constants.DockerAPIVersion,
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "127.0.0.1",
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "127.0.0.1",
},
},
{
Expand All @@ -201,16 +197,15 @@ func TestShellCfgSet(t *testing.T) {
noProxyValue: "0.0.0.0",
noProxyFlag: true,
expectedShellCfg: &ShellConfig{
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
DockerAPIVersion: constants.DockerAPIVersion,
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "0.0.0.0,127.0.0.1",
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "0.0.0.0,127.0.0.1",
},
},
{
Expand All @@ -221,16 +216,15 @@ func TestShellCfgSet(t *testing.T) {
noProxyValue: "0.0.0.0,127.0.0.1",
noProxyFlag: true,
expectedShellCfg: &ShellConfig{
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
DockerAPIVersion: constants.DockerAPIVersion,
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "0.0.0.0,127.0.0.1",
DockerCertPath: constants.MakeMiniPath("certs"),
DockerTLSVerify: "1",
DockerHost: "tcp://127.0.0.1:2376",
UsageHint: usageHintMap["bash"],
Prefix: bashSetPfx,
Suffix: bashSetSfx,
Delimiter: bashSetDelim,
NoProxyVar: "no_proxy",
NoProxyValue: "0.0.0.0,127.0.0.1",
},
},
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,6 @@ func GetProfileFile(profile string) string {
return filepath.Join(GetMinipath(), "profiles", profile, "config.json")
}

// DockerAPIVersion is the API version implemented by Docker running in the minikube VM.
const DockerAPIVersion = "1.39"

// ReportingURL is the URL for reporting a minikube error
const ReportingURL = "https://clouderrorreporting.googleapis.com/v1beta1/projects/k8s-minikube/events:report?key=AIzaSyACUwzG0dEPcl-eOgpDKnyKoUFgHdfoFuA"

Expand Down

0 comments on commit db37c03

Please sign in to comment.