kubernetes/test/kubemark/skeleton/util.sh
Jakub Pierewoj f9c4551a94 Use private master IP in GCE kubemark tests
Currently hollow nodes communicate with kubemark master using public
master IP, which results in each call going through cloud NAT. Cloud NAT
limitations become performance bottleneck (see kubernetes/perf-tests/issues/874).

To mitigate this, in this change, a second kubeconfig called "internal"
is created. It uses private master IP and is used to set up hollow nodes.

Note that we still need the original kubemark kubeconfig (using public master IP)
to be able to communicate with the master from outside the cluster (when
setting it up or running tests).

Testing:
- set up kubemark cluster, verified apiserver logs to confirm that the call
  from hollow nodes did not go through NAT
2019-12-17 12:49:50 +01:00

63 lines
2.2 KiB
Bash

#!/usr/bin/env 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.
# This script contains the helper functions that each provider hosting
# Kubermark must implement to use test/kubemark/start-kubemark.sh and
# test/kubemark/stop-kubemark.sh scripts.
# This function should authenticate docker to be able to read/write to
# the right container registry (needed for pushing kubemark image).
function authenticate-docker {
echo "Configuring registry authentication" 1>&2
}
# This function should create kubemark master and write kubeconfig to
# "${RESOURCE_DIRECTORY}/kubeconfig.kubemark".
# If a cluster uses private master IP, create-kubemark-master might also write
# a second kubeconfig to "${RESOURCE_DIRECTORY}/kubeconfig-internal.kubemark".
# The difference between these two kubeconfigs is that the internal one uses
# private master IP, which might be better suited for setting up hollow nodes.
function create-kubemark-master {
echo "Creating cluster..."
}
# This function should delete kubemark master.
function delete-kubemark-master {
echo "Deleting cluster..."
}
# This function should return node labels.
function calculate-node-labels {
echo ""
}
# Common colors used throughout the kubemark scripts
if [[ -z "${color_start-}" ]]; then
declare -r color_start="\033["
# shellcheck disable=SC2034
declare -r color_red="${color_start}0;31m"
# shellcheck disable=SC2034
declare -r color_yellow="${color_start}0;33m"
# shellcheck disable=SC2034
declare -r color_green="${color_start}0;32m"
# shellcheck disable=SC2034
declare -r color_blue="${color_start}1;34m"
# shellcheck disable=SC2034
declare -r color_cyan="${color_start}1;36m"
# shellcheck disable=SC2034
declare -r color_norm="${color_start}0m"
fi