-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate memory and basic examples (#7224)
* separate memory and basic examples Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> * revert some changes Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> * update refs in memory suite Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
- Loading branch information
1 parent
6143c84
commit 9abd097
Showing
14 changed files
with
346 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Test kernel to kernel connection | ||
|
||
|
||
This example shows that NSC and NSE on the one node can find each other. | ||
|
||
NSC and NSE are using the `kernel` mechanism to connect to its local forwarder. | ||
|
||
|
||
Diagram: | ||
|
||
![NSM kernel2kernel Diagram](./diagram.png "NSM Kernel2Kernel Scheme") | ||
|
||
|
||
## Requires | ||
|
||
Make sure that you have completed steps from [memory](../) setup. | ||
|
||
## Run | ||
|
||
Create test namespace: | ||
```bash | ||
kubectl create ns ns-kernel2kernel | ||
``` | ||
|
||
Deploy NSC and NSE: | ||
```bash | ||
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/memory/Kernel2Kernel?ref=ac3b5171878fb1dc787c563bf48735b6f2fdefcc | ||
``` | ||
|
||
Wait for applications ready: | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2kernel | ||
``` | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2kernel | ||
``` | ||
|
||
Find nsc and nse pods by labels: | ||
```bash | ||
NSC=$(kubectl get pods -l app=alpine -n ns-kernel2kernel --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
```bash | ||
NSE=$(kubectl get pods -l app=nse-kernel -n ns-kernel2kernel --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
|
||
Ping from NSC to NSE: | ||
```bash | ||
kubectl exec ${NSC} -n ns-kernel2kernel -- ping -c 4 172.16.1.100 | ||
``` | ||
|
||
Ping from NSE to NSC: | ||
```bash | ||
kubectl exec ${NSE} -n ns-kernel2kernel -- ping -c 4 172.16.1.101 | ||
``` | ||
|
||
## Cleanup | ||
|
||
Delete ns: | ||
```bash | ||
kubectl delete ns ns-kernel2kernel | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: alpine | ||
labels: | ||
app: alpine | ||
annotations: | ||
networkservicemesh.io: kernel://kernel2kernel/nsm-1 | ||
spec: | ||
containers: | ||
- name: alpine | ||
image: alpine:3.15.0 | ||
imagePullPolicy: IfNotPresent | ||
stdin: true | ||
tty: true | ||
affinity: | ||
podAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- topologyKey: kubernetes.io/hostname | ||
labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- nse-kernel |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: ns-kernel2kernel | ||
|
||
bases: | ||
- ../../../apps/nse-kernel | ||
|
||
resources: | ||
- client.yaml | ||
|
||
patchesStrategicMerge: | ||
- patch-nse.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nse-kernel | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: nse | ||
env: | ||
- name: NSM_CIDR_PREFIX | ||
value: 172.16.1.100/31 | ||
- name: NSM_SERVICE_NAMES | ||
value: "kernel2kernel" | ||
- name: NSM_REGISTER_SERVICE | ||
value: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Test kernel to vxlan to kernel connection | ||
|
||
This example shows that NSC and NSE on the different nodes could find and work with each other. | ||
|
||
NSC and NSE are using the `kernel` mechanism to connect to its local forwarder. | ||
Forwarders are using the `vxlan` mechanism to connect with each other. | ||
|
||
## Requires | ||
|
||
Make sure that you have completed steps from [memory](../) setup. | ||
|
||
## Run | ||
|
||
Create test namespace: | ||
```bash | ||
kubectl create ns ns-kernel2vxlan2kernel | ||
``` | ||
|
||
Deploy NSC and NSE: | ||
```bash | ||
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/memory/Kernel2Vxlan2Kernel?ref=ac3b5171878fb1dc787c563bf48735b6f2fdefcc | ||
``` | ||
|
||
Wait for applications ready: | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ns-kernel2vxlan2kernel | ||
``` | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-kernel2vxlan2kernel | ||
``` | ||
|
||
Find NSC and NSE pods by labels: | ||
```bash | ||
NSC=$(kubectl get pods -l app=alpine -n ns-kernel2vxlan2kernel --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
```bash | ||
NSE=$(kubectl get pods -l app=nse-kernel -n ns-kernel2vxlan2kernel --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
|
||
Ping from NSC to NSE: | ||
```bash | ||
kubectl exec ${NSC} -n ns-kernel2vxlan2kernel -- ping -c 4 172.16.1.100 | ||
``` | ||
|
||
Ping from NSE to NSC: | ||
```bash | ||
kubectl exec ${NSE} -n ns-kernel2vxlan2kernel -- ping -c 4 172.16.1.101 | ||
``` | ||
|
||
## Cleanup | ||
|
||
Delete ns: | ||
```bash | ||
kubectl delete ns ns-kernel2vxlan2kernel | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: alpine | ||
labels: | ||
app: alpine | ||
annotations: | ||
networkservicemesh.io: kernel://kernel2vxlan2kernel/nsm-1 | ||
spec: | ||
containers: | ||
- name: alpine | ||
image: alpine:3.15.0 | ||
imagePullPolicy: IfNotPresent | ||
stdin: true | ||
tty: true | ||
affinity: | ||
podAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- topologyKey: kubernetes.io/hostname | ||
labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- nse-kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: ns-kernel2vxlan2kernel | ||
|
||
bases: | ||
- ../../../apps/nse-kernel | ||
|
||
resources: | ||
- client.yaml | ||
|
||
patchesStrategicMerge: | ||
- patch-nse.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nse-kernel | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: nse | ||
env: | ||
- name: NSM_CIDR_PREFIX | ||
value: 172.16.1.100/31 | ||
- name: NSM_SERVICE_NAMES | ||
value: "kernel2vxlan2kernel" | ||
- name: NSM_REGISTER_SERVICE | ||
value: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Test memif to memif connection | ||
|
||
|
||
This example shows that NSC and NSE on the one node can find each other. | ||
|
||
NSC and NSE are using the `memif` mechanism to connect to its local forwarder. | ||
|
||
## Requires | ||
|
||
Make sure that you have completed steps from [memory](../) setup. | ||
|
||
## Run | ||
|
||
Create test namespace: | ||
```bash | ||
kubectl create ns ns-memif2memif | ||
``` | ||
|
||
Deploy NSC and NSE: | ||
```bash | ||
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/memory/Memif2Memif?ref=ac3b5171878fb1dc787c563bf48735b6f2fdefcc | ||
``` | ||
|
||
Wait for applications ready: | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-memif -n ns-memif2memif | ||
``` | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ns-memif2memif | ||
``` | ||
|
||
Find NSC and NSE pods by labels: | ||
```bash | ||
NSC=$(kubectl get pods -l app=nsc-memif -n ns-memif2memif --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
```bash | ||
NSE=$(kubectl get pods -l app=nse-memif -n ns-memif2memif --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') | ||
``` | ||
|
||
Check connectivity: | ||
```bash | ||
result=$(kubectl exec "${NSC}" -n "ns-memif2memif" -- vppctl ping 172.16.1.100 repeat 4) | ||
echo ${result} | ||
! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)" | ||
``` | ||
|
||
Check connectivity: | ||
```bash | ||
result=$(kubectl exec "${NSE}" -n "ns-memif2memif" -- vppctl ping 172.16.1.101 repeat 4) | ||
echo ${result} | ||
! echo ${result} | grep -E -q "(100% packet loss)|(0 sent)|(no egress interface)" | ||
``` | ||
|
||
## Cleanup | ||
|
||
Delete ns: | ||
```bash | ||
kubectl delete ns ns-memif2memif | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: ns-memif2memif | ||
|
||
bases: | ||
- ../../../apps/nsc-memif | ||
- ../../../apps/nse-memif | ||
|
||
patchesStrategicMerge: | ||
- patch-nsc.yaml | ||
- patch-nse.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nsc-memif | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: nsc | ||
env: | ||
- name: NSM_NETWORK_SERVICES | ||
value: memif://memif2memif/nsm-1 | ||
affinity: | ||
podAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- topologyKey: kubernetes.io/hostname | ||
labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- nse-memif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nse-memif | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: nse | ||
env: | ||
- name: NSM_CIDR_PREFIX | ||
value: 172.16.1.100/31 | ||
- name: NSM_SERVICE_NAMES | ||
value: "memif2memif" | ||
- name: NSM_REGISTER_SERVICE | ||
value: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters