Skip to content

Commit

Permalink
Deprecate kyma provision gardener (#1000)
Browse files Browse the repository at this point in the history
  • Loading branch information
halamix2 authored May 28, 2024
1 parent 52a2325 commit e257f7c
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hack/gardener.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ GARDENER_K8S_VERSION=$(shell kubectl --kubeconfig=${GARDENER_SA_PATH} get cloudp
else
GARDENER_K8S_VERSION=1.29.3
endif
#Overwrite default kyma cli gardenlinux version because it's not supported.
GARDENER_LINUX_VERSION=1312.3.0

.PHONY: provision-gardener
provision-gardener: kyma ## Provision gardener cluster with latest k8s version
${KYMA} provision gardener ${GARDENER_INFRASTRUCTURE} -c ${GARDENER_SA_PATH} -n test-${GIT_COMMIT_SHA} -p ${GARDENER_PROJECT} -s ${GARDENER_SECRET_NAME} -k ${GARDENER_K8S_VERSION}\
--gardenlinux-version=$(GARDENER_LINUX_VERSION) --hibernation-start="00 ${HIBERNATION_HOUR} * * ?"
provision-gardener: ## Provision gardener cluster with latest k8s version
PROJECT_ROOT=${PROJECT_ROOT} \
GARDENER_SA_PATH=${GARDENER_SA_PATH} \
SHOOT=${SHOOT} PROJECT=${GARDENER_PROJECT} \
GARDENER_K8S_VERSION=${GARDENER_K8S_VERSION} \
GIT_COMMIT_SHA=${GIT_COMMIT_SHA} \
SECRET=${GARDENER_SECRET_NAME} \
${PROJECT_ROOT}/hack/provision_gardener.sh

.PHONY: deprovision-gardener
deprovision-gardener: kyma ## Deprovision gardener cluster
Expand Down
21 changes: 21 additions & 0 deletions hack/provision_gardener.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# render and applyshoot template
shoot_template=$(envsubst < ${PROJECT_ROOT}/hack/shoot_template.yaml)

export KUBECONFIG="${GARDENER_SA_PATH}"
echo "$shoot_template" | kubectl apply -f -

echo "waiting fo cluster to be ready..."
kubectl wait --for=condition=EveryNodeReady shoot/${SHOOT} --timeout=17m

# create kubeconfig request, that creates a kubeconfig which is valid for one day
kubectl create \
-f <(printf '{"spec":{"expirationSeconds":86400}}') \
--raw /apis/core.gardener.cloud/v1beta1/namespaces/garden-${PROJECT}/shoots/${SHOOT}/adminkubeconfig | \
jq -r ".status.kubeconfig" | \
base64 -d > ${SHOOT}_kubeconfig.yaml

# replace the default kubeconfig
mkdir -p ~/.kube
mv ${SHOOT}_kubeconfig.yaml ~/.kube/config
39 changes: 39 additions & 0 deletions hack/shoot_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: core.gardener.cloud/v1beta1
kind: Shoot
metadata:
name: ${SHOOT}
spec:
secretBindingName: ${SECRET}
cloudProfileName: az
region: westeurope
purpose: evaluation
provider:
type: azure
infrastructureConfig:
apiVersion: azure.provider.extensions.gardener.cloud/v1alpha1
kind: InfrastructureConfig
networks:
vnet:
cidr: 10.250.0.0/16
workers: 10.250.0.0/19
workers:
- name: cpu-worker
minimum: 1
maximum: 2
machine:
type: Standard_A4_v2
volume:
type: Standard_LRS
size: 50Gi
networking:
type: calico
pods: 100.96.0.0/11
nodes: 10.250.0.0/16
services: 100.64.0.0/13
kubernetes:
version: "${GARDENER_K8S_VERSION}"
hibernation:
enabled: false
addons:
nginxIngress:
enabled: false

0 comments on commit e257f7c

Please sign in to comment.