Skip to content

Commit

Permalink
Ingress readiness check in integration tests (#1225)
Browse files Browse the repository at this point in the history
* Check if ingress is ready (run-int-tests)

* Check if ingress is ready (run-int-tests)
  • Loading branch information
robertgraeff authored Sep 9, 2024
1 parent 8f30966 commit 5e438f1
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions hack/int-test-helper/install-landscaper-dual
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ if [[ -z $TARGET_SHOOT_KUBECONFIG_PATH ]]; then
exit 1
fi

if [[ -z RESOURCE_SHOOT_KUBECONFIG_PATH ]]; then
if [[ -z $RESOURCE_SHOOT_KUBECONFIG_PATH ]]; then
echo "Resource shoot kubeconfig path (-r) is required" >&2
print_help
exit 1
fi

if [[ -z INGRESS_URL ]]; then
if [[ -z $INGRESS_URL ]]; then
echo "Ingress url (-i) is required" >&2
print_help
exit 1
Expand Down Expand Up @@ -190,25 +190,53 @@ helm upgrade --kubeconfig="${TARGET_SHOOT_KUBECONFIG_PATH}" --install --wait --c
-f "${WORKDIR}/landscaper-controller-values.yaml" -f "${WORKDIR}/registry-values.yaml" landscaper-controller "${WORKDIR}/landscaper-controller"


# Wait until landscaper and the ingress for the webhook are ready.
# To allow retries, we must not exit at the first error.
set +e

echo "> Wait for Landscaper being ready"
landscaper_ready=false
retries_left=20

while [ "$landscaper_ready" = false ]; do
while true; do
echo "Is landscaper ready: ${retries_left} tries left"
kubectl --kubeconfig="${RESOURCE_SHOOT_KUBECONFIG_PATH}" get customresourcedefinitions.apiextensions.k8s.io deployitems.landscaper.gardener.cloud
if [ "$?" = 0 ]; then
landscaper_ready=true
echo "Landscaper is ready"
break
fi

if [ "retries_left" == 0 ]; then
>&2 echo "landscaper is not ready after max retries"
retries_left="$((${retries_left}-1))"
if [ "${retries_left}" -eq 0 ]; then
>&2 echo "Landscaper is not ready after max retries"
exit 1
fi

sleep 1
done


echo "> Wait for ingress being ready: ${INGRESS_URL}"
retries_left=300

while true; do
echo "Is ingress ready: ${retries_left} tries left"
loadbalancer_ip=$(kubectl --kubeconfig="${TARGET_SHOOT_KUBECONFIG_PATH}" get ingress -n ls-system landscaper-controller-webhooks -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
if [ "$?" = 0 -a -n "${loadbalancer_ip}" ]; then
echo "Ingress is ready"
break
fi

retries_left="$((${retries_left}-1))"
if [ "${retries_left}" -eq 0 ]; then
>&2 echo "Ingress is not ready after max retries"
exit 1
fi

sleep 1
done

set -e


echo "> Deploy Helm Deployer"
ocm get resources --repo $OCI_REPO "${COMPONENT_NAME}/helm-deployer:${LANDSCAPER_VERSION}" helm-deployer-image -o json > "${WORKDIR}/helm-deployer-image-resource.json"
Expand Down

0 comments on commit 5e438f1

Please sign in to comment.