-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NSE unregister scenario with scaled registry-k8s (#10222)
* add NSE unregister scenario with scaled registry-k8s Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> * cleanup Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> * cleanup Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com> --------- Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
- Loading branch information
1 parent
d502240
commit 18010a0
Showing
6 changed files
with
107 additions
and
0 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
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,62 @@ | ||
# Test scaled registry-k8s | ||
|
||
This example shows that registry-k8s can be easly scaled. NSEs can Register and Unregister themselves in any of | ||
the registries. | ||
|
||
## Requires | ||
|
||
Make sure that you have completed steps from [basic](../../basic) setup. | ||
|
||
## Run | ||
|
||
Deploy NSE: | ||
```bash | ||
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/features/scaled-registry?ref=5bb6afc5f5199a63e470b3552803d06f6b70cc61 | ||
``` | ||
|
||
Wait for NSE to be ready: | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ns-scaled-registry | ||
``` | ||
|
||
Check registered NSE in `etcd` | ||
```bash | ||
kubectl get nses -A | grep nse-kernel | ||
``` | ||
|
||
Delete current instance of registry-k8s | ||
```bash | ||
kubectl scale --replicas=0 deployments/registry-k8s -n nsm-system | ||
``` | ||
|
||
Check registered NSE in `etcd` after registry-k8s instance deletion | ||
```bash | ||
kubectl get nses -A | grep nse-kernel | ||
``` | ||
|
||
Deploy two new instances of registry-k8s | ||
```bash | ||
kubectl scale --replicas=2 deployments/registry-k8s -n nsm-system | ||
``` | ||
|
||
Wait for the new registry-k8s instances to be ready: | ||
```bash | ||
kubectl wait --for=condition=ready --timeout=1m pod -l app=registry -n nsm-system | ||
``` | ||
|
||
Delete NSE (it unregisters itself on deletion) | ||
```bash | ||
kubectl scale --replicas=0 deployments/nse-kernel -n ns-scaled-registry | ||
``` | ||
|
||
Check there is no any NSEs in `etcd` after NSE unregisters itself through the new registries | ||
```bash | ||
kubectl get nses -A | grep -v nse-kernel | ||
``` | ||
|
||
## Cleanup | ||
|
||
Delete ns: | ||
```bash | ||
kubectl delete ns ns-scaled-registry | ||
``` |
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-scaled-registry | ||
|
||
resources: | ||
- ns-scaled-registry.yaml | ||
- netsvc.yaml | ||
- ../../../apps/nse-kernel | ||
|
||
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,7 @@ | ||
--- | ||
apiVersion: networkservicemesh.io/v1 | ||
kind: NetworkService | ||
metadata: | ||
name: scaled-registry | ||
spec: | ||
payload: ETHERNET |
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,5 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: ns-scaled-registry |
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,19 @@ | ||
--- | ||
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: "scaled-registry" | ||
- name: NSM_REGISTER_SERVICE | ||
value: "false" | ||
- name: NSM_UNREGISTER_ITSELF | ||
value: "true" |