diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e7d37464..e7ae7c97 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -157,33 +157,33 @@ jobs: run: | make kyma - - name: Setup secrets - env: - GARDENER_KYMATUNAS: ${{ secrets.GARDENER_KYMATUNAS }} - run: | - export GARDENER_DIR="${HOME}/.gardener" - mkdir -p "/home/runner/.gardener" - echo ${GARDENER_KYMATUNAS} | base64 --decode > ${GARDENER_DIR}/kubeconfig - export TEST_ENV_STEP1="this was set in previous step" - - name: Provision Gardener cluster env: + GARDENER_CLUSTER_VERSION: "1.26.9" CLUSTER_PREFIX: "ghem-" - GARDENER_PROVIDER_SECRET_NAME: "tunas-aws" GARDENER_REGION: "eu-west-1" GARDENER_ZONES: "eu-west-1a" GARDENER_PROJECT_NAME: "kymatunas" - GARDENER_CLUSTER_VERSION: "1.26.9" + GARDENER_PROVIDER_SECRET_NAME: "tunas-aws" + MACHINE_TYPE: "c4.xlarge" + SCALER_MIN: "1" + SCALER_MAX: "2" + RETRY_ATTEMPTS: "1" + GARDENER_KYMATUNAS: ${{ secrets.GARDENER_KYMATUNAS }} run: | + : # setup Gardener kubeconfig. + mkdir -p "${HOME}/.gardener" + export GARDENER_KUBECONFIG="${HOME}/.gardener/kubeconfig" + echo ${GARDENER_KYMATUNAS} | base64 --decode > ${GARDENER_KUBECONFIG} + : # generate cluster name and export it to Github env for other steps to access it. export CLUSTER_NAME="${CLUSTER_PREFIX}$(openssl rand -hex 2)" echo "CLUSTER_NAME=${CLUSTER_NAME}" >> $GITHUB_ENV - export GARDENER_KUBECONFIG="${HOME}/.gardener/kubeconfig" - echo ${CLUSTER_NAME} -# make -C hack/ci/ provision-gardener-cluster -# kubectl version -# kubectl cluster-info -# kubectl get nodes -# kubectl get ns + : # provision gardener cluster. + make -C hack/ci/ provision-gardener-cluster + kubectl version + kubectl cluster-info + kubectl get nodes + kubectl get ns - name: Delete Gardener cluster if: ${{ always() }} @@ -193,5 +193,4 @@ jobs: WAIT_FOR_DELETE_COMPLETION: "false" run: | export GARDENER_KUBECONFIG="${HOME}/.gardener/kubeconfig" - echo ${CLUSTER_NAME} # make -C hack/ci/ deprovision-gardener-cluster diff --git a/scripts/gardener/aws/provision.sh b/scripts/gardener/aws/provision.sh index 82987744..10d2b4d2 100755 --- a/scripts/gardener/aws/provision.sh +++ b/scripts/gardener/aws/provision.sh @@ -35,30 +35,32 @@ gardener::validate_and_default() { ) utils::check_required_vars "${requiredVars[@]}" + # validations + if [ "${#CLUSTER_NAME}" -gt 9 ]; then + log::error "Provided cluster name is too long" + return 1 + fi + # set default values if [ -z "$MACHINE_TYPE" ]; then export MACHINE_TYPE="m5.xlarge" fi if [ -z "$SCALER_MIN" ]; then - export SCALER_MIN=1 + export SCALER_MIN="1" fi if [ -z "$SCALER_MAX" ]; then - export SCALER_MAX=2 + export SCALER_MAX="2" fi if [ -z "$RETRY_ATTEMPTS" ]; then - export RETRY_ATTEMPTS=1 + export RETRY_ATTEMPTS="1" fi } gardener::provision_cluster() { log::info "Provision cluster: \"${CLUSTER_NAME}\"" - if [ "${#CLUSTER_NAME}" -gt 9 ]; then - log::error "Provided cluster name is too long" - return 1 - fi # decreasing attempts to 2 because we will try to create new cluster from scratch on exit code other than 0 ${KYMA_CLI} provision gardener aws \