@@ -285,12 +285,32 @@ The helm chart has several options that can be passed to configure the generated
285
285
This verification is assuming that we have two tenants with one namespace each, all part of the `ServiceMeshMemberRoll` , configured with resources listed above.
286
286
We can then use curl to verify the connectivity:
287
287
288
- . Deploy Knative Services in both tenants namespaces and a `curl` pod to run test commands:
288
+ . Deploy Knative Services in both tenants namespaces:
289
+ +
290
+ [tabs]
291
+ ====
292
+ Using the Knative CLI::
289
293
+
290
294
[source,terminal]
291
295
----
292
296
# Team Alpha
293
- cat <<EOF | oc apply -f -
297
+ kn service create test-webapp -n team-alpha-1 \
298
+ -- annotation-service serving.knative.openshift.io/enablePassthrough=true \
299
+ -- annotation-revision sidecar.istio.io/inject=true \
300
+ -- env RESPONSE="Hello Serverless" \
301
+ -- image docker.io/openshift/hello-openshift
302
+
303
+ # Team Bravo
304
+ kn service create test-webapp -n team-bravo-1 \
305
+ -- annotation-service serving.knative.openshift.io/enablePassthrough=true \
306
+ -- annotation-revision sidecar.istio.io/inject=true \
307
+ -- env RESPONSE="Hello Serverless" \
308
+ -- image docker.io/openshift/hello-openshift
309
+ ----
310
+ Using YAML::
311
+ +
312
+ [source,yaml]
313
+ ----
294
314
apiVersion: serving.knative.dev/v1
295
315
kind: Service
296
316
metadata:
@@ -309,8 +329,32 @@ spec:
309
329
env:
310
330
- name: RESPONSE
311
331
value: "Hello Serverless!"
312
- EOF
332
+ ---
333
+ apiVersion: serving.knative.dev/v1
334
+ kind: Service
335
+ metadata:
336
+ name: test-webapp
337
+ namespace: team-bravo-1
338
+ annotations:
339
+ serving.knative.openshift.io/enablePassthrough: "true"
340
+ spec:
341
+ template:
342
+ metadata:
343
+ annotations:
344
+ sidecar.istio.io/inject: 'true'
345
+ spec:
346
+ containers:
347
+ - image: docker.io/openshift/hello-openshift
348
+ env:
349
+ - name: RESPONSE
350
+ value: "Hello Serverless!"
351
+ ----
352
+ ====
313
353
354
+ . Deploy a `curl` pod to test the connections:
355
+ +
356
+ [source,terminal]
357
+ ----
314
358
cat <<EOF | oc apply -f -
315
359
apiVersion: apps/v1
316
360
kind: Deployment
@@ -338,32 +382,78 @@ spec:
338
382
- sleep
339
383
- "3600"
340
384
EOF
341
-
342
- # Team Bravo
343
- cat <<EOF | oc apply -f -
344
- apiVersion: serving.knative.dev/v1
345
- kind: Service
346
- metadata:
347
- name: test-webapp
348
- namespace: team-bravo-1
349
- annotations:
350
- serving.knative.openshift.io/enablePassthrough: "true"
351
- spec:
352
- template:
353
- metadata:
354
- annotations:
355
- sidecar.istio.io/inject: 'true'
356
- spec:
357
- containers:
358
- - image: docker.io/openshift/hello-openshift
359
- env:
360
- - name: RESPONSE
361
- value: "Hello Serverless!"
362
- EOF
363
385
----
364
386
365
387
. Verification
366
388
+
389
+ [tabs]
390
+ ====
391
+ Using the Knative CLI::
392
+ +
393
+ [source,terminal]
394
+ ----
395
+ # Test team-alpha-1 -> team-alpha-1 via cluster local domain (allowed)
396
+ oc exec deployment/curl -n team-alpha-1 -it -- curl -v http://test-webapp.team-alpha-1:80
397
+
398
+ HTTP/1.1 200 OK
399
+ content-length: 18
400
+ content-type: text/plain; charset=utf-8
401
+ date: Wed, 26 Jul 2023 12:49:59 GMT
402
+ server: envoy
403
+ x-envoy-upstream-service-time: 9
404
+
405
+ Hello Serverless!
406
+
407
+
408
+ # Test team-alpha-1 -> team-alpha-1 via external domain (allowed)
409
+ oc exec deployment/curl -n team-alpha-1 -it -- curl -ik $(kn service describe test-webapp -o url -n team-alpha-1)
410
+
411
+ HTTP/2 200
412
+ content-length: 18
413
+ content-type: text/plain; charset=utf-8
414
+ date: Wed, 26 Jul 2023 12:55:30 GMT
415
+ server: istio-envoy
416
+ x-envoy-upstream-service-time: 3629
417
+
418
+ Hello Serverless!
419
+
420
+
421
+ # Test team-alpha-1 -> team-bravo-1 via cluster local domain (not allowed)
422
+ oc exec deployment/curl -n team-alpha-1 -it -- curl -v http://test-webapp.team-bravo-1:80
423
+
424
+ * processing: http://test-webapp.team-bravo-1:80
425
+ * Trying 172.30.73.216:80...
426
+ * Connected to test-webapp.team-bravo-1 (172.30.73.216) port 80
427
+ > GET / HTTP/1.1
428
+ > Host: test-webapp.team-bravo-1
429
+ > User-Agent: curl/8.2.0
430
+ > Accept: */*
431
+ >
432
+ < HTTP/1.1 403 Forbidden
433
+ < content-length: 19
434
+ < content-type: text/plain
435
+ < date: Wed, 26 Jul 2023 12:55:49 GMT
436
+ < server: envoy
437
+ < x-envoy-upstream-service-time: 6
438
+ <
439
+ * Connection #0 to host test-webapp.team-bravo-1 left intact
440
+ RBAC: access denied
441
+
442
+
443
+ # Test team-alpha-1 -> team-bravo-1 via external domain (allowed)
444
+ oc exec deployment/curl -n team-alpha-1 -it -- curl -ik $(kn service describe test-webapp -o url -n team-bravo-1)
445
+
446
+ HTTP/2 200
447
+ content-length: 18
448
+ content-type: text/plain; charset=utf-8
449
+ date: Wed, 26 Jul 2023 12:56:22 GMT
450
+ server: istio-envoy
451
+ x-envoy-upstream-service-time: 2856
452
+
453
+ Hello Serverless!
454
+ ----
455
+ Using OC client::
456
+ +
367
457
[source,terminal]
368
458
----
369
459
# Test team-alpha-1 -> team-alpha-1 via cluster local domain (allowed)
@@ -428,6 +518,7 @@ x-envoy-upstream-service-time: 2856
428
518
429
519
Hello Serverless!
430
520
----
521
+ ====
431
522
432
523
. Cleanup
433
524
+
@@ -439,5 +530,3 @@ oc delete deployment/curl -n team-alpha-1
439
530
oc delete ksvc/test-webapp -n team-alpha-1
440
531
oc delete ksvc/test-webapp -n team-bravo-1
441
532
----
442
-
443
-
0 commit comments