-
Notifications
You must be signed in to change notification settings - Fork 21
157 lines (135 loc) · 6.67 KB
/
move2kube-e2e.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
name: Move2kube Workflow end to end tests
on:
workflow_dispatch:
pull_request_target:
branches:
- main
paths:
- 'move2kube/**'
- 'pipeline/**'
- .github/workflows/move2kube-e2e.yaml
- .github/workflows/m2k-func.yaml
- .github/workflows/main.yml
jobs:
build:
uses: ./.github/workflows/main.yml
secrets: inherit
with:
workflow_id: move2kube
it_mode: true
build-m2k-kfunc:
uses: ./.github/workflows/m2k-func.yaml
secrets: inherit
with:
push_pr: false
run-m2k-e2e:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: kind
- name: Create sonataflow-infra namespace
run: |
# Needs to knative events resources in this namespace as the broker url is hard coded at the moment
kubectl create ns sonataflow-infra
- name: Create sshkeys secret
env:
SSH_PUB_KEY: ${{secrets.SSH_PUB_KEY}}
SSH_PRIV_KEY: ${{secrets.SSH_PRIV_KEY}}
run: |
echo "${SSH_PUB_KEY}" >> id_rsa.pub
echo "${SSH_PRIV_KEY}" >> id_rsa
kubectl create secret generic sshkeys --from-file=id_rsa=id_rsa --from-file=id_rsa.pub=id_rsa.pub
- name: Install move2kube instance
run: |
kubectl apply -f e2e/resources/move2kube-instance.yaml
kubectl get pods
kubectl wait --for=condition=Ready=true --timeout=2m pod -l app=move2kube-instance
- name: Download sonataflow artifacts generated manifests
uses: actions/download-artifact@v4
with:
name: serverless-workflow-move2kube-manifests
path: manifests
- name: Download serverless workflows move2kube image
uses: actions/download-artifact@v4
with:
name: serverless-workflow-move2kube-${{ github.sha }}.tar
- name: Download m2k-kfunc image
uses: actions/download-artifact@v4
with:
name: serverless-workflow-m2k-kfunc-${{ github.sha }}.tar
- name: Load move2kube workflow images to Kind
run: |
kind load image-archive serverless-workflow-move2kube-${{ github.sha }}.tar
kind load image-archive serverless-workflow-m2k-kfunc-${{ github.sha }}.tar
docker exec $(kind get clusters | head -1)-control-plane crictl images
- name: Deploy sonataflow-operator
run: |
helm repo add janus-idp-workflows https://rgolangh.github.io/janus-idp-workflows-helm/
helm install janus-idp-workflows janus-idp-workflows/janus-idp-workflows \
--set backstage.upstream.backstage.image.tag=1.1 \
-f https://raw.githubusercontent.com/rgolangh/janus-idp-workflows-helm/main/charts/kubernetes/orchestrator/values-k8s.yaml
echo "sleep bit long till the PV for data index and kaniko cache is ready. its a bit slow. TODO fixit"
kubectl get pv
sleep 3m
kubectl get sfp -A
kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=backstage" --timeout=180s
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=180s
- name: Deploy Move2kube serverless workflow
run: |
kubectl patch configmap/config-features \
-n knative-serving \
--type merge \
-p '{"data":{"kubernetes.podspec-init-containers": "enabled", "kubernetes.podspec-securitycontext": "enabled"}}'
###### workaround till https://issues.redhat.com/browse/FLPATH-892 is solved
# yq --inplace '.spec.podTemplate.container |= ( . + {"imagePullPolicy": "IfNotPresent"} )' manifests/01-sonataflow_m2k.yaml
###### end workaround
yq --inplace '.spec.podTemplate.container |= ( . + {"env": [{"name": "K_SINK", "value": "http://broker-ingress.knative-eventing.svc.cluster.local/sonataflow-infra/default"}]} )' manifests/01-sonataflow_m2k.yaml
# Disable persistence for e2e tests
yq --inplace 'del(.spec.persistence)' manifests/01-sonataflow_m2k.yaml
# The 'for loop' added due to inconsistency of the generated numbers of the configmaps
for file in manifests/*-configmap_m2k-props.yaml; do
sed -i '/quarkus\.flyway\.migrate-at-start=true/d' "$file"
done
# deploy the manifests created by the ${{ steps.build-image.outputs.image }}"
kubectl apply -f manifests
sleep 5
kubectl get deployment m2k -o jsonpath={.spec.template.spec.containers[]}
# give the pod time to start
sleep 15
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=m2k" --timeout=1m
kubectl patch configmap/m2k-props \
--type merge \
-p '{"data": {"application.properties" :"move2kube_url=http://move2kube-instance-svc.default.svc.cluster.local:8080\nquarkus.rest-client.move2kube_yaml.url=http://move2kube-instance-svc.default.svc.cluster.local:8080\nquarkus.rest-client.notifications.url=http://janus-idp-workflows-backstage.default.svc.cluster.local:7007/api/notifications/"}}'
kubectl delete pod -l "app=m2k"
kubectl get pods -o wide
- name: Deploy Knative function
run: |
###### workaround till https://issues.redhat.com/browse/FLPATH-892 is solved
yq --inplace '.spec.template.spec.containers[0] |= ( . + {"imagePullPolicy": "IfNotPresent"} )' e2e/resources/knative-service.yaml
###### end workaround
yq --inplace '.spec.template.spec.containers[0] |= ( . + {"image": "kind.local/orchestrator/serverless-workflow-m2k-kfunc:${{ github.sha }}"} )' e2e/resources/knative-service.yaml
# deploy the manifests created by the ${{ steps.build-image.outputs.image }}"
kubectl apply -f e2e/resources/knative-service.yaml
kubectl apply -f e2e/resources/knative-resources.yaml
kubectl wait ksvc m2k-save-transformation-func --for=condition=Ready=true --timeout=5m
- name: Run e2e script
run: |
e2e/move2kube.sh
- name: Export kind Logs
if: always()
run: |
kubectl get pods
kind export logs ./kind_logs
- name: Upload Kind Logs
uses: actions/upload-artifact@v4
# Always run this, even if one of th previous steps failed.
if: always()
with:
name: kind-logs
path: ./kind_logs/