diff --git a/components/operator/hack/ci/Makefile b/components/operator/hack/ci/Makefile index 394843afe..e2af7da96 100644 --- a/components/operator/hack/ci/Makefile +++ b/components/operator/hack/ci/Makefile @@ -3,6 +3,7 @@ OPERATOR_ROOT = ../.. PROJECT_ROOT = $(OPERATOR_ROOT)/../.. PROJECT_COMMON = $(OPERATOR_ROOT)/hack/common include ${PROJECT_ROOT}/hack/tools/help.Makefile +include ${PROJECT_ROOT}/hack/tools/gardener.Makefile ##@ Tests @@ -47,26 +48,6 @@ 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: 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 - .PHONY: run run: @make -C ${PROJECT_COMMON} run diff --git a/hack/tools/gardener.Makefile b/hack/tools/gardener.Makefile new file mode 100644 index 000000000..97f4235c2 --- /dev/null +++ b/hack/tools/gardener.Makefile @@ -0,0 +1,25 @@ +ifndef PROJECT_ROOT +$(error PROJECT_ROOT is undefined) +endif + +include ${PROJECT_ROOT}/hack/tools/Makefile + +##@ 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