From fd01ed8fdb343ff9883300a8e0ad6b52532ae5a9 Mon Sep 17 00:00:00 2001 From: shashidharatd Date: Mon, 21 Nov 2016 13:04:42 +0530 Subject: [PATCH] [Federation][init-11.2] use USE_KUBEFED env var to choose bw old and new federation deployment --- federation/cluster/common.sh | 10 +++++----- federation/cluster/federation-up.sh | 12 +++++++++--- .../manifests/federation-apiserver-deployment.yaml | 2 +- .../federation-controller-manager-deployment.yaml | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/federation/cluster/common.sh b/federation/cluster/common.sh index e80f76d37a0..e4e10302b37 100644 --- a/federation/cluster/common.sh +++ b/federation/cluster/common.sh @@ -65,11 +65,11 @@ function create-federation-api-objects { : "${FEDERATION_IMAGE_TAG?Must set FEDERATION_IMAGE_TAG env var}" export FEDERATION_APISERVER_DEPLOYMENT_NAME="federation-apiserver" - export FEDERATION_APISERVER_IMAGE_REPO="${FEDERATION_PUSH_REPO_BASE}/hyperkube" + export FEDERATION_APISERVER_IMAGE_REPO="${FEDERATION_PUSH_REPO_BASE}/hyperkube-amd64" export FEDERATION_APISERVER_IMAGE_TAG="${FEDERATION_IMAGE_TAG}" export FEDERATION_CONTROLLER_MANAGER_DEPLOYMENT_NAME="federation-controller-manager" - export FEDERATION_CONTROLLER_MANAGER_IMAGE_REPO="${FEDERATION_PUSH_REPO_BASE}/hyperkube" + export FEDERATION_CONTROLLER_MANAGER_IMAGE_REPO="${FEDERATION_PUSH_REPO_BASE}/hyperkube-amd64" export FEDERATION_CONTROLLER_MANAGER_IMAGE_TAG="${FEDERATION_IMAGE_TAG}" if [[ -z "${FEDERATION_DNS_PROVIDER:-}" ]]; then @@ -165,7 +165,7 @@ function create-federation-api-objects { # controller manager can use to talk to the federation-apiserver. # Note that the file name should be "kubeconfig" so that the secret key gets the same name. KUBECONFIG_DIR=$(dirname ${KUBECONFIG:-$DEFAULT_KUBECONFIG}) - CONTEXT=federation-cluster \ + CONTEXT=${FEDERATION_KUBE_CONTEXT} \ KUBE_BEARER_TOKEN="$FEDERATION_API_TOKEN" \ KUBE_USER="${KUBE_USER}" \ KUBE_PASSWORD="${KUBE_PASSWORD}" \ @@ -207,7 +207,7 @@ function create-federation-api-objects { done # Update the users kubeconfig to include federation-apiserver credentials. - CONTEXT=federation-cluster \ + CONTEXT=${FEDERATION_KUBE_CONTEXT} \ KUBE_BEARER_TOKEN="$FEDERATION_API_TOKEN" \ KUBE_USER="${KUBE_USER}" \ KUBE_PASSWORD="${KUBE_PASSWORD}" \ @@ -296,7 +296,7 @@ function push-federation-images { source "${KUBE_ROOT}/build/common.sh" source "${KUBE_ROOT}/hack/lib/util.sh" - local FEDERATION_BINARIES=${FEDERATION_BINARIES:-"hyperkube"} + local FEDERATION_BINARIES=${FEDERATION_BINARIES:-"hyperkube-amd64"} local bin_dir="${KUBE_ROOT}/_output/${KUBE_BUILD_STAGE}/server/${KUBE_PLATFORM}-${KUBE_ARCH}/kubernetes/server/bin" diff --git a/federation/cluster/federation-up.sh b/federation/cluster/federation-up.sh index f756e633ead..d9ed22bc194 100755 --- a/federation/cluster/federation-up.sh +++ b/federation/cluster/federation-up.sh @@ -38,9 +38,9 @@ source "${KUBE_ROOT}/federation/cluster/common.sh" source "${KUBE_ROOT}/federation/develop/develop.sh" FEDERATION_NAME="${FEDERATION_NAME:-e2e-federation}" +FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-e2e-federation}" DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}" HOST_CLUSTER_CONTEXT="${FEDERATION_HOST_CLUSTER_CONTEXT:-${1}}" - readonly CLIENT_BIN_DIR="${KUBE_ROOT}/_output/${KUBE_BUILD_STAGE}/client/${KUBE_PLATFORM}-${KUBE_ARCH}/kubernetes/client/bin" kubefed="${CLIENT_BIN_DIR}/kubefed" kubectl="${CLIENT_BIN_DIR}/kubectl" @@ -79,5 +79,11 @@ function create_cluster_secrets() { done } -init -create_cluster_secrets +USE_KUBEFED="${USE_KUBEFED:-}" +if [[ "${USE_KUBEFED}" == "true" ]]; then + init + create_cluster_secrets +else + export FEDERATION_IMAGE_TAG="$(get_version)" + create-federation-api-objects +fi diff --git a/federation/manifests/federation-apiserver-deployment.yaml b/federation/manifests/federation-apiserver-deployment.yaml index 5113f5f00b3..aa4fb98dfb5 100644 --- a/federation/manifests/federation-apiserver-deployment.yaml +++ b/federation/manifests/federation-apiserver-deployment.yaml @@ -17,7 +17,7 @@ spec: - name: apiserver image: {{.FEDERATION_APISERVER_IMAGE_REPO}}:{{.FEDERATION_APISERVER_IMAGE_TAG}} command: - - /usr/local/bin/hyperkube + - /hyperkube - federation-apiserver - --bind-address=0.0.0.0 - --etcd-servers=http://localhost:2379 diff --git a/federation/manifests/federation-controller-manager-deployment.yaml b/federation/manifests/federation-controller-manager-deployment.yaml index c339a306995..9b3263b0caa 100644 --- a/federation/manifests/federation-controller-manager-deployment.yaml +++ b/federation/manifests/federation-controller-manager-deployment.yaml @@ -31,7 +31,7 @@ spec: mountPath: "/etc/federation/controller-manager" image: {{.FEDERATION_CONTROLLER_MANAGER_IMAGE_REPO}}:{{.FEDERATION_CONTROLLER_MANAGER_IMAGE_TAG}} command: - - /usr/local/bin/hyperkube + - /hyperkube - federation-controller-manager - --master=https://{{.FEDERATION_APISERVER_DEPLOYMENT_NAME}}:443 - --kubeconfig=/etc/federation/controller-manager/kubeconfig