Updated docs. Added retrying for the localkube download.
parent
53e80a9c6f
commit
bd4e244ce8
2
Makefile
2
Makefile
|
|
@ -37,7 +37,7 @@ BUILD_OS := $(shell uname -s)
|
|||
|
||||
# Set the version information for the Kubernetes servers, and build localkube statically
|
||||
K8S_VERSION_LDFLAGS := $(shell $(PYTHON) hack/get_k8s_version.py 2>&1)
|
||||
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION) $(K8S_VERSION_LDFLAGS)
|
||||
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION)
|
||||
LOCALKUBE_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w -extldflags '-static'"
|
||||
|
||||
MKGOPATH := if [ ! -e $(GOPATH)/src/$(ORG) ]; then mkdir -p $(GOPATH)/src/$(ORG) && ln -s -f $(shell pwd) $(GOPATH)/src/$(ORG); fi
|
||||
|
|
|
|||
|
|
@ -35,13 +35,14 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
minikubeISO string
|
||||
memory int
|
||||
cpus int
|
||||
disk = newUnitValue(20 * units.GB)
|
||||
vmDriver string
|
||||
dockerEnv []string
|
||||
insecureRegistry []string
|
||||
minikubeISO string
|
||||
memory int
|
||||
cpus int
|
||||
disk = newUnitValue(20 * units.GB)
|
||||
vmDriver string
|
||||
dockerEnv []string
|
||||
insecureRegistry []string
|
||||
kubernetesVersion string
|
||||
)
|
||||
|
||||
// startCmd represents the start command
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ minikube start
|
|||
--docker-env=[]: Environment variables to pass to the Docker daemon. (format: key=value)
|
||||
--insecure-registry=[]: Insecure Docker registries to pass to the Docker daemon
|
||||
--iso-url="https://storage.googleapis.com/minikube/minikube-0.5.iso": Location of the minikube iso
|
||||
--kubernetes-version="v1.3.0+$Format:%h$": The kubernetes version that the minikube VM will run
|
||||
--kubernetes-version="v1.3.0": The kubernetes version that the minikube VM will run
|
||||
--memory=1024: Amount of RAM allocated to the minikube VM
|
||||
--vm-driver="virtualbox": VM driver is one of: [virtualbox vmwarefusion kvm xhyve]
|
||||
```
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ var (
|
|||
certs = []string{"ca.crt", "ca.key", "apiserver.crt", "apiserver.key"}
|
||||
)
|
||||
|
||||
var numRetries = 5
|
||||
|
||||
//This init function is used to set the logtostderr variable to false so that INFO level log info does not clutter the CLI
|
||||
//INFO lvl logging is displayed due to the kubernetes api calling flag.Set("logtostderr", "true") in its init()
|
||||
//see: https://github.com/kubernetes/kubernetes/blob/master/pkg/util/logs.go#L32-34
|
||||
|
|
@ -227,23 +229,34 @@ var assets = []fileToCopy{
|
|||
},
|
||||
}
|
||||
|
||||
// Returns a function that will return n errors, then return successfully forever.
|
||||
func localkubeDownloader(resp *http.Response, config KubernetesConfig) func() error {
|
||||
return func() (err error) {
|
||||
tmpResp, err := http.Get(util.GetLocalkubeDownloadURL(config.KubernetesVersion,
|
||||
constants.LocalkubeLinuxFilename))
|
||||
resp.Body = tmpResp.Body
|
||||
resp.ContentLength = tmpResp.ContentLength
|
||||
fmt.Println(int(resp.ContentLength))
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func UpdateCluster(h sshAble, d drivers.Driver, config KubernetesConfig) error {
|
||||
client, err := sshutil.NewSSHClient(d)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if localkubeURLWasSpecified(config) {
|
||||
resp, err := http.Get(util.GetLocalkubeDownloadURL(config.KubernetesVersion,
|
||||
constants.LocalkubeLinuxFilename))
|
||||
if err != nil {
|
||||
resp := &http.Response{}
|
||||
f := localkubeDownloader(resp, config)
|
||||
if err := util.Retry(5, f); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(int(resp.ContentLength))
|
||||
if err := sshutil.Transfer(resp.Body, int(resp.ContentLength), "/usr/local/bin",
|
||||
"localkube", "0777",
|
||||
client); err != nil {
|
||||
"localkube", "0777", client); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
} else {
|
||||
contents, err := Asset("out/localkube")
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ limitations under the License.
|
|||
package constants
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||
"k8s.io/kubernetes/pkg/util/homedir"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/constants"
|
||||
|
|
|
|||
Loading…
Reference in New Issue