From 6d6021b0f9782fb2a95bc415a4b1e99f794f5a55 Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Mon, 25 Jan 2021 18:59:17 +0700 Subject: [PATCH 1/4] add vpp forwarder and do refactor Signed-off-by: Denis Tingaikin --- .../forwarder.yaml | 22 +++++++++++++------ .../kustomization.yaml | 0 examples/RemoteConnection/namespace.yaml | 5 ----- examples/SRIOVKernelConnection/namespace.yaml | 5 ----- examples/VFIOConnection/namespace.yaml | 5 ----- examples/basic/README.md | 4 ++-- examples/basic/kustomization.yaml | 2 +- examples/memory/README.md | 4 ++-- examples/memory/kustomization.yaml | 2 +- examples/sriov/README.md | 4 ++-- .../{ => use-cases}/LocalConnection/README.md | 11 +++++++--- .../RemoteConnection/README.md | 14 +++++++++--- .../SRIOVKernelConnection/README.md | 6 ++--- .../{ => use-cases}/VFIOConnection/README.md | 6 ++--- .../namespace.yaml | 0 15 files changed, 48 insertions(+), 42 deletions(-) rename apps/{fake-forwarder => forwarder-vpp}/forwarder.yaml (63%) rename apps/{fake-forwarder => forwarder-vpp}/kustomization.yaml (100%) delete mode 100644 examples/RemoteConnection/namespace.yaml delete mode 100644 examples/SRIOVKernelConnection/namespace.yaml delete mode 100644 examples/VFIOConnection/namespace.yaml rename examples/{ => use-cases}/LocalConnection/README.md (88%) rename examples/{ => use-cases}/RemoteConnection/README.md (85%) rename examples/{ => use-cases}/SRIOVKernelConnection/README.md (97%) rename examples/{ => use-cases}/VFIOConnection/README.md (96%) rename examples/{LocalConnection => use-cases}/namespace.yaml (100%) diff --git a/apps/fake-forwarder/forwarder.yaml b/apps/forwarder-vpp/forwarder.yaml similarity index 63% rename from apps/fake-forwarder/forwarder.yaml rename to apps/forwarder-vpp/forwarder.yaml index 788d2e562c61..be3c5f322792 100644 --- a/apps/fake-forwarder/forwarder.yaml +++ b/apps/forwarder-vpp/forwarder.yaml @@ -2,26 +2,34 @@ apiVersion: apps/v1 kind: DaemonSet metadata: - name: fake-cross-nse + name: forwarder-vpp labels: - app: fake-cross-nse + app: forwarder-vpp spec: selector: matchLabels: - app: fake-cross-nse + app: forwarder-vpp template: metadata: labels: - app: fake-cross-nse + app: forwarder-vpp spec: containers: - - image: networkservicemeshci/fake-cross-nse:latest + - image: networkservicemeshci/cmd-forwarder-vpp:latest imagePullPolicy: IfNotPresent - name: fake-cross-nse + name: forwarder-vpp + securityContext: + privileged: true env: - name: SPIFFE_ENDPOINT_SOCKET value: unix:///run/spire/sockets/agent.sock - - name: FAKE-CROSS-NSE_NAME + - name: NSM_TUNNEL_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: NSM_CONNECT_TO + value: unix:///var/lib/networkservicemesh/nsm.io.sock + - name: NSM_NAME valueFrom: fieldRef: fieldPath: metadata.name diff --git a/apps/fake-forwarder/kustomization.yaml b/apps/forwarder-vpp/kustomization.yaml similarity index 100% rename from apps/fake-forwarder/kustomization.yaml rename to apps/forwarder-vpp/kustomization.yaml diff --git a/examples/RemoteConnection/namespace.yaml b/examples/RemoteConnection/namespace.yaml deleted file mode 100644 index 7919ccab9bec..000000000000 --- a/examples/RemoteConnection/namespace.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - generateName: ns- diff --git a/examples/SRIOVKernelConnection/namespace.yaml b/examples/SRIOVKernelConnection/namespace.yaml deleted file mode 100644 index 7919ccab9bec..000000000000 --- a/examples/SRIOVKernelConnection/namespace.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - generateName: ns- diff --git a/examples/VFIOConnection/namespace.yaml b/examples/VFIOConnection/namespace.yaml deleted file mode 100644 index 7919ccab9bec..000000000000 --- a/examples/VFIOConnection/namespace.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -apiVersion: v1 -kind: Namespace -metadata: - generateName: ns- diff --git a/examples/basic/README.md b/examples/basic/README.md index 426a67a7be8c..eda91592c201 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -8,8 +8,8 @@ Basis example contains setup and tear down logic with default NSM infrastructure ## Includes -- [Local Connection](../LocalConnection) -- [Remote Connection](../RemoteConnection) +- [Local Connection](../use-cases/LocalConnection) +- [Remote Connection](../use-cases/RemoteConnection) ## Run diff --git a/examples/basic/kustomization.yaml b/examples/basic/kustomization.yaml index 12fac67ceb48..65a11e939088 100644 --- a/examples/basic/kustomization.yaml +++ b/examples/basic/kustomization.yaml @@ -6,5 +6,5 @@ namespace: nsm-system bases: - ../../apps/nsmgr -- ../../apps/fake-forwarder +- ../../apps/forwarder-vpp - ../../apps/registry-k8s diff --git a/examples/memory/README.md b/examples/memory/README.md index 2f25270c8c30..8850a210e5a2 100644 --- a/examples/memory/README.md +++ b/examples/memory/README.md @@ -8,8 +8,8 @@ Memory example contains setup and tear down logic with default NSM infrastructur ## Includes -- [Local Connection](../LocalConnection) -- [Remote Connection](../RemoteConnection) +- [Local Connection](../use-cases/LocalConnection) +- [Remote Connection](../use-cases/RemoteConnection) ## Run diff --git a/examples/memory/kustomization.yaml b/examples/memory/kustomization.yaml index 64cfe759331c..6a92d7a4e7e1 100644 --- a/examples/memory/kustomization.yaml +++ b/examples/memory/kustomization.yaml @@ -6,5 +6,5 @@ namespace: nsm-system bases: - ../../apps/nsmgr -- ../../apps/fake-forwarder +- ../../apps/forwarder-vpp - ../../apps/registry-memory diff --git a/examples/sriov/README.md b/examples/sriov/README.md index 1f0b7cdaef92..f5ed1db3446a 100644 --- a/examples/sriov/README.md +++ b/examples/sriov/README.md @@ -4,8 +4,8 @@ ## Includes -- [VFIO Connection](../VFIOConnection) -- [Kernel Connection](../SRIOVKernelConnection) +- [VFIO Connection](../use-cases/VFIOConnection) +- [Kernel Connection](../use-cases/SRIOVKernelConnection) ## Run diff --git a/examples/LocalConnection/README.md b/examples/use-cases/LocalConnection/README.md similarity index 88% rename from examples/LocalConnection/README.md rename to examples/use-cases/LocalConnection/README.md index 0b891a78f793..8940f74e90cf 100644 --- a/examples/LocalConnection/README.md +++ b/examples/use-cases/LocalConnection/README.md @@ -7,7 +7,7 @@ This example shows that NSC and NSE on the one node can find each other. Create test namespace: ```bash -NAMESPACE=($(kubectl create -f namespace.yaml)[0]) +NAMESPACE=($(kubectl create -f ../namespace.yaml)[0]) NAMESPACE=${NAMESPACE:10} ``` @@ -36,8 +36,8 @@ kind: Kustomization namespace: ${NAMESPACE} bases: -- ../../apps/kernel-nsc -- ../../apps/kernel-nse +- ../../../apps/kernel-nsc +- ../../../apps/kernel-nse patchesStrategicMerge: - patch-nsc.yaml @@ -77,6 +77,11 @@ metadata: spec: template: spec: + containers: + - name: nse + env: + - name: NSM_NETWORK_SERVICES + value: kernel://icmp-responder/nsm-1 nodeSelector: kubernetes.io/hostname: ${NODE} EOF diff --git a/examples/RemoteConnection/README.md b/examples/use-cases/RemoteConnection/README.md similarity index 85% rename from examples/RemoteConnection/README.md rename to examples/use-cases/RemoteConnection/README.md index 533c28c50132..4a4819b9dccf 100644 --- a/examples/RemoteConnection/README.md +++ b/examples/use-cases/RemoteConnection/README.md @@ -6,7 +6,7 @@ This example shows that NSC and NSE on the different nodes could find and work w Create test namespace: ```bash -NAMESPACE=($(kubectl create -f namespace.yaml)[0]) +NAMESPACE=($(kubectl create -f ../namespace.yaml)[0]) NAMESPACE=${NAMESPACE:10} ``` @@ -35,8 +35,8 @@ kind: Kustomization namespace: ${NAMESPACE} bases: -- ../../apps/kernel-nsc -- ../../apps/kernel-nse +- ../../../apps/kernel-nsc +- ../../../apps/kernel-nse patchesStrategicMerge: - patch-nsc.yaml @@ -60,6 +60,7 @@ spec: env: - name: NSM_NETWORK_SERVICES value: kernel://icmp-responder/nsm-1 + nodeSelector: kubernetes.io/hostname: ${NODES[0]} EOF @@ -76,6 +77,13 @@ metadata: spec: template: spec: + containers: + - name: nse + env: + - name: NSE_CIDR_PREFIX + value: 172.16.1.100/31 + - name: NSM_NETWORK_SERVICES + value: kernel://icmp-responder/nsm-1 nodeSelector: kubernetes.io/hostname: ${NODES[1]} EOF diff --git a/examples/SRIOVKernelConnection/README.md b/examples/use-cases/SRIOVKernelConnection/README.md similarity index 97% rename from examples/SRIOVKernelConnection/README.md rename to examples/use-cases/SRIOVKernelConnection/README.md index 7aeb1a24cb2c..1c20d2b9b662 100644 --- a/examples/SRIOVKernelConnection/README.md +++ b/examples/use-cases/SRIOVKernelConnection/README.md @@ -30,9 +30,9 @@ kind: Kustomization namespace: ${NAMESPACE} bases: -- ../../apps/kernel-nsc -- ../../apps/kernel-nse -- ../../apps/kernel-ponger +- ../../../apps/kernel-nsc +- ../../../apps/kernel-nse +- ../../../apps/kernel-ponger patchesStrategicMerge: diff --git a/examples/VFIOConnection/README.md b/examples/use-cases/VFIOConnection/README.md similarity index 96% rename from examples/VFIOConnection/README.md rename to examples/use-cases/VFIOConnection/README.md index c4a98cebc5c9..3fd491793e78 100644 --- a/examples/VFIOConnection/README.md +++ b/examples/use-cases/VFIOConnection/README.md @@ -6,7 +6,7 @@ This example shows that NSC and NSE can work with each other over the VFIO conne Create test namespace: ```bash -NAMESPACE=($(kubectl create -f namespace.yaml)[0]) +NAMESPACE=($(kubectl create -f ../namespace.yaml)[0]) NAMESPACE=${NAMESPACE:10} ``` @@ -30,8 +30,8 @@ kind: Kustomization namespace: ${NAMESPACE} bases: -- ../../apps/vfio-nsc -- ../../apps/vfio-nse +- ../../../apps/vfio-nsc +- ../../../apps/vfio-nse EOF ``` diff --git a/examples/LocalConnection/namespace.yaml b/examples/use-cases/namespace.yaml similarity index 100% rename from examples/LocalConnection/namespace.yaml rename to examples/use-cases/namespace.yaml From 3991ba5112bc7434c6d1d586255df96c473b855c Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Tue, 26 Jan 2021 19:02:10 +0700 Subject: [PATCH 2/4] refactor examples and expand tests Signed-off-by: Denis Tingaikin --- .../kustomization.yaml | 2 +- .../sriov-forwarder.yaml | 10 ++++---- apps/forwarder-vpp/forwarder.yaml | 2 +- .../kustomization.yaml | 0 .../ponger-configmap.yaml | 0 .../ponger.yaml | 0 .../kustomization.yaml | 0 apps/{kernel-nsc => nsc-kernel}/nsc.yaml | 2 ++ .../{vfio-nsc => nsc-vfio}/kustomization.yaml | 0 apps/{vfio-nsc => nsc-vfio}/nsc.yaml | 0 .../kustomization.yaml | 0 apps/{kernel-nse => nse-kernel}/nse.yaml | 0 .../{vfio-nse => nse-vfio}/kustomization.yaml | 0 .../{vfio-nse => nse-vfio}/nse-configmap.yaml | 0 apps/{vfio-nse => nse-vfio}/nse.yaml | 0 examples/sriov/kustomization.yaml | 2 +- examples/use-cases/LocalConnection/README.md | 24 +++++++++++++++---- .../LocalConnection/kustomization.yaml | 13 ++++++++++ .../use-cases/LocalConnection/patch-nsc.yaml | 15 ++++++++++++ .../use-cases/LocalConnection/patch-nse.yaml | 17 +++++++++++++ examples/use-cases/RemoteConnection/README.md | 23 ++++++++++++++++-- .../use-cases/SRIOVKernelConnection/README.md | 6 ++--- examples/use-cases/VFIOConnection/README.md | 2 +- 23 files changed, 100 insertions(+), 18 deletions(-) rename apps/{sriov-forwarder => forwarder-sriov}/kustomization.yaml (77%) rename apps/{sriov-forwarder => forwarder-sriov}/sriov-forwarder.yaml (92%) rename apps/{kernel-ponger => nsc-kernel-ponger}/kustomization.yaml (100%) rename apps/{kernel-ponger => nsc-kernel-ponger}/ponger-configmap.yaml (100%) rename apps/{kernel-ponger => nsc-kernel-ponger}/ponger.yaml (100%) rename apps/{kernel-nsc => nsc-kernel}/kustomization.yaml (100%) rename apps/{kernel-nsc => nsc-kernel}/nsc.yaml (94%) rename apps/{vfio-nsc => nsc-vfio}/kustomization.yaml (100%) rename apps/{vfio-nsc => nsc-vfio}/nsc.yaml (100%) rename apps/{kernel-nse => nse-kernel}/kustomization.yaml (100%) rename apps/{kernel-nse => nse-kernel}/nse.yaml (100%) rename apps/{vfio-nse => nse-vfio}/kustomization.yaml (100%) rename apps/{vfio-nse => nse-vfio}/nse-configmap.yaml (100%) rename apps/{vfio-nse => nse-vfio}/nse.yaml (100%) create mode 100644 examples/use-cases/LocalConnection/kustomization.yaml create mode 100644 examples/use-cases/LocalConnection/patch-nsc.yaml create mode 100644 examples/use-cases/LocalConnection/patch-nse.yaml diff --git a/apps/sriov-forwarder/kustomization.yaml b/apps/forwarder-sriov/kustomization.yaml similarity index 77% rename from apps/sriov-forwarder/kustomization.yaml rename to apps/forwarder-sriov/kustomization.yaml index 8b0d2cb9c35e..9e5a2ea01e0d 100644 --- a/apps/sriov-forwarder/kustomization.yaml +++ b/apps/forwarder-sriov/kustomization.yaml @@ -3,4 +3,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- sriov-forwarder.yaml +- forwarder-sriov.yaml diff --git a/apps/sriov-forwarder/sriov-forwarder.yaml b/apps/forwarder-sriov/sriov-forwarder.yaml similarity index 92% rename from apps/sriov-forwarder/sriov-forwarder.yaml rename to apps/forwarder-sriov/sriov-forwarder.yaml index a9f22417c904..106c1a57ff82 100644 --- a/apps/sriov-forwarder/sriov-forwarder.yaml +++ b/apps/forwarder-sriov/sriov-forwarder.yaml @@ -2,23 +2,23 @@ apiVersion: apps/v1 kind: DaemonSet metadata: - name: sriov-forwarder + name: forwarder-sriov labels: - app: sriov-forwarder + app: forwarder-sriov spec: selector: matchLabels: - app: sriov-forwarder + app: forwarder-sriov template: metadata: labels: - app: sriov-forwarder + app: forwarder-sriov spec: hostNetwork: true containers: - image: networkservicemeshci/cmd-forwarder-sriov:5caf3253 imagePullPolicy: IfNotPresent - name: sriov-forwarder + name: forwarder-sriov securityContext: privileged: true env: diff --git a/apps/forwarder-vpp/forwarder.yaml b/apps/forwarder-vpp/forwarder.yaml index be3c5f322792..dd781c77e3e1 100644 --- a/apps/forwarder-vpp/forwarder.yaml +++ b/apps/forwarder-vpp/forwarder.yaml @@ -15,7 +15,7 @@ spec: app: forwarder-vpp spec: containers: - - image: networkservicemeshci/cmd-forwarder-vpp:latest + - image: networkservicemeshci/cmd-forwarder-vpp:46aab74c imagePullPolicy: IfNotPresent name: forwarder-vpp securityContext: diff --git a/apps/kernel-ponger/kustomization.yaml b/apps/nsc-kernel-ponger/kustomization.yaml similarity index 100% rename from apps/kernel-ponger/kustomization.yaml rename to apps/nsc-kernel-ponger/kustomization.yaml diff --git a/apps/kernel-ponger/ponger-configmap.yaml b/apps/nsc-kernel-ponger/ponger-configmap.yaml similarity index 100% rename from apps/kernel-ponger/ponger-configmap.yaml rename to apps/nsc-kernel-ponger/ponger-configmap.yaml diff --git a/apps/kernel-ponger/ponger.yaml b/apps/nsc-kernel-ponger/ponger.yaml similarity index 100% rename from apps/kernel-ponger/ponger.yaml rename to apps/nsc-kernel-ponger/ponger.yaml diff --git a/apps/kernel-nsc/kustomization.yaml b/apps/nsc-kernel/kustomization.yaml similarity index 100% rename from apps/kernel-nsc/kustomization.yaml rename to apps/nsc-kernel/kustomization.yaml diff --git a/apps/kernel-nsc/nsc.yaml b/apps/nsc-kernel/nsc.yaml similarity index 94% rename from apps/kernel-nsc/nsc.yaml rename to apps/nsc-kernel/nsc.yaml index 57cfa96edbbd..0815da1db600 100644 --- a/apps/kernel-nsc/nsc.yaml +++ b/apps/nsc-kernel/nsc.yaml @@ -21,6 +21,8 @@ spec: env: - name: SPIFFE_ENDPOINT_SOCKET value: unix:///run/spire/sockets/agent.sock + - name: NSM_REQUEST_TIMEOUT + value: 5m - name: NSM_NAME valueFrom: fieldRef: diff --git a/apps/vfio-nsc/kustomization.yaml b/apps/nsc-vfio/kustomization.yaml similarity index 100% rename from apps/vfio-nsc/kustomization.yaml rename to apps/nsc-vfio/kustomization.yaml diff --git a/apps/vfio-nsc/nsc.yaml b/apps/nsc-vfio/nsc.yaml similarity index 100% rename from apps/vfio-nsc/nsc.yaml rename to apps/nsc-vfio/nsc.yaml diff --git a/apps/kernel-nse/kustomization.yaml b/apps/nse-kernel/kustomization.yaml similarity index 100% rename from apps/kernel-nse/kustomization.yaml rename to apps/nse-kernel/kustomization.yaml diff --git a/apps/kernel-nse/nse.yaml b/apps/nse-kernel/nse.yaml similarity index 100% rename from apps/kernel-nse/nse.yaml rename to apps/nse-kernel/nse.yaml diff --git a/apps/vfio-nse/kustomization.yaml b/apps/nse-vfio/kustomization.yaml similarity index 100% rename from apps/vfio-nse/kustomization.yaml rename to apps/nse-vfio/kustomization.yaml diff --git a/apps/vfio-nse/nse-configmap.yaml b/apps/nse-vfio/nse-configmap.yaml similarity index 100% rename from apps/vfio-nse/nse-configmap.yaml rename to apps/nse-vfio/nse-configmap.yaml diff --git a/apps/vfio-nse/nse.yaml b/apps/nse-vfio/nse.yaml similarity index 100% rename from apps/vfio-nse/nse.yaml rename to apps/nse-vfio/nse.yaml diff --git a/examples/sriov/kustomization.yaml b/examples/sriov/kustomization.yaml index a8a1a2be33f2..8f13d70e0ec6 100644 --- a/examples/sriov/kustomization.yaml +++ b/examples/sriov/kustomization.yaml @@ -6,5 +6,5 @@ namespace: nsm-system bases: - ../../apps/nsmgr -- ../../apps/sriov-forwarder +- ../../apps/forwarder-sriov - ../../apps/registry-memory diff --git a/examples/use-cases/LocalConnection/README.md b/examples/use-cases/LocalConnection/README.md index 8940f74e90cf..04f679da62cc 100644 --- a/examples/use-cases/LocalConnection/README.md +++ b/examples/use-cases/LocalConnection/README.md @@ -36,8 +36,8 @@ kind: Kustomization namespace: ${NAMESPACE} bases: -- ../../../apps/kernel-nsc -- ../../../apps/kernel-nse +- ../../../apps/nsc-kernel +- ../../../apps/nse-kernel patchesStrategicMerge: - patch-nsc.yaml @@ -80,6 +80,8 @@ spec: containers: - name: nse env: + - name: NSE_CIDR_PREFIX + value: 172.16.1.100/31 - name: NSM_NETWORK_SERVICES value: kernel://icmp-responder/nsm-1 nodeSelector: @@ -100,9 +102,23 @@ kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc -n ${NAMESPACE} kubectl wait --for=condition=ready --timeout=1m pod -l app=nse -n ${NAMESPACE} ``` -Check connection result: +Find nsc and nse pods by labesl: ```bash -kubectl logs -l app=nsc -n ${NAMESPACE} | grep "All client init operations are done." +NSC=$(kubectl get pods -l app=nsc -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') +``` + +```bash +NSE=$(kubectl get pods -l app=nse -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') +``` + +Ping from nsc to nse: +```bash +kubectl exec ${NSC} -n ${NAMESPACE} -- ping -c 4 172.16.1.100 +``` + +Ping from nse to nsc: +```bash +kubectl exec ${NSE} -n ${NAMESPACE} -- ping -c 4 172.16.1.101 ``` ## Cleanup diff --git a/examples/use-cases/LocalConnection/kustomization.yaml b/examples/use-cases/LocalConnection/kustomization.yaml new file mode 100644 index 000000000000..7dbc27c520f8 --- /dev/null +++ b/examples/use-cases/LocalConnection/kustomization.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: ns-m5szc + +bases: +- ../../../apps/nsc-kernel +- ../../../apps/nse-kernel + +patchesStrategicMerge: +- patch-nsc.yaml +- patch-nse.yaml diff --git a/examples/use-cases/LocalConnection/patch-nsc.yaml b/examples/use-cases/LocalConnection/patch-nsc.yaml new file mode 100644 index 000000000000..325bace00b76 --- /dev/null +++ b/examples/use-cases/LocalConnection/patch-nsc.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nsc +spec: + template: + spec: + containers: + - name: nsc + env: + - name: NSM_NETWORK_SERVICES + value: kernel://icmp-responder/nsm-1 + nodeSelector: + kubernetes.io/hostname: kind-worker diff --git a/examples/use-cases/LocalConnection/patch-nse.yaml b/examples/use-cases/LocalConnection/patch-nse.yaml new file mode 100644 index 000000000000..93c36ed7390f --- /dev/null +++ b/examples/use-cases/LocalConnection/patch-nse.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nse +spec: + template: + spec: + containers: + - name: nse + env: + - name: NSE_CIDR_PREFIX + value: 172.16.1.100/31 + - name: NSM_NETWORK_SERVICES + value: kernel://icmp-responder/nsm-1 + nodeSelector: + kubernetes.io/hostname: kind-worker diff --git a/examples/use-cases/RemoteConnection/README.md b/examples/use-cases/RemoteConnection/README.md index 4a4819b9dccf..0cdf1663fb57 100644 --- a/examples/use-cases/RemoteConnection/README.md +++ b/examples/use-cases/RemoteConnection/README.md @@ -35,8 +35,8 @@ kind: Kustomization namespace: ${NAMESPACE} bases: -- ../../../apps/kernel-nsc -- ../../../apps/kernel-nse +- ../../../apps/nsc-kernel +- ../../../apps/nse-kernel patchesStrategicMerge: - patch-nsc.yaml @@ -107,6 +107,25 @@ Check connection result: kubectl logs -l app=nsc -n ${NAMESPACE} | grep "All client init operations are done." ``` +Find nsc and nse pods by labels: +```bash +NSC=$(kubectl get pods -l app=nsc -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') +``` + +```bash +NSE=$(kubectl get pods -l app=nse -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') +``` + +Ping from nsc to nse: +```bash +kubectl exec ${NSC} -n ${NAMESPACE} -- ping -c 4 172.16.1.100 +``` + +Ping from nse to nsc: +```bash +kubectl exec ${NSE} -n ${NAMESPACE} -- ping -c 4 172.16.1.101 +``` + ## Cleanup Delete ns: diff --git a/examples/use-cases/SRIOVKernelConnection/README.md b/examples/use-cases/SRIOVKernelConnection/README.md index 1c20d2b9b662..2c9c91363fdc 100644 --- a/examples/use-cases/SRIOVKernelConnection/README.md +++ b/examples/use-cases/SRIOVKernelConnection/README.md @@ -30,9 +30,9 @@ kind: Kustomization namespace: ${NAMESPACE} bases: -- ../../../apps/kernel-nsc -- ../../../apps/kernel-nse -- ../../../apps/kernel-ponger +- ../../../apps/nsc-kernel +- ../../../apps/nse-kernel +- ../../../apps/nsc-kernel-ponger patchesStrategicMerge: diff --git a/examples/use-cases/VFIOConnection/README.md b/examples/use-cases/VFIOConnection/README.md index 3fd491793e78..519b7b9ae0f3 100644 --- a/examples/use-cases/VFIOConnection/README.md +++ b/examples/use-cases/VFIOConnection/README.md @@ -31,7 +31,7 @@ namespace: ${NAMESPACE} bases: - ../../../apps/vfio-nsc -- ../../../apps/vfio-nse +- ../../../apps/nse-vfio EOF ``` From 0a66f9387e5e767b729f32bc5da84fa2822f4626 Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Tue, 26 Jan 2021 19:05:48 +0700 Subject: [PATCH 3/4] self code review Signed-off-by: Denis Tingaikin --- apps/nsc-kernel/nsc.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/nsc-kernel/nsc.yaml b/apps/nsc-kernel/nsc.yaml index 0815da1db600..57cfa96edbbd 100644 --- a/apps/nsc-kernel/nsc.yaml +++ b/apps/nsc-kernel/nsc.yaml @@ -21,8 +21,6 @@ spec: env: - name: SPIFFE_ENDPOINT_SOCKET value: unix:///run/spire/sockets/agent.sock - - name: NSM_REQUEST_TIMEOUT - value: 5m - name: NSM_NAME valueFrom: fieldRef: From f949c894f11b417bd5fa71387bfec86cc8e25d28 Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Tue, 26 Jan 2021 19:11:40 +0700 Subject: [PATCH 4/4] remove generated stuff Signed-off-by: Denis Tingaikin --- .../LocalConnection/kustomization.yaml | 13 ------------- .../use-cases/LocalConnection/patch-nsc.yaml | 15 --------------- .../use-cases/LocalConnection/patch-nse.yaml | 17 ----------------- 3 files changed, 45 deletions(-) delete mode 100644 examples/use-cases/LocalConnection/kustomization.yaml delete mode 100644 examples/use-cases/LocalConnection/patch-nsc.yaml delete mode 100644 examples/use-cases/LocalConnection/patch-nse.yaml diff --git a/examples/use-cases/LocalConnection/kustomization.yaml b/examples/use-cases/LocalConnection/kustomization.yaml deleted file mode 100644 index 7dbc27c520f8..000000000000 --- a/examples/use-cases/LocalConnection/kustomization.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -namespace: ns-m5szc - -bases: -- ../../../apps/nsc-kernel -- ../../../apps/nse-kernel - -patchesStrategicMerge: -- patch-nsc.yaml -- patch-nse.yaml diff --git a/examples/use-cases/LocalConnection/patch-nsc.yaml b/examples/use-cases/LocalConnection/patch-nsc.yaml deleted file mode 100644 index 325bace00b76..000000000000 --- a/examples/use-cases/LocalConnection/patch-nsc.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nsc -spec: - template: - spec: - containers: - - name: nsc - env: - - name: NSM_NETWORK_SERVICES - value: kernel://icmp-responder/nsm-1 - nodeSelector: - kubernetes.io/hostname: kind-worker diff --git a/examples/use-cases/LocalConnection/patch-nse.yaml b/examples/use-cases/LocalConnection/patch-nse.yaml deleted file mode 100644 index 93c36ed7390f..000000000000 --- a/examples/use-cases/LocalConnection/patch-nse.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nse -spec: - template: - spec: - containers: - - name: nse - env: - - name: NSE_CIDR_PREFIX - value: 172.16.1.100/31 - - name: NSM_NETWORK_SERVICES - value: kernel://icmp-responder/nsm-1 - nodeSelector: - kubernetes.io/hostname: kind-worker