-
Notifications
You must be signed in to change notification settings - Fork 18
330 lines (282 loc) · 12.6 KB
/
KubernetesInternalClients.yaml
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
name: Kubernetes internal clients compatibility tests
on:
workflow_dispatch:
inputs:
organization_name:
description: Default is hazelcast, but if you would like to run the workflow with your forked repo, set your github username
required: true
default: hazelcast
java_client_run:
description: JAVA = Set the branch name of client to run, otherwise set it as 'no' in order to skip running this client
required: true
default: master
python_run:
description: PYTHON = Set the branch name of client to run, otherwise set it as 'no' in order to skip running this client
required: true
default: master
nodejs_run:
description: NODEJS = Set the branch name of client to run, otherwise set it as 'no' in order to skip running this client
required: true
default: master
cpp_run:
description: CPP = Set the branch name of client to run, otherwise set it as 'no' in order to skip running this client
required: true
default: master
go_run:
description: GO = Set the branch name of client to run, otherwise set it as 'no' in order to skip running this client
required: true
default: master
csharp_run:
description: CSHARP = Set the branch name of client to run, otherwise set it as 'no' in order to skip running this client
required: true
default: master
jobs:
create-java-image:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.java_client_run != 'no' }}
steps:
- name: "Setup JRE"
uses: "actions/setup-java@v2"
with:
distribution: "zulu"
java-version: "17"
- name: Checkout
uses: actions/checkout@v4
- name: Checkout the client repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.organization_name }}/hazelcast-java-client
path: KubernetesInternalClients/java/clientSourceCode
ref: ${{ github.event.inputs.java_client_run }}
token: ${{ secrets.GH_PAT }}
- name: "Build OS"
working-directory: KubernetesInternalClients/java/clientSourceCode
run: |
chmod +x mvnw
HAZELCAST_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "HAZELCAST_VERSION=${HAZELCAST_VERSION}" >> $GITHUB_ENV
./mvnw -B -V -e clean install -DskipTests
- name: Build client application
working-directory: KubernetesInternalClients/java
run: |
sed -i "s/java-client-version/$HAZELCAST_VERSION/g" pom.xml
mvn clean install -DskipTests
docker build -t hazelcast-java-client:test .
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "hazelcast-java-client:test"
create-csharp-image:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.csharp_run != 'no' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout the client repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.organization_name }}/hazelcast-csharp-client
path: KubernetesInternalClients/csharp/clientSourceCode
ref: ${{ github.event.inputs.csharp_run }}
- name: Setup .NET Core 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
8.0.x
- name: Copy KubernetesTest project to csharp project
run: |
cp -R KubernetesInternalClients/csharp/KubernetesTest KubernetesInternalClients/csharp/clientSourceCode/src/
- name: Build KubernetesTest project
run: |
cd KubernetesInternalClients/csharp/clientSourceCode/src/KubernetesTest
dotnet build -c Release
- name: Build client application
run: |-
docker build -t hazelcast-csharp-client:test KubernetesInternalClients/csharp
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "hazelcast-csharp-client:test"
create-python-image:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.python_run != 'no' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout the client repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.organization_name }}/hazelcast-python-client
path: KubernetesInternalClients/python/clientSourceCode
ref: ${{ github.event.inputs.python-run }}
- name: Build client application
run: |-
docker build -t hazelcast-python-client:test KubernetesInternalClients/python
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "hazelcast-python-client:test"
create-nodejs-image:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.nodejs_run != 'no' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout the client repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.organization_name }}/hazelcast-nodejs-client
path: KubernetesInternalClients/nodejs/clientSourceCode
ref: ${{ github.event.inputs.nodejs_run }}
- name: Build client project
run: |
cd KubernetesInternalClients/nodejs/clientSourceCode
npm install
npm run compile
- name: Build client application
run: |-
docker build -t hazelcast-nodejs-client:test KubernetesInternalClients/nodejs
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "hazelcast-nodejs-client:test"
create-cpp-image:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.cpp_run != 'no' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout the client repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.organization_name }}/hazelcast-cpp-client
path: KubernetesInternalClients/cpp/clientSourceCode
ref: ${{ github.event.inputs.cpp_run }}
- name: Build client application
run: |-
docker build -t hazelcast-cpp-client:test KubernetesInternalClients/cpp
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "hazelcast-cpp-client:test"
create-go-image:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.go_run != 'no' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Give the branch name to go.mod file
run: |
cd KubernetesInternalClients/go
sed -i "s/<InputBranchName>/${{ github.event.inputs.go_run }}/g" go.mod
- name: Build client application
run: |-
docker build -t hazelcast-go-client:test KubernetesInternalClients/go
- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "hazelcast-go-client:test"
wait-for-images:
name: Waits for image creation and create json for which clients run
needs: [create-python-image, create-nodejs-image, create-go-image, create-csharp-image, create-cpp-image, create-java-image]
if: always()
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set which client will be run
id: set-matrix
run: echo "::set-output name=matrix::$( python set_which_client_run.py
--java ${{ github.event.inputs.java_client_run }}
--nodejs ${{ github.event.inputs.nodejs_run }}
--go ${{ github.event.inputs.go_run }}
--cpp ${{ github.event.inputs.cpp_run }}
--csharp ${{ github.event.inputs.csharp_run }}
--python ${{ github.event.inputs.python_run }})"
run-tests:
name: Run kubernetes compatibility test
needs: [wait-for-images]
if: always()
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
deployment-type: [ 'helm' ]
client-language: ${{ fromJson(needs.wait-for-images.outputs.matrix) }}
steps:
- name: Setup Kubernetes in Docker
uses: engineerd/[email protected]
with:
version: "v0.11.1"
- name: Deploy Hazelcast cluster (Helm)
if: startsWith(matrix.deployment-type, 'helm')
run: |-
helm repo add hazelcast https://hazelcast-charts.s3.amazonaws.com/
helm repo update
helm install hz-hazelcast hazelcast/hazelcast
- name: Wait for Hazelcast cluster
run: |-
kubectl wait --for=condition=ready pod/hz-hazelcast-0 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-1 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-2 --timeout=180s
- name: Download image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "hazelcast-${{ matrix.client-language }}-client:test"
- name: Deploy client application
run: |-
kind load docker-image hazelcast-${{ matrix.client-language }}-client:test
kubectl run hazelcast-${{ matrix.client-language }}-client --image=hazelcast-${{ matrix.client-language }}-client:test
kubectl wait --for=condition=ready pod/hazelcast-${{ matrix.client-language }}-client --timeout=180s
- name: Verify client application
run: |-
sleep 10
kubectl logs pod/hazelcast-${{ matrix.client-language }}-client | grep 'Successful connection!' -q
- name: Scale up
run: |
helm upgrade hz-hazelcast --set cluster.memberCount=6 hazelcast/hazelcast
kubectl wait --for=condition=ready pod/hz-hazelcast-0 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-1 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-2 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-3 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-4 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-5 --timeout=180s
sleep 60
- name: Verify after scale up
run: |
kubectl logs --tail=20 hazelcast-${{ matrix.client-language }}-client >> output-${{ matrix.client-language }}-scaleup.txt
cat output-${{ matrix.client-language }}-scaleup.txt
if [ $(grep -o 'Current map size:' output-${{ matrix.client-language }}-scaleup.txt | wc -l) != $"20" ]; then exit 1; fi
- name: Scale down
run: |
helm upgrade hz-hazelcast --set cluster.memberCount=3 hazelcast/hazelcast
sleep 120
- name: Verify after scale down
run: |
kubectl logs --tail=20 hazelcast-${{ matrix.client-language }}-client >> output-${{ matrix.client-language }}-scaledown.txt
cat output-${{ matrix.client-language }}-scaledown.txt
if [ $(grep -o 'Current map size:' output-${{ matrix.client-language }}-scaledown.txt | wc -l) != $"20" ]; then exit 1; fi
- name: Delete pods
run: |
kubectl delete pod hz-hazelcast-0 hz-hazelcast-1 hz-hazelcast-2
kubectl wait --for=condition=ready pod/hz-hazelcast-0 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-1 --timeout=180s
kubectl wait --for=condition=ready pod/hz-hazelcast-2 --timeout=180s
sleep 60
- name: Verify after delete pods
run: |
kubectl logs --tail=20 hazelcast-${{ matrix.client-language }}-client >> output-${{ matrix.client-language }}-deletepods.txt
cat output-${{ matrix.client-language }}-deletepods.txt
if [ $(grep -o 'Current map size:' output-${{ matrix.client-language }}-deletepods.txt | wc -l) != $"20" ]; then exit 1; fi
kubectl cp hazelcast-java-client:/log/hazelcast.log hazelcast.log
- name: Upload hazelcast logs
uses: actions/upload-artifact@v4
with:
name: hazelcast.log
path: hazelcast.log
- name: Logs
if: always()
run: |
kubectl logs pod/hazelcast-${{ matrix.client-language }}-client