generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 16
213 lines (181 loc) · 7.28 KB
/
k8s-compatibility-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: k8s-compatibility-test
on:
workflow_dispatch:
inputs:
k8s-version: # k8s version
description: 'Kubernetes version (i.e. x.y.z)'
required: true
jobs:
k8s-compatibility-test:
# Tests the compatibility of Kubernetes version with Eventing and NATS modules.
# The steps of this job are:
# 1. Provision Gardener cluster with the given k8s version.
# 2. Install latest released versions of Istio, Api-gateway, NATS and Eventing modules.
# 3. Run eventing tests with NATS backend.
# 4. Run eventing tests with EventMesh backend.
runs-on: ubuntu-latest
env:
KYMA_STABILITY: "unstable"
KYMA: "./hack/kyma"
steps:
- uses: actions/checkout@v4
- name: Setup Go via go.mod
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: go version
- name: Install Kyma CLI
run: |
make kyma
- name: Provision Gardener cluster
env:
GARDENER_CLUSTER_VERSION: ${{ inputs.k8s-version }}
CLUSTER_PREFIX: "ghem-"
GARDENER_PROJECT_NAME: ${{ vars.GARDENER_PROJECT_NAME }}
GARDENER_PROVIDER_SECRET_NAME: ${{ vars.GARDENER_PROVIDER_SECRET_NAME_AWS }}
MACHINE_TYPE: "m5.xlarge"
SCALER_MIN: "1"
SCALER_MAX: "2"
RETRY_ATTEMPTS: "1"
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
# set random region for AWS.
export GARDENER_REGION=$(./scripts/gardener/aws/get_random_region.sh)
export GARDENER_ZONES="${GARDENER_REGION}a"
# 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: Install latest released Eventing Manager
run: |
make -C hack/ci/ install-eventing-module
kubectl apply -f config/samples/default_nats.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-warning
make -C hack/ci/ wait-eventing-cr-ready-with-backend ACTIVE_BACKEND=NATS
- name: Setup eventing tests
run: |
# create API Rules for EPP and Sink.
export DOMAIN_TO_EXPOSE_WORKLOADS="$(kubectl get cm -n kube-system shoot-info -o=jsonpath='{.data.domain}')"
./hack/e2e/scripts/expose_epp_and_sink.sh
# define URLs.
export SINK_PORT_FORWARDED_URL=https://sink-e2e-tests.${DOMAIN_TO_EXPOSE_WORKLOADS}
export PUBLISHER_URL=https://epp-e2e-tests.${DOMAIN_TO_EXPOSE_WORKLOADS}
# export ENVs to Github for all next steps.
echo "SINK_PORT_FORWARDED_URL=${SINK_PORT_FORWARDED_URL}" >> $GITHUB_ENV
echo "PUBLISHER_URL=${PUBLISHER_URL}" >> $GITHUB_ENV
# setup e2e tests.
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: |
# run tests.
make e2e-eventing
- name: Test eventing cleanup
run: |
make e2e-cleanup
- name: On error, fetch APIRules
if: failure()
run: |
kubectl get apirules.gateway.kyma-project.io -A -oyaml || true
- name: On error, fetch AuthorizationPolicies
if: failure()
run: |
kubectl get authorizationpolicies.security.istio.io -A -oyaml || true
- name: On error, fetch RequestAuthentications
if: failure()
run: |
kubectl get requestauthentications.security.istio.io -A -oyaml || true
- name: On error, fetch Subscriptions
if: failure()
run: |
kubectl get subscriptions.eventing.kyma-project.io -A -oyaml || true
- 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: On error, sleep for 1 day
if: failure()
run: |
sleep 1d
- name: Cleanup modules
if: ${{ always() }}
run: |
./scripts/cleanup_modules.sh
- 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