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 Jul 16, 2024
1 parent 09bfbe0 commit e7b6db4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 24 deletions.
4 changes: 4 additions & 0 deletions scripts/test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,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
44 changes: 33 additions & 11 deletions scripts/test-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,11 @@ 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
# Deploy Kuma configuration and test namespace
# ------------------------------------------------------------------------------
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


if [[ "${CHART_NAME}" == "gateway-operator" ]]
Expand Down Expand Up @@ -136,6 +126,38 @@ metadata:

fi

TAG_MESSAGE=""
if [[ "${TAG}" != "default" ]]
then
TAG_MESSAGE="with controller tag ${TAG} "
ADDITIONAL_FLAGS+=("--set ingressController.deployment.pod.container.image.tag=${TAG} ");
fi

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

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

if [[ -n "${KIC_VERSION-}" ]]
then
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}"
set -x
# shellcheck disable=SC2048,SC2086
helm install --namespace "${RELEASE_NAMESPACE}" "${RELEASE_NAME}" \
--set deployment.test.enabled=true \
${ADDITIONAL_FLAGS[*]} \
"charts/${CHART_NAME}"
set +x

# ------------------------------------------------------------------------------
# Test Chart
# ------------------------------------------------------------------------------
Expand Down
33 changes: 20 additions & 13 deletions scripts/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,10 @@ 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
# Deploy Chart - Kubernetes Ingress Controller
# ------------------------------------------------------------------------------
echo "INFO: installing chart as release ${RELEASE_NAME} to namespace ${RELEASE_NAMESPACE}"
if [[ "${CHART_NAME}" == "gateway-operator" ]]
Expand All @@ -64,6 +52,13 @@ else
set +x
fi

set -x
# shellcheck disable=SC2048,SC2086
helm install --create-namespace --namespace "${RELEASE_NAMESPACE}" "${RELEASE_NAME}" \
--set ingressController.deployment.pod.container.env.anonymous_reports="false" \
--set deployment.test.enabled=true ${ADDITIONAL_FLAGS[*]} \
"charts/${CHART_NAME}"
set +x
# ------------------------------------------------------------------------------
# Test Chart
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -96,6 +91,18 @@ else
"charts/${CHART_NAME}"
set +x
fi

echo "INFO: upgrading the helm chart to image tag ${TAG}"
set -x
# shellcheck disable=SC2048,SC2086
helm upgrade --namespace "${RELEASE_NAMESPACE}" "${RELEASE_NAME}" \
--set ingressController.deployment.pod.container.image.tag="${TAG}" \
--set deployment.test.enabled=true ${ADDITIONAL_FLAGS[*]} \
--set ingressController.deployment.pod.container.env.anonymous_reports="false" \
--set ingressController.deployment.pod.container.image.effectiveSemver="${EFFECTIVE_TAG}" \
"charts/${CHART_NAME}"
set +x

# ------------------------------------------------------------------------------
# Test Upgraded Chart
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit e7b6db4

Please sign in to comment.