Skip to content

Commit 4501ea9

Browse files
committed
add tabs to show verification steps with kn cli
1 parent e9fd163 commit 4501ea9

File tree

1 file changed

+116
-27
lines changed

1 file changed

+116
-27
lines changed

modules/serverless/pages/service-mesh/common-service-mesh-network-isolation.adoc

Lines changed: 116 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,32 @@ The helm chart has several options that can be passed to configure the generated
285285
This verification is assuming that we have two tenants with one namespace each, all part of the `ServiceMeshMemberRoll`, configured with resources listed above.
286286
We can then use curl to verify the connectivity:
287287

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::
289293
+
290294
[source,terminal]
291295
----
292296
# 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+
----
294314
apiVersion: serving.knative.dev/v1
295315
kind: Service
296316
metadata:
@@ -309,8 +329,32 @@ spec:
309329
env:
310330
- name: RESPONSE
311331
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+
====
313353
354+
. Deploy a `curl` pod to test the connections:
355+
+
356+
[source,terminal]
357+
----
314358
cat <<EOF | oc apply -f -
315359
apiVersion: apps/v1
316360
kind: Deployment
@@ -338,32 +382,78 @@ spec:
338382
- sleep
339383
- "3600"
340384
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
363385
----
364386
365387
. Verification
366388
+
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+
+
367457
[source,terminal]
368458
----
369459
# Test team-alpha-1 -> team-alpha-1 via cluster local domain (allowed)
@@ -428,6 +518,7 @@ x-envoy-upstream-service-time: 2856
428518

429519
Hello Serverless!
430520
----
521+
====
431522
432523
. Cleanup
433524
+
@@ -439,5 +530,3 @@ oc delete deployment/curl -n team-alpha-1
439530
oc delete ksvc/test-webapp -n team-alpha-1
440531
oc delete ksvc/test-webapp -n team-bravo-1
441532
----
442-
443-

0 commit comments

Comments
 (0)