Skip to content

Commit

Permalink
added annotations for kernel clients
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>
  • Loading branch information
Mixaster995 committed Nov 22, 2021
1 parent ad579f4 commit cf9c1b5
Show file tree
Hide file tree
Showing 16 changed files with 243 additions and 216 deletions.
2 changes: 2 additions & 0 deletions apps/admission-webhook-k8s/admission-webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ spec:
value: ghcr.io/networkservicemesh/ci/cmd-nsc:15b8e5e
- name: NSM_INIT_CONTAINER_IMAGES
value: ghcr.io/networkservicemesh/ci/cmd-nsc-init:f28a231
- name: NSM_LABELS
value: spiffe.io/spiffe-id:true
7 changes: 7 additions & 0 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ kubectl create ns nsm-system
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/basic?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
```

3. Wait for admission-webhook-k8s:

```bash
WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system
```

## Cleanup

To free resouces follow the next command:
Expand Down
6 changes: 0 additions & 6 deletions examples/features/dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ Make sure that you have completed steps from [features](../)

## Run

Note: Admission webhook is required and should be started at this moment.
```bash
WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system
```

1. Create test namespace:
```bash
NAMESPACE=($(kubectl create -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/ff69adca767822ce0c9fb55aba74eb3bad3a0e37/examples/features/namespace.yaml)[0])
Expand Down
42 changes: 22 additions & 20 deletions examples/features/ipv6/Kernel2Kernel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,39 @@ kind: Kustomization
namespace: ${NAMESPACE}
resources:
- client.yaml
bases:
- https://github.com/networkservicemesh/deployments-k8s/apps/nsc-kernel?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-kernel?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
patchesStrategicMerge:
- patch-nsc.yaml
- patch-nse.yaml
EOF
```

Create NSC patch:
Create Client:
```bash
cat > patch-nsc.yaml <<EOF
cat > client.yaml <<EOF
---
apiVersion: apps/v1
kind: Deployment
apiVersion: v1
kind: Pod
metadata:
name: nsc-kernel
name: alpine
labels:
app: alpine
annotations:
networkservicemesh.io: kernel://icmp-responder/nsm-1
spec:
template:
spec:
containers:
- name: nsc
env:
- name: NSM_NETWORK_SERVICES
value: kernel://icmp-responder/nsm-1
nodeSelector:
kubernetes.io/hostname: ${NODE}
containers:
- name: alpine
image: alpine
imagePullPolicy: IfNotPresent
stdin: true
tty: true
nodeSelector:
kubernetes.io/hostname: ${NODE}
EOF
```

Create NSE patch:
```bash
cat > patch-nse.yaml <<EOF
Expand Down Expand Up @@ -86,15 +88,15 @@ kubectl apply -k .

Wait for applications ready:
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ${NAMESPACE}
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ${NAMESPACE}
```
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ${NAMESPACE}
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ${NAMESPACE}
```

Find NSC and NSE pods by labels:
```bash
NSC=$(kubectl get pods -l app=nsc-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
NSC=$(kubectl get pods -l app=alpine -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
```
```bash
NSE=$(kubectl get pods -l app=nse-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
Expand Down
43 changes: 22 additions & 21 deletions examples/features/ipv6/Kernel2Wireguard2Kernel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,38 @@ kind: Kustomization
namespace: ${NAMESPACE}
resources:
- client.yaml
bases:
- https://github.com/networkservicemesh/deployments-k8s/apps/nsc-kernel?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-kernel?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
patchesStrategicMerge:
- patch-nsc.yaml
- patch-nse.yaml
EOF
```

