forked from vmware-samples/vcenter-event-broker-appliance
-
Notifications
You must be signed in to change notification settings - Fork 0
278 lines (239 loc) · 9.95 KB
/
router-helm.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
name: VMware Event Router Helm Test
# triggered on every push and PRs but only when changes inside
# vmware-event-router (sub)dir(s)
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'vmware-event-router/**'
push:
paths:
- 'vmware-event-router/**'
env:
KIND_VERSION: v0.11.1
NAMESPACE: vmware
KO_DOCKER_REPO: kind.local
jobs:
openfaas:
name: OpenFaaS Event Processor
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Set up Go 1.17.x
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 # v2.1.5
with:
go-version: 1.17
- name: Setup ko
uses: imjasonh/setup-ko@2c3450ca27f6e6f2b02e72a40f2163c281a1f675 # v0.4
- name: Check out code onto GOPATH
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
with:
fetch-depth: 1
- name: Get short COMMIT and TAG (used by ko)
run: |
echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV
echo "KO_TAG=$(basename "${{ github.ref }}")" >> $GITHUB_ENV
- name: Setup KinD Cluster
run: |
set -x
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
# KinD configuration.
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
EOF
# Create a cluster!
kind create cluster --config kind.yaml --wait 3m
- name: Build router image with ko
working-directory: ./vmware-event-router
run: |
# loads image into kind
ko resolve -BRf deploy/event-router-k8s.yaml
- name: Install OpenFaaS with Helm
run: |
kubectl create ns openfaas && kubectl create ns openfaas-fn
helm repo add openfaas https://openfaas.github.io/faas-netes
helm repo update
helm upgrade openfaas --install openfaas/openfaas \
--namespace openfaas \
--set functionNamespace=openfaas-fn \
--set generateBasicAuth=true --wait
kubectl wait --timeout=3m --for=condition=Available -n openfaas deploy/gateway
echo "OF_PASS=$(kubectl -n openfaas get secret basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode)" >> $GITHUB_ENV
- name: Install vCenter Simulator
working-directory: ./vmware-event-router
run: |
kubectl create ns ${NAMESPACE}
kubectl -n ${NAMESPACE} apply -f deploy/vcsim.yaml
kubectl wait --timeout=3m --for=condition=Available -n ${NAMESPACE} deploy/vcsim
- name: Install VMware Event Router with Helm
working-directory: ./vmware-event-router
run: |
echo "::group::Create override.yaml"
cat << EOF > override.yaml
image:
fullImage: kind.local/router:latest
pullPolicy: IfNotPresent
eventrouter:
config:
logLevel: debug
vcenter:
address: https://vcsim.vmware.svc.cluster.local
username: user
password: pass
insecure: true # ignore TLS certs
eventProcessor: openfaas
openfaas:
address: http://gateway.openfaas.svc.cluster.local:8080
basicAuth: true
username: admin
password: ${OF_PASS}
EOF
echo "::endgroup::"
echo "::group::Deploy VMware Event Router"
helm install veba-openfaas -n ${NAMESPACE} --wait -f override.yaml ./chart
# assert it deployed correctly
kubectl wait --timeout=3m --for=condition=Available -n ${NAMESPACE} deploy/router
echo "::endgroup::"
- name: "Debug"
if: ${{ always() }}
run: |
kubectl get pods --all-namespaces
kubectl -n ${NAMESPACE} describe pods
kubectl -n ${NAMESPACE} get events
knative:
name: Knative Event Processor
runs-on: ubuntu-latest
env:
KNATIVE_VERSION: knative-v1.1.0 # same as VEBA BOM
BROKER_NAMESPACE: default
BROKER_NAME: default
timeout-minutes: 15
steps:
- name: Set up Go 1.17.x
uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 # v2.1.5
with:
go-version: 1.17
- name: Setup ko
uses: imjasonh/setup-ko@2c3450ca27f6e6f2b02e72a40f2163c281a1f675 # v0.4
- name: Check out code onto GOPATH
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
with:
fetch-depth: 1
- name: Get short COMMIT and TAG (used by ko)
run: |
echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV
echo "KO_TAG=$(basename "${{ github.ref }}")" >> $GITHUB_ENV
- name: Setup KinD Cluster
run: |
set -x
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
# KinD configuration.
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
EOF
# Create a cluster!
kind create cluster --config kind.yaml --wait 3m
- name: Build router image with ko
working-directory: ./vmware-event-router
run: |
# loads image into kind
ko resolve -BRf deploy/event-router-k8s.yaml
- name: Setup Knative Serving
run: |
echo "::group::Serving CRDs"
kubectl apply -f https://github.com/knative/serving/releases/download/${KNATIVE_VERSION}/serving-crds.yaml
kubectl wait --timeout=20s --for=condition=Established crd/services.serving.knative.dev
echo "::endgroup::"
echo "::group::Serving Core"
kubectl apply -f https://github.com/knative/serving/releases/download/${KNATIVE_VERSION}/serving-core.yaml
kubectl -n knative-serving wait --timeout=3m --for=condition=Available deploy/webhook
echo "::endgroup::"
echo "::group::Ingress"
echo "waiting 10s before proceeding..." && sleep 10 # hack: give webhook mutating admission controllers some time to settle
kubectl apply -f https://github.com/knative/net-kourier/releases/download/${KNATIVE_VERSION}/kourier.yaml
kubectl -n kourier-system wait --timeout=3m --for=condition=Available deploy/3scale-kourier-gateway
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
echo "::endgroup::"
- name: Setup Knative Eventing
run: |
echo "::group::Eventing CRDs"
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/eventing-crds.yaml
kubectl wait --timeout=20s --for=condition=Established crd/brokers.eventing.knative.dev
echo "::endgroup::"
echo "::group::Eventing Core"
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/eventing-core.yaml
kubectl -n knative-eventing wait --timeout=3m --for=condition=Available deploy/eventing-webhook
echo "::endgroup::"
echo "::group::Broker Core"
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/in-memory-channel.yaml
kubectl -n knative-eventing wait --timeout=3m --for=condition=Available deploy/imc-controller
kubectl apply -f https://github.com/knative/eventing/releases/download/${KNATIVE_VERSION}/mt-channel-broker.yaml
kubectl -n knative-eventing wait --timeout=3m --for=condition=Available deploy/mt-broker-controller
echo "::endgroup::"
echo "::group::Default Broker"
kubectl apply -f - <<EOF
apiVersion: eventing.knative.dev/v1
kind: broker
metadata:
name: ${BROKER_NAME}
namespace: ${BROKER_NAMESPACE}
EOF
echo "::endgroup::"
- name: Install vCenter Simulator
working-directory: ./vmware-event-router
run: |
kubectl create ns ${NAMESPACE}
kubectl -n ${NAMESPACE} apply -f deploy/vcsim.yaml
kubectl wait --timeout=3m --for=condition=Available -n ${NAMESPACE} deploy/vcsim
- name: Install VMware Event Router with Helm
working-directory: ./vmware-event-router
run: |
echo "::group::Create override.yaml"
cat << EOF > override.yaml
image:
fullImage: kind.local/router:latest
pullPolicy: IfNotPresent
eventrouter:
config:
logLevel: debug
vcenter:
address: https://vcsim.vmware.svc.cluster.local
username: user
password: pass
insecure: true # ignore TLS certs
eventProcessor: knative
knative:
destination:
ref:
apiVersion: eventing.knative.dev/v1
kind: Broker
name: ${BROKER_NAME}
namespace: ${BROKER_NAMESPACE}
EOF
echo "::endgroup::"
echo "::group::Deploy VMware Event Router"
helm install veba-knative -n ${NAMESPACE} --wait -f override.yaml ./chart
# assert it deployed correctly
kubectl wait --timeout=3m --for=condition=Available -n ${NAMESPACE} deploy/router
echo "::endgroup::"
- name: "Debug"
if: ${{ always() }}
run: |
kubectl get pods --all-namespaces
kubectl -n ${NAMESPACE} describe pods
kubectl -n ${NAMESPACE} get events