generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backend switching job for EventMesh on Push event (#400)
* Add backend switching job for EventMesh on Push event * Apply suggestions from code review Co-authored-by: Friedrich <[email protected]> * added comments * updated comments to use # --------- Co-authored-by: Friedrich <[email protected]>
- Loading branch information
1 parent
e4d3a96
commit 44ff053
Showing
10 changed files
with
831 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
name: Backend-switching-tests-gardener (reusable) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
eventing-manager-image: | ||
description: Container image of eventing-manger which needs to be tested. | ||
required: true | ||
type: string | ||
kube-version: | ||
description: Kubernetes version for the Gardener cluster. | ||
required: true | ||
type: string | ||
cluster-name-prefix: | ||
description: Prefix to use as prefix for name of Gardener cluster. | ||
required: false | ||
type: string | ||
default: "ghem-" | ||
|
||
jobs: | ||
backend-switching: | ||
runs-on: ubuntu-latest | ||
env: | ||
KYMA_STABILITY: "unstable" | ||
KYMA: "./hack/kyma" | ||
MANAGER_IMAGE: ${{ inputs.eventing-manager-image }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache Binaries | ||
id: cache-binaries | ||
uses: actions/cache@v3 | ||
with: | ||
path: bin | ||
key: ${{ runner.os }}-bin | ||
|
||
- name: Install Kyma CLI | ||
run: | | ||
make kyma | ||
- name: Provision Gardener cluster | ||
env: | ||
GARDENER_CLUSTER_VERSION: ${{ inputs.kube-version }} | ||
CLUSTER_PREFIX: ${{ inputs.cluster-name-prefix }} | ||
GARDENER_REGION: "eu-west-1" | ||
GARDENER_ZONES: "eu-west-1a" | ||
GARDENER_PROJECT_NAME: ${{ vars.GARDENER_PROJECT_NAME }} | ||
GARDENER_PROVIDER_SECRET_NAME: ${{ vars.GARDENER_PROVIDER_SECRET_NAME_AWS }} | ||
MACHINE_TYPE: "c4.xlarge" | ||
SCALER_MIN: "1" | ||
SCALER_MAX: "2" | ||
RETRY_ATTEMPTS: "2" | ||
GARDENER_KYMATUNAS: ${{ secrets.GARDENER_KYMATUNAS }} | ||
run: | | ||
# setup Gardener kubeconfig. | ||
mkdir -p "${HOME}/.gardener" | ||
export GARDENER_KUBECONFIG="${HOME}/.gardener/kubeconfig" | ||
echo ${GARDENER_KYMATUNAS} | base64 --decode > ${GARDENER_KUBECONFIG} | ||
# generate cluster name and export it to Github env for cleanup step to access it. | ||
export CLUSTER_NAME="${CLUSTER_PREFIX}$(openssl rand -hex 2)" | ||
echo "CLUSTER_NAME=${CLUSTER_NAME}" >> $GITHUB_ENV | ||
# provision gardener cluster. | ||
make -C hack/ci/ provision-gardener-cluster | ||
kubectl version | ||
kubectl cluster-info | ||
kubectl get nodes | ||
kubectl get ns | ||
- name: Create kyma-system namespace | ||
run: | | ||
kubectl create ns kyma-system || true | ||
- name: Create EventMesh secret | ||
env: | ||
EVENTMESH_K8S_SECRET: ${{ secrets.EVENTMESH_K8S_SECRET }} | ||
run: | | ||
echo "${EVENTMESH_K8S_SECRET}" | base64 --decode > k8s-em.yaml | ||
kubectl apply -n kyma-system -f k8s-em.yaml | ||
rm k8s-em.yaml | ||
- name: Create IAS application for EventMesh | ||
env: | ||
TEST_EVENTING_AUTH_IAS_URL: ${{ vars.EVENTING_AUTH_IAS_URL }} | ||
TEST_EVENTING_AUTH_IAS_USER: ${{ vars.EVENTING_AUTH_IAS_USER }} | ||
TEST_EVENTING_AUTH_IAS_PASSWORD: ${{ secrets.EVENTING_AUTH_IAS_PASSWORD }} | ||
run: | | ||
export DISPLAY_NAME=${CLUSTER_NAME} | ||
make -C hack/ci/ create-ias-app | ||
- name: Install latest released Istio Module | ||
run: | | ||
make -C hack/ci/ install-istio-module | ||
- name: Install latest released API Gateway Manager | ||
run: | | ||
make -C hack/ci/ install-api-gateway-module | ||
- name: Install latest released NATS Manager | ||
run: | | ||
make -C hack/ci/ install-nats-module | ||
- name: Deploy eventing-manager | ||
run: | | ||
make install | ||
make deploy IMG=$MANAGER_IMAGE | ||
kubectl apply -f config/samples/default.yaml | ||
- name: Wait for Installed modules to be ready | ||
run: | | ||
make -C hack/ci/ wait-istio-cr-ready | ||
make -C hack/ci/ wait-api-gateway-cr-ready | ||
make -C hack/ci/ wait-nats-cr-ready | ||
make -C hack/ci/ wait-eventing-cr-ready-with-backend ACTIVE_BACKEND=NATS | ||
- name: Setup eventing tests | ||
run: | | ||
make e2e-eventing-setup | ||
- name: Test eventing with NATS | ||
run: | | ||
make e2e-eventing | ||
- name: Switch to EventMesh backend | ||
run: | | ||
kubectl apply -f config/samples/default_eventmesh.yaml | ||
make -C hack/ci/ wait-eventing-cr-ready-with-backend ACTIVE_BACKEND=EventMesh | ||
- name: Test eventing with EventMesh | ||
env: | ||
BACKEND_TYPE: "EventMesh" | ||
run: | | ||
# wait for subscriptions to be ready. | ||
make e2e-eventing-setup | ||
# run tests. | ||
make e2e-eventing | ||
- name: Switch back to NATS backend | ||
run: | | ||
kubectl apply -f config/samples/default.yaml | ||
make -C hack/ci/ wait-eventing-cr-ready-with-backend ACTIVE_BACKEND=NATS | ||
- name: Test eventing again with NATS | ||
run: | | ||
# wait for subscriptions to be ready. | ||
make e2e-eventing-setup | ||
# run tests. | ||
make e2e-eventing | ||
- name: Test eventing cleanup | ||
run: | | ||
make e2e-cleanup | ||
- name: On error, fetch NATS CR | ||
if: failure() | ||
run: | | ||
kubectl get nats.operator.kyma-project.io -n kyma-system -o yaml | ||
- name: On error, fetch Eventing CRs | ||
if: failure() | ||
run: | | ||
kubectl get eventing.operator.kyma-project.io -n kyma-system -o yaml | ||
- name: On error, fetch Istio CR | ||
if: failure() | ||
run: | | ||
kubectl get istios.operator.kyma-project.io -n kyma-system -o yaml | ||
- name: On error, fetch API Gateway CR | ||
if: failure() | ||
run: | | ||
kubectl get apigateways.operator.kyma-project.io -n kyma-system -o yaml | ||
- name: Delete IAS application | ||
if: ${{ always() }} | ||
env: | ||
TEST_EVENTING_AUTH_IAS_URL: ${{ vars.EVENTING_AUTH_IAS_URL }} | ||
TEST_EVENTING_AUTH_IAS_USER: ${{ vars.EVENTING_AUTH_IAS_USER }} | ||
TEST_EVENTING_AUTH_IAS_PASSWORD: ${{ secrets.EVENTING_AUTH_IAS_PASSWORD }} | ||
run: | | ||
export IAS_APPLICATION_LOCATION=$(cat ~/.ias_location) | ||
make -C hack/ci/ delete-ias-app | ||
- name: Delete Gardener cluster | ||
if: ${{ always() }} | ||
env: | ||
GARDENER_PROVIDER_SECRET_NAME: "tunas-aws" | ||
GARDENER_PROJECT_NAME: "kymatunas" | ||
WAIT_FOR_DELETE_COMPLETION: "false" | ||
run: | | ||
export GARDENER_KUBECONFIG="${HOME}/.gardener/kubeconfig" | ||
make -C hack/ci/ deprovision-gardener-cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.