Create NSC patch:
Create Client:
```bash
cat > patch-nsc.yaml <<EOF
cat > client.yaml <<EOF
---
apiVersion: apps/v1
kind: Deployment
apiVersion: v1
kind: Pod
metadata:
name: nsc-kernel
name: alpine
labels:
app: alpine
annotations:
networkservicemesh.io: kernel://icmp-responder-ip/nsm-1
spec:
template:
spec:
containers:
- name: nsc
env:
- name: NSM_NETWORK_SERVICES
value: kernel://icmp-responder-ip/nsm-1
nodeSelector:
kubernetes.io/hostname: ${NODES[0]}
containers:
- name: alpine
image: alpine
imagePullPolicy: IfNotPresent
stdin: true
tty: true
nodeSelector:
kubernetes.io/hostname: ${NODES[0]}
EOF

```
Create NSE patch:
```bash
Expand Down Expand Up @@ -91,15 +92,15 @@ kubectl apply -k .

Wait for applications ready:
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ${NAMESPACE}
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ${NAMESPACE}
```
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ${NAMESPACE}
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ${NAMESPACE}
```

Find NSC and NSE pods by labels:
```bash
NSC=$(kubectl get pods -l app=nsc-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
NSC=$(kubectl get pods -l app=alpine -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
```
```bash
NSE=$(kubectl get pods -l app=nse-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
Expand Down
43 changes: 23 additions & 20 deletions examples/features/ipv6/Kernel2Wireguard2Memif/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,40 @@ kind: Kustomization
namespace: ${NAMESPACE}
resources:
- client.yaml
bases:
- https://github.com/networkservicemesh/deployments-k8s/apps/nsc-kernel?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-memif?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
patchesStrategicMerge:
- patch-nsc.yaml
- patch-nse.yaml
EOF
```

Create NSC patch:
Create Client:
```bash
cat > patch-nsc.yaml <<EOF
cat > client.yaml <<EOF
---
apiVersion: apps/v1
kind: Deployment
apiVersion: v1
kind: Pod
metadata:
name: nsc-kernel
name: alpine
labels:
app: alpine
annotations:
networkservicemesh.io: kernel://icmp-responder-ip/nsm-1
spec:
template:
spec:
containers:
- name: nsc
env:
- name: NSM_NETWORK_SERVICES
value: kernel://icmp-responder-ip/nsm-1
nodeSelector:
kubernetes.io/hostname: ${NODES[0]}
containers:
- name: alpine
image: alpine
imagePullPolicy: IfNotPresent
stdin: true
tty: true
nodeSelector:
kubernetes.io/hostname: ${NODES[0]}
EOF
```

Create NSE patch:
```bash
cat > patch-nse.yaml <<EOF
Expand Down Expand Up @@ -91,15 +94,15 @@ kubectl apply -k .

Wait for applications ready:
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ${NAMESPACE}
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ${NAMESPACE}
```
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -n ${NAMESPACE}
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ${NAMESPACE}
```

Find NSC and NSE pods by labels:
```bash
NSC=$(kubectl get pods -l app=nsc-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
NSC=$(kubectl get pods -l app=alpine -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
```
```bash
NSE=$(kubectl get pods -l app=nse-memif -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
Expand Down
39 changes: 21 additions & 18 deletions examples/features/nse-composition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,41 @@ resources:
- https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/ff69adca767822ce0c9fb55aba74eb3bad3a0e37/examples/features/nse-composition/passthrough-2.yaml
- https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/ff69adca767822ce0c9fb55aba74eb3bad3a0e37/examples/features/nse-composition/passthrough-3.yaml
- https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/ff69adca767822ce0c9fb55aba74eb3bad3a0e37/examples/features/nse-composition/nse-composition-ns.yaml
- client.yaml
bases:
- https://github.com/networkservicemesh/deployments-k8s/apps/nsc-kernel?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-kernel?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
- https://github.com/networkservicemesh/deployments-k8s/examples/features/nse-composition/nse-firewall?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
patchesStrategicMerge:
- patch-nsc.yaml
- patch-nse.yaml
EOF
```

Create NSC patch:
Create Client:
```bash
cat > patch-nsc.yaml <<EOF
cat > client.yaml <<EOF
---
apiVersion: apps/v1
kind: Deployment
apiVersion: v1
kind: Pod
metadata:
name: nsc-kernel
name: alpine
labels:
app: alpine
annotations:
networkservicemesh.io: kernel://nse-composition/nsm-1
spec:
template:
spec:
containers:
- name: nsc
env:
- name: NSM_NETWORK_SERVICES
value: kernel://nse-composition/nsm-1
nodeSelector:
kubernetes.io/hostname: ${NODE}
containers:
- name: alpine
image: alpine
imagePullPolicy: IfNotPresent
stdin: true
tty: true
nodeSelector:
kubernetes.io/hostname: ${NODE}
EOF
```


Create NSE patch:
```bash
cat > patch-nse.yaml <<EOF
Expand Down Expand Up @@ -104,15 +107,15 @@ kubectl apply -k .

Wait for applications ready:
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nsc-kernel -n ${NAMESPACE}
kubectl wait --for=condition=ready --timeout=1m pod -l app=alpine -n ${NAMESPACE}
```
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-kernel -n ${NAMESPACE}
```

Find nsc and nse pods by labels:
```bash
NSC=$(kubectl get pods -l app=nsc-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
NSC=$(kubectl get pods -l app=alpine -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
```
```bash
NSE=$(kubectl get pods -l app=nse-kernel -n ${NAMESPACE} --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
Expand Down
7 changes: 0 additions & 7 deletions examples/features/webhook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ Make sure that you have completed steps from [features](../)

## Run

Note: Admission webhook is required and should be started at this moment.
```bash
WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system
```

1. Create test namespace:
```bash
NAMESPACE=($(kubectl create -f https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/ff69adca767822ce0c9fb55aba74eb3bad3a0e37/examples/features/namespace.yaml)[0])
Expand All @@ -39,7 +33,6 @@ metadata:
networkservicemesh.io: kernel://my-postgres-service/nsm-1
labels:
app: postgres-cl
"spiffe.io/spiffe-id": "true"
spec:
containers:
- name: postgres-cl
Expand Down
11 changes: 9 additions & 2 deletions examples/memory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@ Memory example contains setup and tear down logic with default NSM infrastructur

## Run

Create ns for deployments:
1. Create ns for deployments:
```bash
kubectl create ns nsm-system
```

Apply NSM resources for basic tests:
2. Apply NSM resources for basic tests:

```bash
kubectl apply -k https://github.com/networkservicemesh/deployments-k8s/examples/memory?ref=ff69adca767822ce0c9fb55aba74eb3bad3a0e37
```

3. Wait for admission-webhook-k8s:

```bash
WH=$(kubectl get pods -l app=admission-webhook-k8s -n nsm-system --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
kubectl wait --for=condition=ready --timeout=1m pod ${WH} -n nsm-system
```

## Cleanup

```bash
Expand Down
1 change: 1 addition & 0 deletions examples/memory/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ bases:
- ../../apps/nsmgr
- ../../apps/forwarder-vpp
- ../../apps/registry-memory
- ../../apps/admission-webhook-k8s
Loading

0 comments on commit cf9c1b5

Please sign in to comment.