Skip to content

Commit

Permalink
chore(ci) remove chart split from test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rainest committed Dec 12, 2023
1 parent 013c65a commit cdd7b5a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 35 deletions.
4 changes: 4 additions & 0 deletions scripts/test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,9 @@ kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimenta

echo "INFO: Updating helm dependencies"
for i in charts/*; do
if [ "$i" = "charts/ingress" ]
then
continue
fi
helm dependency update "$i"
done
24 changes: 5 additions & 19 deletions scripts/test-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,8 @@ TEST_ENV_NAME="${TEST_ENV_NAME:-kong-charts-tests}"
KUBECTL="kubectl --context kind-${TEST_ENV_NAME}"
KUBERNETES_VERSION="$($KUBECTL version -o json | jq -r '.serverVersion.gitVersion')"

CONTROLLER_PREFIX=""
GATEWAY_PREFIX=""
ADDITIONAL_FLAGS=()

# ------------------------------------------------------------------------------
# Configure per-chart settings
# ------------------------------------------------------------------------------
if [[ "${CHART_NAME}" == "ingress" ]]; then
CONTROLLER_PREFIX="controller."
GATEWAY_PREFIX="gateway."
# this is intentionally a no-op at present. this originally had a set that was
# made obsolete by a values default change. it's now a placeholder showing an
# example modification
# ADDITIONAL_FLAGS+=("<replace with a --set command>")
fi

# ------------------------------------------------------------------------------
# Deploy Kuma configuration and test namespace
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -82,23 +68,23 @@ TAG_MESSAGE=""
if [[ "${TAG}" != "default" ]]
then
TAG_MESSAGE="with controller tag ${TAG} "
ADDITIONAL_FLAGS+=("--set ${CONTROLLER_PREFIX}ingressController.image.tag=${TAG} ");
ADDITIONAL_FLAGS+=("--set ingressController.deployment.pod.container.image.tag=${TAG} ");
fi

# Configure values for all tests
# Enable Gateway API
ADDITIONAL_FLAGS+=("--set ${CONTROLLER_PREFIX}ingressController.env.feature_gates=GatewayAlpha=true")
ADDITIONAL_FLAGS+=("--set ingressController.deployment.pod.container.env.feature_gates=GatewayAlpha=true")
# Tests should not show up in reporting
ADDITIONAL_FLAGS+=("--set ${CONTROLLER_PREFIX}ingressController.env.anonymous_reports=false")
ADDITIONAL_FLAGS+=("--set ingressController.deployment.pod.container.env.anonymous_reports=false")

if [[ -n "${KONG_VERSION-}" ]]
then
ADDITIONAL_FLAGS+=("--set ${GATEWAY_PREFIX}image.tag=${KONG_VERSION}")
ADDITIONAL_FLAGS+=("--set image.tag=${KONG_VERSION}")
fi

if [[ -n "${KIC_VERSION-}" ]]
then
ADDITIONAL_FLAGS+=("--set ${CONTROLLER_PREFIX}ingressController.image.tag=${KIC_VERSION}")
ADDITIONAL_FLAGS+=("--set ingressController.deployment.pod.container.image.tag=${KIC_VERSION}")
fi

echo "INFO: installing chart as release ${RELEASE_NAME} ${TAG_MESSAGE}to namespace ${RELEASE_NAMESPACE}"
Expand Down
20 changes: 4 additions & 16 deletions scripts/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,8 @@ TEST_ENV_NAME="${TEST_ENV_NAME:-kong-charts-tests}"
KUBECTL="kubectl --context kind-${TEST_ENV_NAME}"
KUBERNETES_VERSION="$($KUBECTL version -o json | jq -r '.serverVersion.gitVersion')"

CONTROLLER_PREFIX=""
ADDITIONAL_FLAGS=()

# ------------------------------------------------------------------------------
# Configure per-chart settings
# ------------------------------------------------------------------------------
if [[ "${CHART_NAME}" == "ingress" ]]; then
CONTROLLER_PREFIX="controller."
# this is intentionally a no-op at present. this originally had a set that was
# made obsolete by a values default change. it's now a placeholder showing an
# example modification
# ADDITIONAL_FLAGS+=("<replace with a --set command>")
fi

# ------------------------------------------------------------------------------
# Deploy Chart - Kubernetes Ingress Controller
# ------------------------------------------------------------------------------
Expand All @@ -49,7 +37,7 @@ echo "INFO: installing chart as release ${RELEASE_NAME} to namespace ${RELEASE_N
set -x
# shellcheck disable=SC2048,SC2086
helm install --create-namespace --namespace "${RELEASE_NAMESPACE}" "${RELEASE_NAME}" \
--set ${CONTROLLER_PREFIX}ingressController.env.anonymous_reports="false" \
--set ingressController.deployment.pod.container.env.anonymous_reports="false" \
--set deployment.test.enabled=true ${ADDITIONAL_FLAGS[*]} \
"charts/${CHART_NAME}"
set +x
Expand All @@ -68,10 +56,10 @@ echo "INFO: upgrading the helm chart to image tag ${TAG}"
set -x
# shellcheck disable=SC2048,SC2086
helm upgrade --namespace "${RELEASE_NAMESPACE}" "${RELEASE_NAME}" \
--set ${CONTROLLER_PREFIX}ingressController.image.tag="${TAG}" \
--set ingressController.deployment.pod.container.image.tag="${TAG}" \
--set deployment.test.enabled=true ${ADDITIONAL_FLAGS[*]} \
--set ${CONTROLLER_PREFIX}ingressController.env.anonymous_reports="false" \
--set ${CONTROLLER_PREFIX}ingressController.image.effectiveSemver="${EFFECTIVE_TAG}" \
--set ingressController.deployment.pod.container.env.anonymous_reports="false" \
--set ingressController.deployment.pod.container.image.effectiveSemver="${EFFECTIVE_TAG}" \
"charts/${CHART_NAME}"
set +x
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit cdd7b5a

Please sign in to comment.