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 babeede commit f429b79
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 17 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,30 +168,29 @@ jobs:
- name: Provision Gardener cluster
env:
CLUSTER_NAME: "fzn-g2"
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"
run: |
echo "CLUSTER_NAME=${CLUSTER_PREFIX}$(openssl rand -hex 2)" >> $GITHUB_ENV
export GARDENER_KUBECONFIG="${HOME}/.gardener/kubeconfig"
echo ${TEST_ENV_STEP1}
make -C hack/ci/ provision-gardener-cluster
kubectl version
kubectl cluster-info
kubectl get nodes
kubectl get ns
kubectl apply -f https://github.com/kyma-project/nats-manager/releases/latest/download/nats-manager.yaml
kubectl apply -f https://github.com/kyma-project/nats-manager/releases/latest/download/nats-default-cr.yaml
echo ${CLUSTER_NAME}
# make -C hack/ci/ provision-gardener-cluster
# kubectl version
# kubectl cluster-info
# kubectl get nodes
# kubectl get ns

- name: Delete Gardener cluster
if: ${{ always() }}
env:
CLUSTER_NAME: "fzn-g2"
GARDENER_PROVIDER_SECRET_NAME: "tunas-aws"
GARDENER_PROJECT_NAME: "kymatunas"
WAIT_FOR_DELETE_COMPLETION: "false"
run: |
export GARDENER_KUBECONFIG="${HOME}/.gardener/kubeconfig"
make -C hack/ci/ deprovision-gardener-cluster
echo ${CLUSTER_NAME}
# make -C hack/ci/ deprovision-gardener-cluster
15 changes: 12 additions & 3 deletions scripts/gardener/aws/deprovision.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

#Usage: To run this script, set the following environment variables and run this script.
# CLUSTER_NAME
# GARDENER_PROJECT_NAME
# GARDENER_KUBECONFIG - Path to kubeconfig for Gardener.
# WAIT_FOR_DELETE_COMPLETION - "true" | "false"

#Permissions: In order to run this script you need to use a service account with permissions equivalent to the following GCP roles:
# - Compute Admin
# - Service Account User
Expand All @@ -12,12 +18,16 @@ source "${PROJECT_ROOT}/scripts/utils/utils.sh"

gardener::validate_and_default() {
requiredVars=(
CLUSTER_NAME
GARDENER_KUBECONFIG
GARDENER_PROJECT_NAME
CLUSTER_NAME
WAIT_FOR_DELETE_COMPLETION # "true" | "false"
)
utils::check_required_vars "${requiredVars[@]}"

# set default values
if [ -z "$WAIT_FOR_DELETE_COMPLETION" ]; then
export WAIT_FOR_DELETE_COMPLETION="false"
fi
}

# gardener::deprovision_cluster removes a Gardener cluster
Expand All @@ -38,7 +48,6 @@ function gardener::deprovision_cluster() {
-n "${namespace}"
}


## MAIN Logic

gardener::validate_and_default
Expand Down
32 changes: 29 additions & 3 deletions scripts/gardener/aws/provision.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/usr/bin/env bash

#Usage: To run this script, set the following environment variables and run this script.
# CLUSTER_NAME
# GARDENER_REGION
# GARDENER_ZONES
# GARDENER_PROJECT_NAME
# GARDENER_PROVIDER_SECRET_NAME
# GARDENER_CLUSTER_VERSION
# GARDENER_KUBECONFIG - Path to kubeconfig for Gardener.
# MACHINE_TYPE - default: "m5.xlarge"
# SCALER_MIN - default: 1
# SCALER_MAX - default: 2
# RETRY_ATTEMPTS - default: 1

#Permissions: In order to run this script you need to use a service account with permissions equivalent to the following GCP roles:
# - Compute Admin
# - Service Account User
Expand All @@ -12,6 +25,7 @@ source "${PROJECT_ROOT}/scripts/utils/utils.sh"

gardener::validate_and_default() {
requiredVars=(
CLUSTER_NAME
GARDENER_REGION
GARDENER_ZONES
GARDENER_KUBECONFIG
Expand All @@ -25,6 +39,18 @@ gardener::validate_and_default() {
if [ -z "$MACHINE_TYPE" ]; then
export MACHINE_TYPE="m5.xlarge"
fi

if [ -z "$SCALER_MIN" ]; then
export SCALER_MIN=1
fi

if [ -z "$SCALER_MAX" ]; then
export SCALER_MAX=2
fi

if [ -z "$RETRY_ATTEMPTS" ]; then
export RETRY_ATTEMPTS=1
fi
}

gardener::provision_cluster() {
Expand All @@ -43,10 +69,10 @@ gardener::provision_cluster() {
--region "${GARDENER_REGION}" \
--zones "${GARDENER_ZONES}" \
--type "${MACHINE_TYPE}" \
--scaler-max 4 \
--scaler-min 2 \
--scaler-max ${SCALER_MIN} \
--scaler-min ${SCALER_MAX} \
--kube-version="${GARDENER_CLUSTER_VERSION}" \
--attempts 1 \
--attempts ${RETRY_ATTEMPTS} \
--verbose \
--hibernation-start ""
}
Expand Down

0 comments on commit f429b79

Please sign in to comment.