-
Notifications
You must be signed in to change notification settings - Fork 12
550 lines (500 loc) · 20.4 KB
/
e2e.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
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
name: E2E
on:
workflow_dispatch:
inputs:
install_monitoring:
description: With Monitoring (Grafana backend, Goldilocks, k8s Dashboard, Seq and Jaeger)
default: false
type: boolean
install_mesh :
description: With Mesh (LinkerD)
default: false
type: boolean
install_ingress:
description: With Ingress (Cert-Manager, Traefik and WhoAmI)
default: true
type: boolean
install_config:
description: With Config (Elastic Backend, Redis, Vault, Etc)
default: false
type: boolean
install_identityserver4admin:
description: With Auth (IdentityServer4)
default: false
type: boolean
install_keycloak:
description: With Auth (Keycloak)
default: false
type: boolean
install_storage:
description: With Storage (Minio, Azurite, DockerRegistry UI)
default: false
type: boolean
install_messaging:
description: With Messaging (RabbitMq, Localstack, Kafka)
default: false
type: boolean
install_deploy:
description: With Deployments (ArgoCD)
default: false
type: boolean
install_DBs:
description: With Databases (MySQL, MariaDB, Postgres, MSSQL, MongoDB)
default: false
type: boolean
workflow_call:
inputs:
install_monitoring:
description: With Monitoring (Grafana backend, Goldilocks, k8s Dashboard, Seq and Jaeger)
default: false
type: boolean
install_mesh :
description: With Mesh (LinkerD)
default: false
type: boolean
install_ingress:
description: With Ingress (Cert-Manager, Traefik and WhoAmI)
default: true
type: boolean
install_config:
description: With Config (Elastic Backend, Redis, Vault, Etc)
default: false
type: boolean
install_identityserver4admin:
description: With Auth (IdentityServer4)
default: false
type: boolean
install_keycloak:
description: With Auth (Keycloak)
default: false
type: boolean
install_storage:
description: With Storage (Minio, Azurite, DockerRegistry UI)
default: false
type: boolean
install_messaging:
description: With Messaging (RabbitMq, Localstack, Kafka)
default: false
type: boolean
install_deploy:
description: With Deployments (ArgoCD)
default: false
type: boolean
install_DBs:
description: With Databases (MySQL, MariaDB, Postgres, MSSQL, MongoDB)
default: false
type: boolean
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write
jobs:
e2e:
strategy:
matrix:
cluster: [k3s, kind]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 k8s.local infrastructure.k8s.local traefik.infrastructure.k8s.local traefik.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 jaeger.infrastructure.k8s.local prometheus.infrastructure.k8s.local seq.infrastructure.k8s.local grafana.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 consul.infrastructure.k8s.local vault.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 es.infrastructure.k8s.local kibana.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 login.k8s.local admin.login.k8s.local api.login.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 app1.k8s.local api.app1.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 argo.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 linkerd.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 whoami1.k8s.local whoami2.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 keycloak.k8s.local auth.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 etcd.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 minio.infrastructure.k8s.local console.minio.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 azurite.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 rabbitmq.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 localstack.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 flux.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 kafka.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 mysql.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 mariadb.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 postgres.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 mssql.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 oracle.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 mongo.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 oracle.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 redis.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 goldilocks.infrastructure.k8s.local" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 dashboard.infrastructure.k8s.local" | sudo tee -a /etc/hosts
- name: Installing prerequisites
run: |
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl wget libnss3-tools cl-base64
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform
- name: Install mkcert
run: |
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
- name: Generate self-signed certificate
run: |
cd ./src/terraform
chmod +x ./generate_certificate.sh
./generate_certificate.sh
- name: Create env file for terraform validation
run: |
touch src/terraform/.env
echo GITHUB_OWNER=somebody >> src/terraform/.env
echo GITHUB_TOKEN=sometoken >> src/terraform/.env
echo ORACLE_EMAIL=someemail >> src/terraform/.env
echo ORACLE_PASSWORD=somepassword >> src/terraform/.env
echo DD_API_KEY=somekey >> src/terraform/.env
echo DD_SITE=somedomain >> src/terraform/.env
echo NEW_RELIC_ENDPOINT=someendpoint >> src/terraform/.env
echo NEW_RELIC_LICENSE_KEY=somekey >> src/terraform/.env
- name: Setup K3S Cluster
uses: nolar/setup-k3d-k3s@v1
if: ${{ matrix.cluster == 'k3s' }}
with:
version: v1.25.4+k3s1 # E.g.: v1.21, v1.21.2, v1.21.2+k3s1
k3d-args: '--config=src/tests/k3s/k3s-devinfra.yaml'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Kind Cluster
if: ${{ matrix.cluster == 'kind' }}
uses: helm/kind-action@v1.7.0
with:
cluster_name: kind-devinfra
config: src/tests/kind/kind-config.yaml
- name: Testing connectivity
run: |
kubectl cluster-info
kubectl get namespace
kubectl get pods --all-namespaces
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
kubectl cluster-info dump
- name: Terraform apply
run: |
cd ./src/terraform
terraform init --upgrade
terraform apply -var-file="../tests/${{ matrix.cluster }}/terraform.tfvars" --auto-approve
env:
TF_VAR_install_opentelemetry: ${{ inputs.install_monitoring || false }}
TF_VAR_install_loki: ${{ inputs.install_monitoring || false }}
TF_VAR_install_promtail: ${{ inputs.install_monitoring || false }}
TF_VAR_install_tempo: ${{ inputs.install_monitoring || false }}
TF_VAR_install_prometheus: ${{ inputs.install_monitoring || false }}
TF_VAR_install_grafana: ${{ inputs.install_monitoring || false }}
TF_VAR_install_goldilocks: ${{ inputs.install_monitoring || false }}
TF_VAR_install_vpa: ${{ inputs.install_monitoring || false }}
TF_VAR_install_dashboard: ${{ inputs.install_monitoring || false }}
TF_VAR_install_metrics: ${{ inputs.install_monitoring || false }}
TF_VAR_install_seq: ${{ inputs.install_monitoring || false}}
TF_VAR_install_jaeger: ${{ inputs.install_monitoring || false}}
TF_VAR_install_cadvisor: ${{ inputs.install_monitoring || false}}
TF_VAR_install_linkerd : ${{ inputs.install_mesh || false}}
TF_VAR_install_traefik: ${{ inputs.install_ingress || true}}
TF_VAR_install_cert_manager: ${{ inputs.install_ingress || true}}
TF_VAR_install_whoami: ${{ inputs.install_ingress || true}}
TF_VAR_install_elasticsearch: ${{ inputs.install_config || false}}
TF_VAR_install_kibana: ${{ inputs.install_config || false}}
TF_VAR_install_redis: ${{ inputs.install_config || false}}
TF_VAR_install_vault: ${{ inputs.install_config || false}}
TF_VAR_install_etcd: ${{ inputs.install_config || false}}
TF_VAR_install_identityserver4admin: ${{ inputs.install_identityserver4admin || false}}
TF_VAR_install_keycloak: ${{ inputs.install_keycloak || false}}
TF_VAR_install_minio: ${{ inputs.install_storage || false}}
TF_VAR_install_azurite: ${{ inputs.install_storage || false}}
TF_VAR_install_docker_registry: ${{ inputs.install_storage || false}}
TF_VAR_install_rabbitmq: ${{ inputs.install_messaging || false}}
TF_VAR_install_localstack: ${{ inputs.install_messaging || false}}
TF_VAR_install_kafka: ${{ inputs.install_messaging || false}}
TF_VAR_install_argocd: ${{ inputs.install_deploy || false}}
TF_VAR_install_flux2: false
TF_VAR_install_mysql: ${{ inputs.install_DBs || false}}
TF_VAR_install_mariadb: ${{ inputs.install_DBs || false}}
TF_VAR_install_postgres: ${{ inputs.install_DBs || false}}
TF_VAR_install_mssql: ${{ inputs.install_DBs || false}}
TF_VAR_install_mongodb: ${{ inputs.install_DBs || false}}
TF_VAR_install_oracle: false
- name: Await deployment cert-manager
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_ingress == true }}
with:
workloads: "" # all
namespace: "cert-manager"
timeout: 300
max-restarts: -1
- name: Await deployment linkerd
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_mesh == true }}
with:
workloads: "" # all
namespace: "linkerd"
timeout: 300
max-restarts: -1
- name: Await deployment traefik
uses: jupyterhub/action-k8s-await-workloads@v2
if: always()
with:
workloads: "" # all
namespace: "traefik"
timeout: 300
max-restarts: -1
- name: Kubernetes namespace report (traefik)
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: traefik
- name: Await deployment whoami
uses: jupyterhub/action-k8s-await-workloads@v2
with:
workloads: "" # all
namespace: "whoami" # default
timeout: 300
max-restarts: -1
- name: Kubernetes namespace report (whoami)
uses: jupyterhub/action-k8s-namespace-report@v1
if: always()
with:
namespace: whoami
- name: Await deployment etcd
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_config == true }}
with:
workloads: "" # all
namespace: "etcd" # default
timeout: 300
max-restarts: -1
# - name: Await deployment vault
# uses: jupyterhub/action-k8s-await-workloads@v2
# if: ${{ inputs.install_config == true }}
# with:
# workloads: "" # all
# namespace: "vault" # default
# timeout: 300
# max-restarts: -1
- name: Await deployment redis
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_config == true }}
with:
workloads: "" # all
namespace: "redis" # default
timeout: 300
max-restarts: -1
# - name: Await deployment elasticsearch
# uses: jupyterhub/action-k8s-await-workloads@v2
# if: ${{ inputs.install_config == true }}
# with:
# workloads: "" # all
# namespace: "elasticsearch" # default
# timeout: 300
# max-restarts: -1
- name: Await deployment azurite
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_storage == true }}
with:
workloads: "" # all
namespace: "azurite" # default
timeout: 300
max-restarts: -1
- name: Await deployment docker_registry
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_storage == true }}
with:
workloads: "" # all
namespace: "default" # default
timeout: 300
max-restarts: -1
- name: Await deployment minio
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_storage == true }}
with:
workloads: "" # all
namespace: "minio" # default
timeout: 300
max-restarts: -1
- name: Await deployment kafka
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_messaging == true }}
with:
workloads: "" # all
namespace: "kafka" # default
timeout: 300
max-restarts: -1
- name: Await deployment localstack
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_messaging == true }}
with:
workloads: "" # all
namespace: "localstack" # default
timeout: 300
max-restarts: -1
- name: Await deployment rabbitmq
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_messaging == true }}
with:
workloads: "" # all
namespace: "rabbitmq" # default
timeout: 300
max-restarts: -1
- name: Await deployment argocd
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_deploy == true }}
with:
workloads: "" # all
namespace: "argocd" # default
timeout: 300
max-restarts: -1
- name: Await deployment mysql
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_DBs == true }}
with:
workloads: "" # all
namespace: "mysql" # default
timeout: 300
max-restarts: -1
- name: Await deployment postgres
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_DBs == true }}
with:
workloads: "" # all
namespace: "postgres" # default
timeout: 300
max-restarts: -1
- name: Await deployment mariadb
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_DBs == true }}
with:
workloads: "" # all
namespace: "mariadb" # default
timeout: 300
max-restarts: -1
- name: Await deployment mssql
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_DBs == true }}
with:
workloads: "" # all
namespace: "mssql" # default
timeout: 300
max-restarts: -1
- name: Await deployment mongodb
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_DBs == true }}
with:
workloads: "" # all
namespace: "mongodb" # default
timeout: 300
max-restarts: -1
- name: Await deployment identityserver4admin
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_identityserver4admin == true }}
with:
workloads: "" # all
namespace: "identityserver4" # default
timeout: 300
max-restarts: -1
- name: Await deployment keycloak
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_keycloak == true }}
with:
workloads: "" # all
namespace: "keycloak" # default
timeout: 300
max-restarts: -1
- name: Await deployment loki
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "loki" # default
timeout: 300
max-restarts: -1
- name: Await deployment tempo
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "tempo" # default
timeout: 300
max-restarts: -1
- name: Await deployment cadvisor
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "cadvisor" # default
timeout: 300
max-restarts: -1
- name: Await deployment prometheus
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "prometheus" # default
timeout: 300
max-restarts: -1
- name: Await deployment opentelemetry
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "opentelemetry" # default
timeout: 300
max-restarts: -1
- name: Await deployment goldilocks
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "goldilocks" # default
timeout: 300
max-restarts: -1
- name: Await deployment vpa
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "vpa" # default
timeout: 300
max-restarts: -1
- name: Await deployment metrics
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "kube-system" # default
timeout: 300
max-restarts: -1
- name: Await deployment seq
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "seq" # default
timeout: 300
max-restarts: -1
- name: Await deployment jaeger
uses: jupyterhub/action-k8s-await-workloads@v2
if: ${{ inputs.install_monitoring == true }}
with:
workloads: "" # all
namespace: "jaeger" # default
timeout: 300
max-restarts: -1
- name: Run plain curl
run: |
curl https://whoami1.k8s.local
- name: Run newman tests
uses: matt-ball/newman-action@master
with:
collection: ./src/tests/k8s-dev-infrastructure.postman_collection.json
environment: ./src/tests/k8s.local.postman_environment.json
- name: Terraform destroy
run: |
cd ./src/terraform
terraform destroy -var-file="../tests/${{ matrix.cluster }}/terraform.tfvars" --auto-approve