tools/perf/load/pilot/setup.sh

45 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Copyright Istio 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.
#set -ex
# shellcheck disable=SC2086
WD=$(dirname $0)
# shellcheck disable=SC2086
# shellcheck disable=SC2164
WD=$(cd $WD; pwd)
function setup_test() {
local NAMESPACE=${NAMESPACE:-"pilot-load"}
local HELM_FLAGS=${HELM_FLAGS:-"instances=50"}
local INJECTION_LABEL=${INJECTION_LABEL:-"istio-injection=enabled"}
mkdir -p "${WD}/tmp"
local OUTFILE="${WD}/tmp/${NAMESPACE}.yaml"
kubectl create ns "${NAMESPACE}" || true
kubectl label namespace "${NAMESPACE}" "${INJECTION_LABEL}" || true
helm --namespace "${NAMESPACE}" --set "${HELM_FLAGS}" template "${WD}" > "${OUTFILE}"
if [[ -z "${DRY_RUN}" ]]; then
kubectl --namespace "${NAMESPACE}" apply -f "${OUTFILE}"
fi
}
setup_test