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

Added usage of annotations for kernel clients #3663

Merged
merged 2 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
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:96ccc8a
- name: NSM_INIT_CONTAINER_IMAGES
value: ghcr.io/networkservicemesh/ci/cmd-nsc-init:3dc57ef
- 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=5012a8aafd293534e2a9d98903f6d339ef44ceab
```

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/5012a8aafd293534e2a9d98903f6d339ef44ceab/examples/features/namespace.yaml)[0])
Expand Down
40 changes: 21 additions & 19 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=5012a8aafd293534e2a9d98903f6d339ef44ceab
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-kernel?ref=5012a8aafd293534e2a9d98903f6d339ef44ceab

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:3.15.0
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=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
41 changes: 21 additions & 20 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=5012a8aafd293534e2a9d98903f6d339ef44ceab
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-kernel?ref=5012a8aafd293534e2a9d98903f6d339ef44ceab

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:3.15.0
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=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
41 changes: 22 additions & 19 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=5012a8aafd293534e2a9d98903f6d339ef44ceab
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-memif?ref=5012a8aafd293534e2a9d98903f6d339ef44ceab

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:3.15.0
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=alpine -n ${NAMESPACE}
```
```bash
kubectl wait --for=condition=ready --timeout=1m pod -l app=nse-memif -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/5012a8aafd293534e2a9d98903f6d339ef44ceab/examples/features/nse-composition/passthrough-2.yaml
- https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/5012a8aafd293534e2a9d98903f6d339ef44ceab/examples/features/nse-composition/passthrough-3.yaml
- https://raw.githubusercontent.com/networkservicemesh/deployments-k8s/5012a8aafd293534e2a9d98903f6d339ef44ceab/examples/features/nse-composition/nse-composition-ns.yaml
- client.yaml
bases:
- https://github.com/networkservicemesh/deployments-k8s/apps/nsc-kernel?ref=5012a8aafd293534e2a9d98903f6d339ef44ceab
- https://github.com/networkservicemesh/deployments-k8s/apps/nse-kernel?ref=5012a8aafd293534e2a9d98903f6d339ef44ceab
- https://github.com/networkservicemesh/deployments-k8s/examples/features/nse-composition/nse-firewall?ref=5012a8aafd293534e2a9d98903f6d339ef44ceab

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:3.15.0
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/5012a8aafd293534e2a9d98903f6d339ef44ceab/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=5012a8aafd293534e2a9d98903f6d339ef44ceab
```

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