Commit 0107e93c authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #40557 from shyamjvs/refactor-returns

Automatic merge from submit-queue (batch tested with PRs 39469, 40557) Refactored kubemark code into provider-specific and provider-independent parts [Part-1] Applying part of the changes of PR https://github.com/kubernetes/kubernetes/pull/39033 (which refactored kubemark code completely). The changes included in this PR are: The following are the major changes as part of this refactoring: - Moved cluster-kubemark/config-default.sh -> cluster-kubemark/gce/config-default.sh (as the config is gce-specific) - Changed kubernetes/cluster/kubemark/util.sh to source the right scripts based on the cloud-provider - Added the file test/kubemark/cloud-provider-config.sh which sets the variable CLOUD_PROVIDER that is later picked up by various scripts (run-e2e-tests.sh, common.sh) - Removed useless code and restructured start-kubemark.sh and stop-kubemark.sh scripts. @kubernetes/sig-scalability-misc @wojtek-t @gmarek
parents 760a51f0 c62e5214
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
# Copyright 2017 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.
......
......@@ -15,5 +15,6 @@
# limitations under the License.
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source ${KUBE_ROOT}/cluster/gce/util.sh
source ${KUBE_ROOT}/cluster/kubemark/config-default.sh
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
#!/bin/bash
# Copyright 2017 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.
CLOUD_PROVIDER="${CLOUD_PROVIDER:-gce}"
......@@ -14,7 +14,8 @@
# 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}/test/kubemark/cloud-provider-config.sh"
source "${KUBE_ROOT}/cluster/kubemark/${CLOUD_PROVIDER}/config-default.sh"
source "${KUBE_ROOT}/cluster/kubemark/util.sh"
source "${KUBE_ROOT}/cluster/lib/util.sh"
......
......@@ -14,9 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
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/
# This script assumes that kubectl binary is present in PATH.
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)
......@@ -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_$(MY_POD_NAME).log 2>&1"
"./kubemark.sh --morph=kubelet --name=$(NODE_NAME) --kubeconfig=/kubeconfig/kubelet.kubeconfig $(CONTENT_TYPE) --v=2 1>>/var/logs/kubelet_$(NODE_NAME).log 2>&1"
],
"volumeMounts": [
{
......@@ -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/kube_proxy_$(MY_POD_NAME).log 2>&1"
"./kubemark.sh --morph=proxy --name=$(NODE_NAME) --kubeconfig=/kubeconfig/kubeproxy.kubeconfig $(CONTENT_TYPE) --v=2 1>>/var/logs/kubeproxy_$(NODE_NAME).log 2>&1"
],
"volumeMounts": [
{
......
......@@ -22,8 +22,9 @@ 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
source "${KUBE_ROOT}/test/kubemark/cloud-provider-config.sh"
source "${KUBE_ROOT}/cluster/kubemark/util.sh"
source "${KUBE_ROOT}/cluster/kubemark/${CLOUD_PROVIDER}/config-default.sh"
echo "Kubemark master name: ${MASTER_NAME}"
......
......@@ -14,15 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Script that destroys Kubemark clusters and deletes all GCE resources created for Master
# Script that destroys Kubemark cluster and deletes all master resources.
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/test/kubemark/common.sh"
"${KUBECTL}" delete -f "${RESOURCE_DIRECTORY}/hollow-kubelet.json" &> /dev/null || true
"${KUBECTL}" delete -f "${RESOURCE_DIRECTORY}/addons" &> /dev/null || true
"${KUBECTL}" delete -f "${RESOURCE_DIRECTORY}/hollow-node.json" &> /dev/null || true
"${KUBECTL}" delete -f "${RESOURCE_DIRECTORY}/kubemark-ns.json" &> /dev/null || true
rm -rf "${RESOURCE_DIRECTORY}/addons"
rm -rf "${RESOURCE_DIRECTORY}/addons" \
"${RESOURCE_DIRECTORY}/kubeconfig.kubemark" \
"${RESOURCE_DIRECTORY}/hollow-node.json" \
"${RESOURCE_DIRECTORY}/kubemark-master-env.sh" &> /dev/null || true
GCLOUD_COMMON_ARGS="--project ${PROJECT} --zone ${ZONE} --quiet"
......@@ -51,10 +56,3 @@ if [ "${SEPARATE_EVENT_MACHINE:-false}" == "true" ]; then
gcloud compute disks delete "${EVENT_STORE_NAME}-pd" \
${GCLOUD_COMMON_ARGS} || true
fi
rm -rf "${RESOURCE_DIRECTORY}/addons" "${RESOURCE_DIRECTORY}/kubeconfig.kubemark" &> /dev/null || true
rm "${RESOURCE_DIRECTORY}/ca.crt" \
"${RESOURCE_DIRECTORY}/kubecfg.crt" \
"${RESOURCE_DIRECTORY}/kubecfg.key" \
"${RESOURCE_DIRECTORY}/hollow-node.json" \
"${RESOURCE_DIRECTORY}/kubemark-master-env.sh" &> /dev/null || true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment