Skip to content

Commit

Permalink
Merge pull request kubernetes#40352 from kubernetes/revert-39033-prov…
Browse files Browse the repository at this point in the history
…ider-independent-kubemark

Revert "Refactored kubemark into cloud-provider independent code and GCE specific code"
  • Loading branch information
wojtek-t authored Jan 24, 2017
2 parents 0fac54e + fbd5c7c commit 8cc0074
Show file tree
Hide file tree
Showing 12 changed files with 318 additions and 479 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2017 The Kubernetes Authors.
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
5 changes: 2 additions & 3 deletions cluster/kubemark/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
# limitations under the License.

KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source ${KUBE_ROOT}/test/kubemark/cloud-provider-config.sh
source ${KUBE_ROOT}/cluster/${CLOUD_PROVIDER}/util.sh
source ${KUBE_ROOT}/cluster/kubemark/${CLOUD_PROVIDER}/config-default.sh
source ${KUBE_ROOT}/cluster/gce/util.sh
source ${KUBE_ROOT}/cluster/kubemark/config-default.sh
17 changes: 0 additions & 17 deletions test/kubemark/cloud-provider-config.sh

This file was deleted.

71 changes: 71 additions & 0 deletions test/kubemark/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

source "${KUBE_ROOT}/cluster/kubemark/config-default.sh"
source "${KUBE_ROOT}/cluster/kubemark/util.sh"
source "${KUBE_ROOT}/cluster/lib/util.sh"

# hack/lib/init.sh will ovewrite ETCD_VERSION if this is unset
# what what is default in hack/lib/etcd.sh
# To avoid it, if it is empty, we set it to 'avoid-overwrite' and
# clean it after that.
if [ -z "${ETCD_VERSION:-}" ]; then
ETCD_VERSION="avoid-overwrite"
fi
source "${KUBE_ROOT}/hack/lib/init.sh"
if [ "${ETCD_VERSION:-}" == "avoid-overwrite" ]; then
ETCD_VERSION=""
fi

detect-project &> /dev/null
export PROJECT
find-release-tars

MASTER_NAME="${INSTANCE_PREFIX}-kubemark-master"
MASTER_TAG="kubemark-master"
EVENT_STORE_NAME="${INSTANCE_PREFIX}-event-store"

RETRIES=3

export KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh"
export KUBEMARK_DIRECTORY="${KUBE_ROOT}/test/kubemark"
export RESOURCE_DIRECTORY="${KUBEMARK_DIRECTORY}/resources"

# Runs gcloud compute command with the given parameters. Up to $RETRIES will be made
# to execute the command.
# arguments:
# $@: all stuff that goes after 'gcloud compute '
function run-gcloud-compute-with-retries {
echo "" > /tmp/gcloud_retries
for attempt in $(seq 1 ${RETRIES}); do
if ! gcloud compute $@ &> /tmp/gcloud_retries; then
if [[ $(grep -c "already exists" /tmp/gcloud_retries) -gt 0 ]]; then
if [[ "${attempt}" == 1 ]]; then
echo -e "${color_red} Failed to $1 $2 $3 as the resource hasn't been deleted from a previous run.${color_norm}" >& 2
exit 1
fi
echo -e "${color_yellow}Succeeded to $1 $2 $3 in the previous attempt, but status response wasn't received.${color_norm}"
return 0
fi
echo -e "${color_yellow}Attempt $(($attempt+1)) failed to $1 $2 $3. Retrying.${color_norm}" >& 2
sleep $(($attempt * 5))
else
return 0
fi
done
echo -e "${color_red} Failed to $1 $2 $3.${color_norm}" >& 2
exit 1
}
4 changes: 3 additions & 1 deletion test/kubemark/configure-kubectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This script assumes that kubectl binary is present in PATH.
curl https://sdk.cloud.google.com 2> /dev/null | bash
sudo gcloud components update kubectl -q
sudo ln -s /usr/local/share/google/google-cloud-sdk/bin/kubectl /bin/
kubectl config set-cluster hollow-cluster --server=http://localhost:8080 --insecure-skip-tls-verify=true
kubectl config set-credentials $(whoami)
kubectl config set-context hollow-context --cluster=hollow-cluster --user=$(whoami)
140 changes: 0 additions & 140 deletions test/kubemark/gce/util.sh

This file was deleted.

2 changes: 1 addition & 1 deletion test/kubemark/resources/heapster_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"/eventer"
],
"args": [
"--source=kubernetes:https://{{MASTER_IP}}:443?inClusterConfig=0&useServiceAccount=0&auth=/kubeconfig/heapster.kubeconfig"
"--source=kubernetes:https://104.197.233.84:443?inClusterConfig=0&useServiceAccount=0&auth=/kubeconfig/heapster.kubeconfig"
],
"volumeMounts": [
{
Expand Down
4 changes: 2 additions & 2 deletions test/kubemark/resources/hollow-node_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"command": [
"/bin/sh",
"-c",
"./kubemark.sh --morph=kubelet --name=$(NODE_NAME) --kubeconfig=/kubeconfig/kubelet.kubeconfig $(CONTENT_TYPE) --v=2 1>>/var/logs/kubelet_$(NODE_NAME).log 2>&1"
"./kubemark.sh --morph=kubelet --name=$(NODE_NAME) --kubeconfig=/kubeconfig/kubelet.kubeconfig $(CONTENT_TYPE) --v=2 1>>/var/logs/kubelet_$(MY_POD_NAME).log 2>&1"
],
"volumeMounts": [
{
Expand Down Expand Up @@ -129,7 +129,7 @@
"command": [
"/bin/sh",
"-c",
"./kubemark.sh --morph=proxy --name=$(NODE_NAME) --kubeconfig=/kubeconfig/kubeproxy.kubeconfig $(CONTENT_TYPE) --v=2 1>>/var/logs/kubeproxy_$(NODE_NAME).log 2>&1"
"./kubemark.sh --morph=proxy --name=$(NODE_NAME) --kubeconfig=/kubeconfig/kubeproxy.kubeconfig $(CONTENT_TYPE) --v=2 1>>/var/logs/kube_proxy_$(MY_POD_NAME).log 2>&1"
],
"volumeMounts": [
{
Expand Down
11 changes: 5 additions & 6 deletions test/kubemark/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..

source "${KUBE_ROOT}/test/kubemark/cloud-provider-config.sh"
source "${KUBE_ROOT}/test/kubemark/${CLOUD_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kubemark/${CLOUD_PROVIDER}/config-default.sh"

export KUBERNETES_PROVIDER="kubemark"
export KUBE_CONFIG_FILE="config-default.sh"

KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..

# We need an absolute path to KUBE_ROOT
ABSOLUTE_ROOT=$(readlink -f ${KUBE_ROOT})

source ${KUBE_ROOT}/cluster/kubemark/util.sh
source ${KUBE_ROOT}/cluster/kubemark/config-default.sh

echo "Kubemark master name: ${MASTER_NAME}"

detect-master
Expand Down
63 changes: 0 additions & 63 deletions test/kubemark/skeleton/util.sh

This file was deleted.

Loading

0 comments on commit 8cc0074

Please sign in to comment.