From 1f071b5316581ea8119f050d2ae135d2c8066f5f Mon Sep 17 00:00:00 2001 From: Piotr Halama Date: Mon, 27 May 2024 08:52:30 +0200 Subject: [PATCH] Deprecate kyma provision gardener (#1060) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Deprecate kyma provision gardener * fix list of zones * fix kubeconfig path * force k8s version to be a string * remove unused GARDENER_GARDENLINUX_VERSION * Fix typo * don't hibernate * remove unused check * don't hibernate --------- Co-authored-by: Marek Kołodziejczak <69915024+kolodziejczak@users.noreply.github.com> --- .../scripts/custom-domain-gardener-aws-gh.sh | 2 - .../scripts/custom-domain-gardener-gcp-gh.sh | 2 - .../scripts/provision-gardener-gh.sh | 42 +++++++-------- tests/integration/scripts/shoot_aws.yaml | 52 +++++++++++++++++++ tests/integration/scripts/shoot_gcp.yaml | 45 ++++++++++++++++ 5 files changed, 115 insertions(+), 28 deletions(-) create mode 100644 tests/integration/scripts/shoot_aws.yaml create mode 100644 tests/integration/scripts/shoot_gcp.yaml diff --git a/tests/integration/scripts/custom-domain-gardener-aws-gh.sh b/tests/integration/scripts/custom-domain-gardener-aws-gh.sh index a69b1a0b4..4190bce0e 100755 --- a/tests/integration/scripts/custom-domain-gardener-aws-gh.sh +++ b/tests/integration/scripts/custom-domain-gardener-aws-gh.sh @@ -13,10 +13,8 @@ export SCALER_MAX=3 export SCALER_MIN=1 export GARDENER_PROVIDER="aws" export GARDENER_REGION="eu-west-1" -export GARDENER_ZONES="eu-west-1b,eu-west-1c,eu-west-1a" export GARDENER_PROVIDER_SECRET_NAME="aws-gardener-access" export GARDENER_PROJECT_NAME="goatz" export GARDENER_CLUSTER_VERSION="1.27.8" -export GARDENER_GARDENLINUX_VERSION="1312.3.0" ./tests/integration/scripts/custom-domain-gardener-gh.sh diff --git a/tests/integration/scripts/custom-domain-gardener-gcp-gh.sh b/tests/integration/scripts/custom-domain-gardener-gcp-gh.sh index a54c0a910..888420f46 100755 --- a/tests/integration/scripts/custom-domain-gardener-gcp-gh.sh +++ b/tests/integration/scripts/custom-domain-gardener-gcp-gh.sh @@ -13,10 +13,8 @@ export SCALER_MAX=3 export SCALER_MIN=1 export GARDENER_PROVIDER="gcp" export GARDENER_REGION="europe-west3" -export GARDENER_ZONES="europe-west3-c,europe-west3-b,europe-west3-a" export GARDENER_PROVIDER_SECRET_NAME="goat" export GARDENER_PROJECT_NAME="goatz" export GARDENER_CLUSTER_VERSION="1.27.8" -export GARDENER_GARDENLINUX_VERSION="1312.3.0" ./tests/integration/scripts/custom-domain-gardener-gh.sh diff --git a/tests/integration/scripts/provision-gardener-gh.sh b/tests/integration/scripts/provision-gardener-gh.sh index f144eda4c..298035972 100755 --- a/tests/integration/scripts/provision-gardener-gh.sh +++ b/tests/integration/scripts/provision-gardener-gh.sh @@ -22,7 +22,6 @@ requiredVars=( CLUSTER_NAME GARDENER_PROVIDER GARDENER_REGION - GARDENER_ZONES GARDENER_KUBECONFIG GARDENER_PROJECT_NAME GARDENER_PROVIDER_SECRET_NAME @@ -36,26 +35,21 @@ requiredVars=( check_required_vars "${requiredVars[@]}" -# Install Kyma CLI in latest version -echo "--> Install kyma CLI locally to /tmp/bin" -curl -Lo kyma.tar.gz "https://github.com/kyma-project/cli/releases/latest/download/kyma_linux_x86_64.tar.gz" \ -&& tar -zxvf kyma.tar.gz && chmod +x kyma \ -&& rm -f kyma.tar.gz - -kyma version --client -kyma provision gardener ${GARDENER_PROVIDER} \ - --secret "${GARDENER_PROVIDER_SECRET_NAME}" \ - --name "${CLUSTER_NAME}" \ - --project "${GARDENER_PROJECT_NAME}" \ - --credentials "${GARDENER_KUBECONFIG}" \ - --region "${GARDENER_REGION}" \ - --zones "${GARDENER_ZONES}" \ - --type "${MACHINE_TYPE}" \ - --disk-size $DISK_SIZE \ - --disk-type "${DISK_TYPE}" \ - --scaler-max $SCALER_MAX \ - --scaler-min $SCALER_MIN \ - --kube-version="${GARDENER_CLUSTER_VERSION}" \ - --gardenlinux-version="${GARDENER_GARDENLINUX_VERSION}" \ - --attempts 3 \ - --verbose \ No newline at end of file +# render and applyshoot template +shoot_template=$(envsubst < ./tests/integration/scripts/shoot_${GARDENER_PROVIDER}.yaml) + +echo "$shoot_template" | kubectl --kubeconfig "${GARDENER_KUBECONFIG}" apply -f - + +echo "waiting fo cluster to be ready..." +kubectl wait --kubeconfig "${GARDENER_KUBECONFIG}" --for=condition=EveryNodeReady shoot/${CLUSTER_NAME} --timeout=17m + +# create kubeconfig request, that creates a kubeconfig which is valid for one day +kubectl create --kubeconfig "${GARDENER_KUBECONFIG}" \ + -f <(printf '{"spec":{"expirationSeconds":86400}}') \ + --raw /apis/core.gardener.cloud/v1beta1/namespaces/garden-${GARDENER_PROJECT_NAME}/shoots/${CLUSTER_NAME}/adminkubeconfig | \ + jq -r ".status.kubeconfig" | \ + base64 -d > ${CLUSTER_NAME}_kubeconfig.yaml + +# replace the default kubeconfig +mkdir -p ~/.kube +mv ${CLUSTER_NAME}_kubeconfig.yaml ~/.kube/config diff --git a/tests/integration/scripts/shoot_aws.yaml b/tests/integration/scripts/shoot_aws.yaml new file mode 100644 index 000000000..6cc35325e --- /dev/null +++ b/tests/integration/scripts/shoot_aws.yaml @@ -0,0 +1,52 @@ +apiVersion: core.gardener.cloud/v1beta1 +kind: Shoot +metadata: + name: ${CLUSTER_NAME} +spec: + secretBindingName: ${GARDENER_PROVIDER_SECRET_NAME} + cloudProfileName: aws + region: ${GARDENER_REGION} + purpose: evaluation + provider: + type: aws + infrastructureConfig: + apiVersion: aws.provider.extensions.gardener.cloud/v1alpha1 + kind: InfrastructureConfig + networks: + vpc: + cidr: 10.250.0.0/16 + zones: + - name: ${GARDENER_REGION}a + internal: 10.250.48.0/20 + public: 10.250.32.0/20 + workers: 10.250.0.0/19 + - name: ${GARDENER_REGION}b + internal: 10.250.112.0/20 + public: 10.250.96.0/20 + workers: 10.250.64.0/19 + - name: ${GARDENER_REGION}c + internal: 10.250.176.0/20 + public: 10.250.160.0/20 + workers: 10.250.128.0/19 + workers: + - name: cpu-worker + minimum: ${SCALER_MIN} + maximum: ${SCALER_MAX} + machine: + type: ${MACHINE_TYPE} + volume: + type: ${DISK_TYPE} + size: ${DISK_SIZE}Gi + zones: + - ${GARDENER_REGION}a + - ${GARDENER_REGION}b + - ${GARDENER_REGION}c + networking: + type: calico + pods: 100.96.0.0/11 + nodes: 10.250.0.0/16 + services: 100.64.0.0/13 + kubernetes: + version: ${GARDENER_CLUSTER_VERSION} + hibernation: + enabled: false diff --git a/tests/integration/scripts/shoot_gcp.yaml b/tests/integration/scripts/shoot_gcp.yaml new file mode 100644 index 000000000..7162bcde6 --- /dev/null +++ b/tests/integration/scripts/shoot_gcp.yaml @@ -0,0 +1,45 @@ +apiVersion: core.gardener.cloud/v1beta1 +kind: Shoot +metadata: + name: ${CLUSTER_NAME} +spec: + secretBindingName: ${GARDENER_PROVIDER_SECRET_NAME} + cloudProfileName: gcp + region: ${GARDENER_REGION} + purpose: evaluation + provider: + type: gcp + infrastructureConfig: + apiVersion: gcp.provider.extensions.gardener.cloud/v1alpha1 + kind: InfrastructureConfig + networks: + workers: 10.250.0.0/16 + controlPlaneConfig: + apiVersion: gcp.provider.extensions.gardener.cloud/v1alpha1 + kind: ControlPlaneConfig + zone: ${GARDENER_REGION}-a + workers: + - name: cpu-worker + minimum: ${SCALER_MIN} + maximum: ${SCALER_MAX} + machine: + type: ${MACHINE_TYPE} + volume: + type: ${DISK_TYPE} + size: ${DISK_SIZE}Gi + zones: + - ${GARDENER_REGION}-a + - ${GARDENER_REGION}-b + - ${GARDENER_REGION}-c + networking: + type: calico + pods: 100.96.0.0/11 + nodes: 10.250.0.0/16 + services: 100.64.0.0/13 + kubernetes: + version: "${GARDENER_CLUSTER_VERSION}" + hibernation: + enabled: false + addons: + nginxIngress: + enabled: false