Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NSE unregister scenario with scaled registry-k8s #10222

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ To run any feature example follow steps for [Basic NSM setup](../basic)
- [vL3 Load Balancer](./vl3-lb)
- [Inject clients in namespace via NSM annotation](./annotated-namespace)
- [NSC connects to multiple services](./multiple-services)
- [Scaled Registry K8s](./scaled-registry)
62 changes: 62 additions & 0 deletions examples/features/scaled-registry/README.md
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
```
13 changes: 13 additions & 0 deletions examples/features/scaled-registry/kustomization.yaml
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
7 changes: 7 additions & 0 deletions examples/features/scaled-registry/netsvc.yaml
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
5 changes: 5 additions & 0 deletions examples/features/scaled-registry/ns-scaled-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: ns-scaled-registry
19 changes: 19 additions & 0 deletions examples/features/scaled-registry/patch-nse.yaml
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"
1 change: 0 additions & 1 deletion examples/use-cases/Kernel2Kernel/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace: ns-kernel2kernel

resources:
- ns-kernel2kernel.yaml
- client.yaml
NikitaSkrynnik marked this conversation as resolved.
Show resolved Hide resolved
- netsvc.yaml
- ../../../apps/nse-kernel

Expand Down
Loading