-
Notifications
You must be signed in to change notification settings - Fork 23
142 lines (125 loc) · 5.54 KB
/
ci.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
name: EDA-Operator CI
on:
workflow_dispatch:
schedule:
- cron: '00 3 * * *'
env:
COLORTERM: 'yes'
TERM: 'xterm-256color'
jobs:
eda:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- SCENARIO: default # tests headless scenario too
- SCENARIO: externaldb
# - SCENARIO: ingress # TODO: This scenario currently fails because ui and event_stream ingress cannot have the same host and path in minikube nginx ingress controller
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Start minikube
run: minikube start --memory=max --cpus=max --vm-driver=docker --extra-config=apiserver.service-node-port-range=80-32000 --kubernetes-version=v1.28.9
- name: Enable ingress on minikube
run: minikube addons enable ingress
if: ${{ matrix.SCENARIO == 'ingress' }}
- name: Deploy external postgresql
run: |
eval $(minikube -p minikube docker-env)
docker volume create postgresql
docker run -d -p 5555:5432 --name postgresql -e POSTGRESQL_USER=eda -e POSTGRESQL_PASSWORD=eda -e POSTGRESQL_DATABASE=eda -v postgresql:/var/lib/pgsql/data quay.io/sclorg/postgresql-15-c9s:latest
echo $(minikube ip) eda-postgresql | sudo tee -a /etc/hosts
if: ${{ matrix.SCENARIO == 'externaldb' }}
- name: Build the EDA operator container image
run: |
eval $(minikube -p minikube docker-env)
make docker-build
env:
VERSION: main
- name: Deploy the EDA operator
run: |
sed -i 's/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g' config/manager/manager.yaml
make deploy
env:
NAMESPACE: eda
VERSION: main
- name: Set context to eda namespace
run: kubectl config set-context --current --namespace=eda
- name: Create postgresl secret for external database
run: kubectl apply -f .ci/eda-external-database.secret.yaml
if: ${{ matrix.SCENARIO == 'externaldb' }}
- name: Create the EDA demo CR
run: |
kubectl apply -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml
kubectl -n eda get eda eda-demo -o yaml
kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml
- name: Wait for the EDA API pod to be ready
run: |
kubectl wait --for condition=Ready pod --timeout=-1s -l app.kubernetes.io/component=eda-api
- name: Test EDA API via API k8s service
run: |
kubectl port-forward service/eda-demo-api 8081:8000 &
sleep 1
curl -s http://localhost:8081/api/eda/v1/status/
if: ${{ matrix.SCENARIO == 'default' }}
- name: Test EDA API via UI k8s service
run: |
kubectl port-forward service/eda-demo-ui 8080:80 &
sleep 1
curl -s http://localhost:8080/api/eda/v1/status/
if: ${{ matrix.SCENARIO != 'default' }}
- name: Test EDA API via k8s ingress
run: |
IP=$(kubectl get ingress -n eda eda-demo-ui-ingress -o json | jq .status.loadBalancer.ingress[0].ip -r)
curl -s http://${IP}:80/api/eda/v1/status/
if: ${{ matrix.SCENARIO == 'ingress' }}
- name: Backup EDA demo
run: |
kubectl apply -f .ci/eda_v1alpha1_edabackup.ci.yaml
kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_edabackup.ci.yaml
- name: Delete the EDA demo CR
run: |
kubectl delete --cascade=foreground -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml
kubectl wait --for=delete --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml
- name: Restore EDA demo
run: |
kubectl apply -f .ci/eda_v1alpha1_edarestore.ci.yaml
kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_edarestore.ci.yaml
kubectl wait --for condition=Successful --timeout=-1s -f .ci/eda_v1alpha1_eda.${{ matrix.SCENARIO }}.ci.yaml
- name: Get logs
if: always()
run: |
echo ::group::OPERATOR_LOGS
kubectl logs -l control-plane=controller-manager --tail=10000 || true
echo ::endgroup::
echo ::group::POSTGRES_LOGS
kubectl logs -l app.kubernetes.io/component=database --tail=1000 || true
echo ::endgroup::
echo ::group::REDIS_LOGS
kubectl logs -l app.kubernetes.io/component=cache --tail=1000 || true
echo ::endgroup::
echo ::group::EDA_API_LOGS
kubectl logs -l app.kubernetes.io/component=eda-api --tail=1000 || true
echo ::endgroup::
echo ::group::EDA_UI_LOGS
kubectl logs -l app.kubernetes.io/component=eda-ui --tail=1000 || true
echo ::endgroup::
echo ::group::EDA_DEFAULT_WORKER_LOGS
kubectl logs -l app.kubernetes.io/component=eda-default-worker --tail=1000 || true
echo ::endgroup::
echo ::group::EDA_ACTIVATION_WORKER_LOGS
kubectl logs -l app.kubernetes.io/component=eda-activation-worker --tail=1000 || true
echo ::endgroup::
echo ::group::EDA_SCHEDULER_LOGS
kubectl logs -l app.kubernetes.io/component=eda-scheduler --tail=1000 || true
echo ::endgroup::
validate-bundle:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Validate OLM Bundle
run: make bundle