Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Initial implementation of kubectl command" #4192

Merged
merged 1 commit into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions cmd/minikube/cmd/kubectl.go

This file was deleted.

3 changes: 1 addition & 2 deletions pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"net"
"net/http"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -573,7 +572,7 @@ func downloadBinaries(cfg config.KubernetesConfig, c bootstrapper.CommandRunner)
for _, bin := range constants.GetKubeadmCachedBinaries() {
bin := bin
g.Go(func() error {
path, err := machine.CacheBinary(bin, cfg.KubernetesVersion, "linux", runtime.GOARCH)
path, err := machine.CacheBinary(bin, cfg.KubernetesVersion)
if err != nil {
return errors.Wrapf(err, "downloading %s", bin)
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -220,13 +221,13 @@ const (
)

// GetKubernetesReleaseURL gets the location of a kubernetes client
func GetKubernetesReleaseURL(binaryName, version, osName, archName string) string {
return fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/%s/bin/%s/%s/%s", version, osName, archName, binaryName)
func GetKubernetesReleaseURL(binaryName, version string) string {
return fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/%s/%s", version, runtime.GOARCH, binaryName)
}

// GetKubernetesReleaseURLSHA1 gets the location of a kubernetes client checksum
func GetKubernetesReleaseURLSHA1(binaryName, version, osName, archName string) string {
return fmt.Sprintf("%s.sha1", GetKubernetesReleaseURL(binaryName, version, osName, archName))
func GetKubernetesReleaseURLSHA1(binaryName, version string) string {
return fmt.Sprintf("%s.sha1", GetKubernetesReleaseURL(binaryName, version))
}

// IsMinikubeChildProcess is the name of "is minikube child process" variable
Expand Down
14 changes: 4 additions & 10 deletions pkg/minikube/machine/cache_binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"crypto"
"os"
"path"
"runtime"

"github.com/golang/glog"
"github.com/jimmidyson/go-download"
Expand All @@ -40,7 +39,7 @@ func CacheBinariesForBootstrapper(version string, clusterBootstrapper string) er
for _, bin := range binaries {
bin := bin
g.Go(func() error {
if _, err := CacheBinary(bin, version, "linux", runtime.GOARCH); err != nil {
if _, err := CacheBinary(bin, version); err != nil {
return errors.Wrapf(err, "caching image %s", bin)
}
return nil
Expand All @@ -50,11 +49,11 @@ func CacheBinariesForBootstrapper(version string, clusterBootstrapper string) er
}

// CacheBinary will cache a binary on the host
func CacheBinary(binary, version, osName, archName string) (string, error) {
func CacheBinary(binary, version string) (string, error) {
targetDir := constants.MakeMiniPath("cache", version)
targetFilepath := path.Join(targetDir, binary)

url := constants.GetKubernetesReleaseURL(binary, version, osName, archName)
url := constants.GetKubernetesReleaseURL(binary, version)

_, err := os.Stat(targetFilepath)
// If it exists, do no verification and continue
Expand All @@ -74,18 +73,13 @@ func CacheBinary(binary, version, osName, archName string) (string, error) {
Mkdirs: download.MkdirAll,
}

options.Checksum = constants.GetKubernetesReleaseURLSHA1(binary, version, osName, archName)
options.Checksum = constants.GetKubernetesReleaseURLSHA1(binary, version)
options.ChecksumHash = crypto.SHA1

console.OutStyle("file-download", "Downloading %s %s", binary, version)
if err := download.ToFile(url, targetFilepath, options); err != nil {
return "", errors.Wrapf(err, "Error downloading %s %s", binary, version)
}
if osName == runtime.GOOS && archName == runtime.GOARCH {
if err = os.Chmod(targetFilepath, 0755); err != nil {
return "", errors.Wrapf(err, "chmod +x %s", targetFilepath)
}
}
return targetFilepath, nil
}

Expand Down