From d9b4965d0a730fee2268e58758b757e2a8cc9b83 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 16 Jan 2024 11:00:51 +0100 Subject: [PATCH 1/6] rename variables --- testing/eventmeshmock.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/testing/eventmeshmock.go b/testing/eventmeshmock.go index 1f82f5ce..65e62eca 100644 --- a/testing/eventmeshmock.go +++ b/testing/eventmeshmock.go @@ -210,10 +210,9 @@ func (m *EventMeshMock) handleMessaging() func(w http.ResponseWriter, r *http.Re if err == nil { break } - two := 2 - three := 3 - if i < two { // Don't sleep after the last attempt - time.Sleep(time.Duration(three) * time.Second) + attempts, duration := 2, 3 + if i < attempts { // Don't sleep after the last attempt. + time.Sleep(time.Duration(duration) * time.Second) } else { m.log.Error(err, "failed to update state response") w.WriteHeader(http.StatusBadRequest) From 035b5b66bac7ff7745ed1a7664502ce5bb94bfe1 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 16 Jan 2024 11:59:22 +0100 Subject: [PATCH 2/6] rename make target The name `install-nats-module` is a little misleading, since this target does not work with modules, but with the CR and CRD of the NATS-manager. --- .github/workflows/e2e.yml | 5 ++--- hack/ci/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4031c5ef..574e3b8c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -50,7 +50,6 @@ jobs: run: | make -C hack/ci/ install-k3d-tools - - name: Install Kyma CLI & setup k3d cluster using kyma CLI run: | make kyma @@ -67,9 +66,9 @@ jobs: kubectl create ns kyma-system || true make deploy IMG=$MANAGER_IMAGE - - name: Setup NATS + - name: Setup NATS-Manager run: | - make -C hack/ci/ install-nats-module + make -C hack/ci/ install-nats-manager - name: Setup and test the eventing-manager run: | diff --git a/hack/ci/Makefile b/hack/ci/Makefile index e4385d70..f9a0bf43 100644 --- a/hack/ci/Makefile +++ b/hack/ci/Makefile @@ -72,8 +72,8 @@ enable-nats-module: get-nats-via-lifecycle-manager: install-lifecycle-manager install-latest-nats-module-template-fast enable-nats-module ./check-k8s-resource-is-ready.sh 180 nats kyma-system -.PHONY: install-nats-module -install-nats-module: +.PHONY: install-nats-manager +install-nats-manager: 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 From d8f7baab8fc14329e800a739e03e1e1cb86661bd Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 16 Jan 2024 12:11:16 +0100 Subject: [PATCH 3/6] remove unused make targets A lot of make targets have become obsolete since a release of eventing-manager or nats-manger does no longer generate a module-template. For that reason, all targets that work with modules can be removed. --- hack/ci/Makefile | 61 ------------------------------------------------ 1 file changed, 61 deletions(-) diff --git a/hack/ci/Makefile b/hack/ci/Makefile index f9a0bf43..86daef36 100644 --- a/hack/ci/Makefile +++ b/hack/ci/Makefile @@ -3,75 +3,14 @@ KYMA_CLI ?= "${PROJECT_ROOT}/${KYMA}" CLUSTER_NAME ?= kyma REGISTRY_PORT ?= 5001 -ifndef MODULE_VERSION - include ${PROJECT_ROOT}/.version -endif - -ifndef MODULE_SHA - MODULE_SHA = ${shell git rev-parse --short HEAD} -endif - -.PHONY: module-build -module-build: ## Build the Module, push it to a registry and print it based on the commit hash. - @make -C ${PROJECT_ROOT} module-build \ - IMG=${IMG} \ - MODULE_REGISTRY=${MODULE_REGISTRY} \ - MODULE_VERSION=${MODULE_VERSION}-${MODULE_SHA} - cp -f ${PROJECT_ROOT}/module-template.yaml ${ARTIFACTS}/module-template.yaml - @echo "Added template to job artifacts: ${ARTIFACTS}/module-template.yaml" - @echo "\n~~~~~~~~~~~~BEGINNING OF MODULE TEMPLATE~~~~~~~~~~~~~~" - @cat ${ARTIFACTS}/module-template.yaml - @echo "\n~~~~~~~~~~~~~~~END OF MODULE TEMPLATE~~~~~~~~~~~~~~~~" - -.PHONY: download-module-template -download-module-template: ## Downloads the module-template from the module-build prow job. - export PROJECT_ROOT="${PROJECT_ROOT}" \ - && ../get_module_template_from_build_job.sh - -.PHONY: install-latest-module-template-fast -install-latest-module-template-fast: ## Downloads and applies the latest released module-template from fast channel. - kubectl apply -f https://github.com/kyma-project/eventing-manager/releases/latest/download/module-template.yaml - .PHONY: create-kyma-system-ns create-kyma-system-ns: ## Create kyma-system namespace. kubectl create ns kyma-system -.PHONY: install-module-template -install-module-template: ## Apply Eventing moduletemplate. - kubectl apply -f ${PROJECT_ROOT}/module-template.yaml - -.PHONY: enable-module-without-default-cr -enable-module-without-default-cr: ## Enable Eventing module without creating default Eventing CR. - "${KYMA_CLI}" alpha enable module eventing -c fast -n kyma-system -p Ignore - -.PHONY: install-lifecycle-manager -install-lifecycle-manager: ## Deploys lifecycle-manager. - "${KYMA_CLI}" alpha deploy \ - --ci \ - --force-conflicts - .PHONY: create-k3d create-k3d: ## Create k3d with kyma CRDs. "${KYMA_CLI}" provision k3d -p 8081:80@loadbalancer -p 8443:443@loadbalancer --registry-port ${REGISTRY_PORT} --name ${CLUSTER_NAME} --ci -.PHONY: install-lifecycle-manager -install-lifecycle-manager: ## Deploys lifecycle-manager. - "${KYMA_CLI}" alpha deploy \ - --ci \ - --force-conflicts - -.PHONY: install-latest-nats-module-template-fast -install-latest-nats-module-template-fast: ## Downloads and applies the latest nats-manager released module-template from fast channel. - kubectl apply -f https://github.com/kyma-project/nats-manager/releases/latest/download/module-template.yaml - -.PHONY: enable-nats-module -enable-nats-module: - "${KYMA_CLI}" alpha enable module nats -c fast -f --ci -n kyma-system - -.PHONY: get-nats-via-lifecycle-manager -get-nats-via-lifecycle-manager: install-lifecycle-manager install-latest-nats-module-template-fast enable-nats-module - ./check-k8s-resource-is-ready.sh 180 nats kyma-system - .PHONY: install-nats-manager install-nats-manager: kubectl apply -f https://github.com/kyma-project/nats-manager/releases/latest/download/nats-manager.yaml From 72c72ff7956045cb39f0a6c28bb982002f1487a4 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 16 Jan 2024 12:49:49 +0100 Subject: [PATCH 4/6] remove module specific secitons in the readme --- README.md | 71 ------------------------------------------------------- 1 file changed, 71 deletions(-) diff --git a/README.md b/README.md index a577ef51..a0c8f2c4 100644 --- a/README.md +++ b/README.md @@ -168,77 +168,6 @@ To delete the CRDs from the cluster: make uninstall ``` -### Deploy Eventing Manager Module With [Kyma Lifecycle Manager](https://github.com/kyma-project/lifecycle-manager/tree/main) - -1. Deploy the Lifecycle Manager to the Kubernetes cluster: - - ```shell - kyma alpha deploy - ``` - -2. Apply the Eventing module template to the Kubernetes cluster: - - > **NOTE:** You can get the latest released [module template](https://github.com/kyma-project/eventing-manager/releases/latest/download/module-template.yaml), or you can use the module template from the artifacts of `eventing-module-build` job either from the `main` branch or from your pull request. - - ```sh - kubectl apply -f module-template.yaml - ``` - -3. Enable the Eventing module: - - ```sh - kyma alpha enable module eventing -c fast -n kyma-system - ``` - -4. If you want to verify whether your Eventing module is deployed properly, perform the following checks: - - - Check if the Eventing resource has the `ready` state: - - ```shell - kubectl get -n kyma-system eventing - ``` - - - Check if the Kyma resource has the ready state: - - ```shell - kubectl get -n kyma-system kyma - ``` - -### Uninstall Eventing Manager Module With [Kyma Lifecycle Manager](https://github.com/kyma-project/lifecycle-manager/tree/main) - -1. Delete Eventing custom resource (CR) from the Kubernetes cluster (if exists): - - ```sh - kubectl delete -n kyma-system eventing eventing - ``` - -2. Disable the Eventing module: - - ```sh - kyma alpha disable module eventing - ``` - -3. Delete the Eventing module template: - - ```sh - kubectl get moduletemplates -A - kubectl delete moduletemplate -n - ``` - -4. Check whether your Eventing module is uninstalled properly: - - - Make sure that the Eventing CR does not exist. If it exists, check its status: - - ```shell - kubectl get -n kyma-system eventing eventing -o yaml - ``` - - - Check if the Kyma resource has the `ready` state: - - ```shell - kubectl get -n kyma-system kyma - ``` - ## End-to-End Tests See [hack/e2e/README.md](hack/e2e/README.md) From e76035a615f4830cb179e5c2b7a39cfabc718c27 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 16 Jan 2024 14:30:15 +0100 Subject: [PATCH 5/6] revert changes for make target name --- .github/workflows/e2e.yml | 4 ++-- hack/ci/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 574e3b8c..71f57972 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -66,9 +66,9 @@ jobs: kubectl create ns kyma-system || true make deploy IMG=$MANAGER_IMAGE - - name: Setup NATS-Manager + - name: Setup NATS run: | - make -C hack/ci/ install-nats-manager + make -C hack/ci/ install-nats-module - name: Setup and test the eventing-manager run: | diff --git a/hack/ci/Makefile b/hack/ci/Makefile index 86daef36..4aed26f8 100644 --- a/hack/ci/Makefile +++ b/hack/ci/Makefile @@ -11,8 +11,8 @@ create-kyma-system-ns: ## Create kyma-system namespace. create-k3d: ## Create k3d with kyma CRDs. "${KYMA_CLI}" provision k3d -p 8081:80@loadbalancer -p 8443:443@loadbalancer --registry-port ${REGISTRY_PORT} --name ${CLUSTER_NAME} --ci -.PHONY: install-nats-manager -install-nats-manager: +.PHONY: install-nats-module +install-nats-module: 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 From e582c18dfdfc28aa110ac2f5dc8b8166ab0db8f0 Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Tue, 16 Jan 2024 15:22:44 +0100 Subject: [PATCH 6/6] make variables to consts --- testing/eventmeshmock.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/eventmeshmock.go b/testing/eventmeshmock.go index 65e62eca..335677af 100644 --- a/testing/eventmeshmock.go +++ b/testing/eventmeshmock.go @@ -29,6 +29,9 @@ import ( const ( TokenURLPath = "/auth" MessagingURLPath = "/messaging" + + fewAttempts = 2 + smallInterval = 3 ) // EventMeshMock implements a programmable mock for EventMesh. @@ -210,9 +213,8 @@ func (m *EventMeshMock) handleMessaging() func(w http.ResponseWriter, r *http.Re if err == nil { break } - attempts, duration := 2, 3 - if i < attempts { // Don't sleep after the last attempt. - time.Sleep(time.Duration(duration) * time.Second) + if i < fewAttempts { // Don't sleep after the last attempt. + time.Sleep(time.Duration(smallInterval) * time.Second) } else { m.log.Error(err, "failed to update state response") w.WriteHeader(http.StatusBadRequest)