Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaizanse committed Jan 15, 2024
1 parent 0e5c4a2 commit 7f3934b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand All @@ -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
16 changes: 9 additions & 7 deletions scripts/gardener/aws/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 7f3934b

Please sign in to comment.