Skip to content

Commit

Permalink
[1.73] Add absolute script dir path in setup-kind-ci.sh script (#6755) (
Browse files Browse the repository at this point in the history
#6789)

* Update of setup-kind-in-ci.sh file

* Backport latest version of deploy-kiali.sh
  • Loading branch information
ferhoyos committed Oct 27, 2023
1 parent 9cb9487 commit 944b7d9
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 42 deletions.
70 changes: 39 additions & 31 deletions hack/istio/multicluster/deploy-kiali.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ if ! which helm; then
fi

deploy_kiali() {
local helm_args=""
local helm_args=()
if [ "${IS_OPENSHIFT}" == "true" ]; then
helm_args="--disable-openapi-validation"
if [ "${KIALI_USE_DEV_IMAGE}" == "true" ]; then
echo "'--kiali-use-dev-image true' is only supported with minikube today - will not install Kiali"
echo "'--kiali-use-dev-image true' is not supported with Openshift today - will not install Kiali"
return 1
fi
fi
Expand All @@ -40,8 +40,8 @@ deploy_kiali() {
local web_fqdn="${2}"
local web_schema="${3}"
local keycloak_cluster_name="${4}"
[ ! -z "${web_fqdn}" ] && helm_args="--set server.web_fqdn=${web_fqdn} ${helm_args}"
[ ! -z "${web_schema}" ] && helm_args="--set server.web_schema=${web_schema} ${helm_args}"
[ ! -z "${web_fqdn}" ] && helm_args+=("--set server.web_fqdn=${web_fqdn}")
[ ! -z "${web_schema}" ] && helm_args+=("--set server.web_schema=${web_schema}")

# Setting this as an array so things expand correctly.
local auth_flags=()
Expand Down Expand Up @@ -74,13 +74,19 @@ deploy_kiali() {
fi

if [ "${KIALI_USE_DEV_IMAGE}" == "true" ]; then
local image_to_tag="quay.io/kiali/kiali:dev"
local image_to_push="${minikube_ip}:5000/kiali/kiali:dev"
echo "Tagging the dev image [${image_to_tag}] -> [${image_to_push}]..."
${DORP} tag ${image_to_tag} ${image_to_push}
echo "Pushing the dev image [${image_to_push}] to the cluster [${cluster_name}]..."
${DORP} push --tls-verify=false ${image_to_push}
helm_args="--set deployment.image_name=localhost:5000/kiali/kiali --set deployment.image_version=dev ${helm_args}"
if [ "${MANAGE_KIND}" == "true" ]; then
echo "Pushing the images into the cluster..."
make -e DORP="${DORP}" -e CLUSTER_TYPE="kind" -e KIND_NAME="${cluster_name}" cluster-push-kiali
helm_args+=('--set deployment.image_pull_policy="Never"')
else
local image_to_tag="quay.io/kiali/kiali:dev"
local image_to_push="${minikube_ip}:5000/kiali/kiali:dev"
echo "Tagging the dev image [${image_to_tag}] -> [${image_to_push}]..."
${DORP} tag ${image_to_tag} ${image_to_push}
echo "Pushing the dev image [${image_to_push}] to the cluster [${cluster_name}]..."
${DORP} push --tls-verify=false ${image_to_push}
fi
helm_args+=("--set deployment.image_name=localhost/kiali/kiali --set deployment.image_version=dev")
fi


Expand Down Expand Up @@ -135,28 +141,30 @@ EOF
fi

local helm_auth_flags="${auth_flags[*]}"

# use the latest published server helm chart (if using dev images, it is up to the user to make sure this chart works with the dev image)
helm upgrade --install \
${helm_args} \
--namespace ${ISTIO_NAMESPACE} \
${helm_auth_flags} \
--set deployment.logger.log_level="debug" \
--set external_services.grafana.url="http://grafana.istio-system:3000" \
--set external_services.grafana.dashboards[0].name="Istio Mesh Dashboard" \
--set external_services.tracing.url="http://tracing.istio-system:16685/jaeger" \
--set health_config.rate[0].kind="service" \
--set health_config.rate[0].name="y-server" \
--set health_config.rate[0].namespace="alpha" \
--set health_config.rate[0].tolerance[0].code="5xx" \
--set health_config.rate[0].tolerance[0].degraded=2 \
--set health_config.rate[0].tolerance[0].failure=100 \
--set deployment.ingress.enabled="${ingress_enabled_flag}" \
--repo https://kiali.org/helm-charts \
kiali-server \
${KIALI_SERVER_HELM_CHARTS}

helm_command='helm upgrade --install
${helm_args[@]}
--namespace ${ISTIO_NAMESPACE}
${helm_auth_flags}
--set deployment.logger.log_level="debug"
--set external_services.grafana.url="http://grafana.istio-system:3000"
--set external_services.grafana.dashboards[0].name="Istio Mesh Dashboard"
--set external_services.tracing.url="http://tracing.istio-system:16685/jaeger"
--set health_config.rate[0].kind="service"
--set health_config.rate[0].name="y-server"
--set health_config.rate[0].namespace="alpha"
--set health_config.rate[0].tolerance[0].code="5xx"
--set health_config.rate[0].tolerance[0].degraded=2
--set health_config.rate[0].tolerance[0].failure=100
--set deployment.ingress.enabled="${ingress_enabled_flag}"
--repo https://kiali.org/helm-charts
kiali-server
${KIALI_SERVER_HELM_CHARTS}'

eval $helm_command
}


echo "==== DEPLOY KIALI TO CLUSTER #1 [${CLUSTER1_NAME}] - ${CLUSTER1_CONTEXT} (keycloak is at ${CLUSTER1_NAME})"
switch_cluster "${CLUSTER1_CONTEXT}" "${CLUSTER1_USER}" "${CLUSTER1_PASS}"
deploy_kiali "${CLUSTER1_NAME}" "${KIALI1_WEB_FQDN}" "${KIALI1_WEB_SCHEMA}" "${CLUSTER1_NAME}"
Expand Down
43 changes: 32 additions & 11 deletions hack/setup-kind-in-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Options:
Default: docker
-iv|--istio-version <#.#.#>
The version of Istio you want to install.
If you want to run with a dev build of Istio, the value must be something like "#.#-dev".
This option is ignored if -ii is false.
If not specified, the latest version of Istio is installed.
Default: <the latest release>
Expand Down Expand Up @@ -57,8 +58,10 @@ TARGET_BRANCH="${TARGET_BRANCH:-master}"
# based on the Kiali branch being tested (TARGET_BRANCH) and the compatibility matrices:
# https://kiali.io/docs/installation/installation-guide/prerequisites/
# https://istio.io/latest/docs/releases/supported-releases/
if [ "${TARGET_BRANCH}" == "v1.48" ]; then
ISTIO_VERSION="1.13.0"
if [ -z "${ISTIO_VERSION}" ]; then
if [ "${TARGET_BRANCH}" == "v1.48" ]; then
ISTIO_VERSION="1.13.0"
fi
fi

KIND_NODE_IMAGE=""
Expand Down Expand Up @@ -89,18 +92,25 @@ HELM_CHARTS_DIR="$(mktemp -d)"
SCRIPT_DIR="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"

if [ -n "${ISTIO_VERSION}" ]; then
DOWNLOAD_ISTIO_VERSION_ARG="--istio-version ${ISTIO_VERSION}"
if [[ "${ISTIO_VERSION}" == *-dev ]]; then
DOWNLOAD_ISTIO_VERSION_ARG="--dev-istio-version ${ISTIO_VERSION}"
else
DOWNLOAD_ISTIO_VERSION_ARG="--istio-version ${ISTIO_VERSION}"
fi
fi

infomsg "Downloading istio"
hack/istio/download-istio.sh ${DOWNLOAD_ISTIO_VERSION_ARG}
"${SCRIPT_DIR}"/istio/download-istio.sh ${DOWNLOAD_ISTIO_VERSION_ARG}

setup_kind_singlecluster() {
"${SCRIPT_DIR}"/start-kind.sh --name ci --image "${KIND_NODE_IMAGE}"
"${SCRIPT_DIR}"/start-kind.sh --name ci --image "${KIND_NODE_IMAGE}"

infomsg "Installing istio"
if [[ "${ISTIO_VERSION}" == *-dev ]]; then
local hub_arg="--image-hub default"
fi
# Apparently you can't set the requests to zero for the proxy so just setting them to some really low number.
hack/istio/install-istio-via-istioctl.sh --reduce-resources true --client-exe-path "$(which kubectl)" -cn "cluster-default" -mid "mesh-default" -net "network-default" -gae "true"
"${SCRIPT_DIR}"/istio/install-istio-via-istioctl.sh --reduce-resources true --client-exe-path "$(which kubectl)" -cn "cluster-default" -mid "mesh-default" -net "network-default" -gae "true" ${hub_arg:-}

infomsg "Pushing the images into the cluster..."
make -e DORP="${DORP}" -e CLUSTER_TYPE="kind" -e KIND_NAME="ci" cluster-push-kiali
Expand Down Expand Up @@ -168,22 +178,33 @@ EOF

setup_kind_multicluster() {
if [ -n "${ISTIO_VERSION}" ]; then
DOWNLOAD_ISTIO_VERSION_ARG="--istio-version ${ISTIO_VERSION}"
if [[ "${ISTIO_VERSION}" == *-dev ]]; then
DOWNLOAD_ISTIO_VERSION_ARG="--dev-istio-version ${ISTIO_VERSION}"
else
DOWNLOAD_ISTIO_VERSION_ARG="--istio-version ${ISTIO_VERSION}"
fi
fi

infomsg "Downloading istio"
hack/istio/download-istio.sh ${DOWNLOAD_ISTIO_VERSION_ARG}
"${SCRIPT_DIR}"/istio/download-istio.sh ${DOWNLOAD_ISTIO_VERSION_ARG}

infomsg "Cloning kiali helm-charts..."
git clone --single-branch --branch "${TARGET_BRANCH}" https://github.com/kiali/helm-charts.git "${HELM_CHARTS_DIR}"
make -C "${HELM_CHARTS_DIR}" build-helm-charts

infomsg "Kind cluster to be created with name [ci]"
local script_dir
local script_dir
script_dir="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"
local output_dir
output_dir="${script_dir}/../_output"
# use the Istio release that was last downloaded (that's the -t option to ls)
local istio_dir
istio_dir=$(ls -dt1 ${output_dir}/istio-* | head -n1)
hack/istio/multicluster/install-primary-remote.sh --manage-kind true -dorp docker --istio-dir "${istio_dir}"
hack/istio/multicluster/deploy-kiali.sh --manage-kind true -dorp docker -kas anonymous
if [[ "${ISTIO_VERSION}" == *-dev ]]; then
local hub_arg="--istio-hub default"
fi
"${SCRIPT_DIR}"/istio/multicluster/install-primary-remote.sh --manage-kind true -dorp docker --istio-dir "${istio_dir}" ${hub_arg:-}
"${SCRIPT_DIR}"/istio/multicluster/deploy-kiali.sh --manage-kind true -dorp docker -kas anonymous -kudi true -kshc "${HELM_CHARTS_DIR}"/_output/charts/kiali-server-*.tgz
}

if [ "${MULTICLUSTER}" == "true" ]; then
Expand Down

0 comments on commit 944b7d9

Please sign in to comment.