Skip to content

Commit

Permalink
Extract gardener target to separate makefile (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbadura authored Feb 22, 2024
1 parent f193418 commit af9c239
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
20 changes: 16 additions & 4 deletions components/operator/hack/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,25 @@ install-latest-serverless:
kubectl apply -f https://github.com/kyma-project/serverless-manager/releases/latest/download/default-serverless-cr.yaml -n kyma-system
@make -C ${PROJECT_COMMON} verify-serverless

##@ Gardener

HIBERNATION_HOUR=$(shell echo $$(( ( $(shell date +%H | sed s/^0//g) + 5 ) % 24 )))
GIT_COMMIT_SHA=$(shell git rev-parse --short=8 HEAD)
ifneq (,$(GARDENER_SA_PATH))
GARDENER_K8S_VERSION=$(shell kubectl --kubeconfig=${GARDENER_SA_PATH} get cloudprofiles.core.gardener.cloud ${GARDENER_INFRASTRUCTURE} -o=jsonpath='{.spec.kubernetes.versions[0].version}')
else
GARDENER_K8S_VERSION=1.27.4
endif

.PHONY: provision-gardener
provision-gardener:
@make -C ${PROJECT_COMMON} 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}\
--hibernation-start="00 ${HIBERNATION_HOUR} * * ?"

.PHONY: deprovision-gardener
deprovision-gardener:
@make -C ${PROJECT_COMMON} deprovision-gardener
deprovision-gardener: kyma ## Deprovision gardener cluster
kubectl --kubeconfig=${GARDENER_SA_PATH} annotate shoot test-${GIT_COMMIT_SHA} confirmation.gardener.cloud/deletion=true
kubectl --kubeconfig=${GARDENER_SA_PATH} delete shoot test-${GIT_COMMIT_SHA} --wait=false

.PHONY: run
run:
Expand Down
21 changes: 1 addition & 20 deletions components/operator/hack/common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,9 @@ delete-k3d-registry: ## Delete k3d kyma registry.
delete-k3d-cluster: ## Delete k3d kyma cluster.
-k3d cluster delete ${CLUSTER_NAME}

##@ Gardener

HIBERNATION_HOUR=$(shell echo $$(( ( $(shell date +%H | sed s/^0//g) + 5 ) % 24 )))
GIT_COMMIT_SHA=$(shell git rev-parse --short=8 HEAD)
ifneq (,$(GARDENER_SA_PATH))
GARDENER_K8S_VERSION=$(shell kubectl --kubeconfig=${GARDENER_SA_PATH} get cloudprofiles.core.gardener.cloud ${GARDENER_INFRASTRUCTURE} -o=jsonpath='{.spec.kubernetes.versions[0].version}')
else
GARDENER_K8S_VERSION=1.27.4
endif

.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}\
--hibernation-start="00 ${HIBERNATION_HOUR} * * ?"

.PHONY: deprovision-gardener
deprovision-gardener: kyma ## Deprovision gardener cluster
kubectl --kubeconfig=${GARDENER_SA_PATH} annotate shoot test-${GIT_COMMIT_SHA} confirmation.gardener.cloud/deletion=true
kubectl --kubeconfig=${GARDENER_SA_PATH} delete shoot test-${GIT_COMMIT_SHA} --wait=false

##@ Module management

#TODO: rename it to check-serverless-instalation
.PHONY: verify-serverless
verify-serverless: ## Wait for Serverless CR to be in Ready state.
# wait some time to make sure operator starts the reconciliation first
Expand Down

0 comments on commit af9c239

Please sign in to comment.