From 8fb8e20f2c3cb2762ffa95cd10b06b57f413a007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Wed, 18 Mar 2015 15:31:11 +0100 Subject: [PATCH] Make kube-push able to push local binaries built by `make` and not only releases built by `make release`. The behavior is conditionned by the KUBE_PUSH environment variable. --- cluster/libvirt-coreos/user_data_master.yml | 3 +- cluster/libvirt-coreos/util.sh | 29 ++++++++++++++++++- docs/getting-started-guides/libvirt-coreos.md | 12 +++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/cluster/libvirt-coreos/user_data_master.yml b/cluster/libvirt-coreos/user_data_master.yml index 7fbf6e52354bc..256c62fa2ce41 100644 --- a/cluster/libvirt-coreos/user_data_master.yml +++ b/cluster/libvirt-coreos/user_data_master.yml @@ -69,7 +69,8 @@ coreos: ConditionPathIsDirectory=/opt/kubernetes/addons Description=Kubernetes addons Documentation=https://github.com/GoogleCloudPlatform/kubernetes - Requires=opt-kubernetes.mount kube-apiserver.service + Requires=opt-kubernetes.mount + Wants=kube-apiserver.service [Service] Type=oneshot diff --git a/cluster/libvirt-coreos/util.sh b/cluster/libvirt-coreos/util.sh index 52a8f3f0ad703..7524570245f91 100644 --- a/cluster/libvirt-coreos/util.sh +++ b/cluster/libvirt-coreos/util.sh @@ -123,7 +123,7 @@ function initialize-pool { # fi mkdir -p "$POOL_PATH/kubernetes" - kube-push + kube-push-internal mkdir -p "$POOL_PATH/kubernetes/manifests" if [[ "$ENABLE_NODE_LOGGING" == "true" ]]; then @@ -258,10 +258,37 @@ function upload-server-tars { # Update a kubernetes cluster with latest source function kube-push { + kube-push-internal + ssh-to-node "$MASTER_NAME" "sudo systemctl restart kube-apiserver kube-controller-manager kube-scheduler" + for ((i=0; i < NUM_MINIONS; i++)); do + ssh-to-node "${MINION_NAMES[$i]}" "sudo systemctl restart kubelet kube-proxy" + done + wait-cluster-readiness +} + +function kube-push-internal { + case "${KUBE_PUSH:-release}" in + release) + kube-push-release;; + local) + kube-push-local;; + *) + echo "The only known push methods are \"release\" to use the relase tarball or \"local\" to use the binaries built by make. KUBE_PUSH is set \"$KUBE_PUSH\"" >&2 + return 1;; + esac +} + +function kube-push-release { find-release-tars upload-server-tars } +function kube-push-local { + rm -rf "$POOL_PATH/kubernetes/bin/*" + mkdir -p "$POOL_PATH/kubernetes/bin" + cp "${KUBE_ROOT}/_output/local/go/bin"/* "$POOL_PATH/kubernetes/bin" +} + # Execute prior to running tests to build a release if required for env function test-build-release { echo "TODO" diff --git a/docs/getting-started-guides/libvirt-coreos.md b/docs/getting-started-guides/libvirt-coreos.md index 8effbff7bdd52..1fc4aada4ce17 100644 --- a/docs/getting-started-guides/libvirt-coreos.md +++ b/docs/getting-started-guides/libvirt-coreos.md @@ -91,6 +91,11 @@ The `KUBERNETES_PROVIDER` environment variable tells all of the various cluster The `NUM_MINIONS` environment variable may be set to specify the number of minions to start. If it is not set, the number of minions defaults to 3. +The `KUBE_PUSH` environment variable may be set to specify which kubernetes binaries must be deployed on the cluster. Its possible values are: + +* `release` (default if `KUBE_PUSH` is not set) will deploy the binaries of `_output/release-tars/kubernetes-server-….tar.gz`. This is built with `make release` or `make release-skip-tests`. +* `local` will deploy the binaries of `_output/local/go/bin`. These are built with `make`. + You can check that your machines are there and running with: ``` @@ -149,12 +154,17 @@ Destroy the libvirt-CoreOS cluster cluster/kube-down.sh ``` -Uptade the libvirt-CoreOS cluster with a new Kubernetes release: +Update the libvirt-CoreOS cluster with a new Kubernetes release produced by `make release` or `make release-skip-tests`: ``` cluster/kube-push.sh ``` +Update the libvirt-CoreOS cluster with the locally built Kubernetes binaries produced by `make`: +``` +KUBE_PUSH=local cluster/kube-push.sh +``` + Interact with the cluster ```