diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 4cc9275..6d5de45 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -127,6 +127,7 @@ jobs: run: kind create cluster --config tests/gh-actions/kind-cluster-1-24.yaml - name: Run e2e test + continue-on-error: true id: test env: YATAI_DEPLOYMENT_IMG_REPO: test-yatai-deployment diff --git a/scripts/quick-install-yatai-deployment.sh b/scripts/quick-install-yatai-deployment.sh index 7a96fd0..f1b040f 100755 --- a/scripts/quick-install-yatai-deployment.sh +++ b/scripts/quick-install-yatai-deployment.sh @@ -62,24 +62,33 @@ if ! command -v helm >/dev/null 2>&1; then exit 1 fi -INGRESS_CLASS=$(kubectl get ingressclass -o jsonpath='{.items[0].metadata.name}' 2> /dev/null || true) -# check if ingress class is empty -if [ -z "$INGRESS_CLASS" ]; then - if [ "$is_minikube" != "true" ]; then +IGNORE_INGRESS=${IGNORE_INGRESS:-false} + +if [ "${IGNORE_INGRESS}" = "false" ]; then + AUTOMATIC_DOMAIN_SUFFIX_GENERATION=true + INGRESS_CLASS=$(kubectl get ingressclass -o jsonpath='{.items[0].metadata.name}' 2> /dev/null || true) + # check if ingress class is empty + if [ -z "$INGRESS_CLASS" ]; then + if [ "$is_minikube" != "true" ]; then + echo "๐Ÿ˜ฑ ingress controller is not found, please install it first!" >&2 + exit 1 + else + echo "๐Ÿค– installing ingress for minikube" + minikube addons enable ingress + echo "โœ… ingress installed" + fi + fi + + INGRESS_CLASS=$(kubectl get ingressclass -o jsonpath='{.items[0].metadata.name}' 2> /dev/null || true) + # check if ingress class is empty + if [ -z "$INGRESS_CLASS" ]; then echo "๐Ÿ˜ฑ ingress controller is not found, please install it first!" >&2 exit 1 - else - echo "๐Ÿค– installing ingress for minikube" - minikube addons enable ingress - echo "โœ… ingress installed" fi -fi - -INGRESS_CLASS=$(kubectl get ingressclass -o jsonpath='{.items[0].metadata.name}' 2> /dev/null || true) -# check if ingress class is empty -if [ -z "$INGRESS_CLASS" ]; then - echo "๐Ÿ˜ฑ ingress controller is not found, please install it first!" >&2 - exit 1 +else + echo "๐Ÿค– ignoring ingress check" + AUTOMATIC_DOMAIN_SUFFIX_GENERATION=false + INGRESS_CLASS="" fi echo "๐Ÿงช verifying that the yatai-image-builder is running" @@ -157,21 +166,27 @@ fi kubectl delete -f /tmp/cert-manager-test-resources.yaml echo "โœ… cert-manager is working properly" -if [ $(kubectl get pod -A -l k8s-app=metrics-server 2> /dev/null | wc -l) = 0 ]; then - echo "๐Ÿค– installing metrics-server..." - if [ "${is_minikube}" = "true" ]; then - minikube addons enable metrics-server +SKIP_METRICS_SERVER=${SKIP_METRICS_SERVER:-false} + +if [ "${SKIP_METRICS_SERVER}" = "false" ]; then + if [ $(kubectl get pod -A -l k8s-app=metrics-server 2> /dev/null | wc -l) = 0 ]; then + echo "๐Ÿค– installing metrics-server..." + if [ "${is_minikube}" = "true" ]; then + minikube addons enable metrics-server + else + kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml + fi else - kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml + echo "๐Ÿ˜€ metrics-server is already installed" fi + + echo "โณ waiting for metrics-server to be ready..." + kubectl wait --for=condition=ready --timeout=600s pod -l k8s-app=metrics-server -A + echo "โœ… metrics-server is ready" else - echo "๐Ÿ˜€ metrics-server is already installed" + echo "๐Ÿค– skipping metrics-server installation" fi -echo "โณ waiting for metrics-server to be ready..." -kubectl wait --for=condition=ready --timeout=600s pod -l k8s-app=metrics-server -A -echo "โœ… metrics-server is ready" - UPGRADE_CRDS=${UPGRADE_CRDS:-true} if [ "${UPGRADE_CRDS}" = "true" ]; then @@ -183,6 +198,9 @@ if [ "${UPGRADE_CRDS}" = "true" ]; then fi YATAI_ENDPOINT=${YATAI_ENDPOINT:-http://yatai.yatai-system.svc.cluster.local} +if [ "${YATAI_ENDPOINT}" = "empty" ]; then + YATAI_ENDPOINT="" +fi USE_LOCAL_HELM_CHART=${USE_LOCAL_HELM_CHART:-false} @@ -218,14 +236,17 @@ else helm upgrade --install yatai-deployment yatai-deployment --repo ${HELM_REPO_URL} -n ${namespace} \ --set yatai.endpoint=${YATAI_ENDPOINT} \ --set layers.network.ingressClass=${INGRESS_CLASS} \ + --set layers.network.automaticDomainSuffixGeneration=${AUTOMATIC_DOMAIN_SUFFIX_GENERATION} \ --skip-crds=${UPGRADE_CRDS} \ --version=${VERSION} \ --devel=${DEVEL} fi -echo "โณ waiting for job yatai-deployment-default-domain to be complete..." -kubectl -n ${namespace} wait --for=condition=complete --timeout=600s job/yatai-deployment-default-domain -echo "โœ… job yatai-deployment-default-domain is complete" +if [ "${AUTOMATIC_DOMAIN_SUFFIX_GENERATION}" = "true"]; then + echo "โณ waiting for job yatai-deployment-default-domain to be complete..." + kubectl -n ${namespace} wait --for=condition=complete --timeout=600s job/yatai-deployment-default-domain + echo "โœ… job yatai-deployment-default-domain is complete" +fi kubectl -n ${namespace} rollout restart deploy/yatai-deployment diff --git a/tests/e2e/test.sh b/tests/e2e/test.sh index b7b6a4f..677f27b 100755 --- a/tests/e2e/test.sh +++ b/tests/e2e/test.sh @@ -1,9 +1,15 @@ #!/bin/bash -set -e +set -xe -YATAI_ENDPOINT='' bash <(curl -s "https://raw.githubusercontent.com/bentoml/yatai-image-builder/main/scripts/quick-install-yatai-image-builder.sh") -YATAI_ENDPOINT='' USE_LOCAL_HELM_CHART=true bash ./scripts/quick-install-yatai-deployment.sh +kubectl create ns yatai-system + +echo "๐Ÿš€ Installing yatai-image-builder..." +YATAI_ENDPOINT='empty' bash <(curl -s "https://raw.githubusercontent.com/bentoml/yatai-image-builder/main/scripts/quick-install-yatai-image-builder.sh") +echo "โœ… yatai-image-builder is ready" +echo "๐Ÿš€ Installing yatai-deployment..." +YATAI_ENDPOINT='empty' USE_LOCAL_HELM_CHART=true IGNORE_INGRESS=true SKIP_METRICS_SERVER=true UPGRADE_CRDS=false bash ./scripts/quick-install-yatai-deployment.sh +echo "โœ… yatai-deployment is ready" kubectl apply -n yatai -f ./tests/e2e/example.yaml sleep 5