Skip to content

Commit 35fb5eb

Browse files
committed
update doc
1 parent 3995183 commit 35fb5eb

File tree

2 files changed

+75
-26
lines changed

2 files changed

+75
-26
lines changed

README.md

Lines changed: 63 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ All the tests are read from an YAML file or a directory (step **1**) and the res
231231

232232
## Development
233233

234-
- You will need Go version 1.20.x or higher. Download the latest version of [just](https://github.com/casey/just/releases). To build the project you can use `just build`. The resulting binary will be in `cmd/netassert/cli/netassert`. To run `unit` tests you can use `just test`. There is a separate [README.md](./e2e/README.md) that details `end-to-end` testing.
234+
- You will need Go version 1.25.x or higher. Download the latest version of [just](https://github.com/casey/just/releases). To build the project you can use `just build`. The resulting binary will be in `cmd/netassert/cli/netassert`. To run `unit` tests you can use `just test`. There is a separate [README.md](./e2e/README.md) that details `end-to-end` testing.
235235

236236
## Quick testing
237237

@@ -241,64 +241,102 @@ All the tests are read from an YAML file or a directory (step **1**) and the res
241241

242242
- If you want to quickly test `NetAssert`, you can make use of the sample test(s) and manifests provided
243243

244-
- You will also need a working kubernetes cluster with ephemeral/debug container support, you can spin one quickly using the `justfile` included in the repo
244+
- You will also need a working kubernetes cluster with ephemeral/debug container support and a CNI that supports Network Policies, you can spin one quickly using the `justfile` included in the repo
245245

246246
```bash
247247
❯ just kind-down ; just kind-up
248+
❯ just calico-apply
248249
```
249250

250-
- In order to use the sample tests, you need to create kubernetes resources:
251+
- wait for all the nodes to become ready
252+
```bash
253+
❯ kubectl get nodes
254+
```
255+
256+
- In order to use the sample tests, you need to create network policies and kubernetes resources:
251257

252258
```bash
253259
❯ just k8s-apply
254-
255-
kubectl apply -f ./kubernetes/manifests
260+
kubectl apply -f ./e2e/manifests/workload.yaml
256261
namespace/fluentd created
257262
daemonset.apps/fluentd created
258263
namespace/echoserver created
259264
namespace/busybox created
260265
deployment.apps/echoserver created
261266
deployment.apps/busybox created
267+
namespace/pod1 created
268+
namespace/pod2 created
269+
pod/pod2 created
270+
pod/pod1 created
262271
namespace/web created
263272
statefulset.apps/web created
264273
```
265274

275+
```bash
276+
❯ just netpol-apply
277+
```
278+
279+
- Wait for the workload to become ready
280+
```bash
281+
❯ kubectl get pods -A
282+
```
266283
- Run the netassert binary pointing it to the test cases, one of the test cases will fail and this is by design:
267284

268285
```bash
269-
## if you have Go installed, you can build the binary using the the following command
270286
❯ just build ## from the root of the project
271-
go build -ldflags="-X 'main.appName=NetAssert' -X 'main.version=2.0.0-dev'" -o bin/netassert cmd/netassert/cli/*.go
272287

273-
❯ bin/netassert run --input-file ./sample-tests/test-cases/test-cases.yaml
288+
❯ bin/netassert run --input-file ./e2e/manifests/test-cases.yaml
274289

275290
❯ cat results.tap
276291
TAP version 14
277-
1..6
292+
1..9
278293
ok 1 - busybox-deploy-to-echoserver-deploy
279294
ok 2 - busybox-deploy-to-echoserver-deploy-2
280-
ok 3 - busybox-deploy-to-web-statefulset
281-
ok 4 - busybox-deploy-to-control-plane-dot-io
282-
ok 5 - test-from-pod1-to-pod2
283-
not ok 6 - busybox-deploy-to-fake-host
284-
---
285-
reason: ephemeral container netassertv2-client-7y16ra1f9 exit code for test busybox-deploy-to-fake-host
286-
is 1 instead of 0
295+
ok 3 - fluentd-deamonset-to-echoserver-deploy
296+
ok 4 - busybox-deploy-to-web-statefulset
297+
ok 5 - web-statefulset-to-busybox-deploy
298+
ok 6 - fluentd-daemonset-to-web-statefulset
299+
ok 7 - busybox-deploy-to-control-plane-dot-io
300+
ok 8 - test-from-pod1-to-pod2
301+
ok 9 - busybox-deploy-to-fake-host
302+
```
303+
304+
- To see the results when a check fails
305+
306+
```bash
307+
❯ just netpol-rm-apply
308+
❯ bin/netassert run --input-file ./e2e/manifests/test-cases.yaml
287309

310+
❯ cat results.tap
311+
TAP version 14
312+
1..9
313+
ok 1 - busybox-deploy-to-echoserver-deploy
314+
ok 2 - busybox-deploy-to-echoserver-deploy-2
315+
ok 3 - fluentd-deamonset-to-echoserver-deploy
316+
ok 4 - busybox-deploy-to-web-statefulset
317+
not ok 5 - web-statefulset-to-busybox-deploy
318+
---
319+
reason: ephemeral container netassertv2-client-aihlpxcys exit code for test web-statefulset-to-busybox-deploy
320+
is 0 instead of 1
321+
...
322+
ok 6 - fluentd-daemonset-to-web-statefulset
323+
ok 7 - busybox-deploy-to-control-plane-dot-io
324+
ok 8 - test-from-pod1-to-pod2
325+
ok 9 - busybox-deploy-to-fake-host
288326
```
289327

290328
## Compatibility
291329

292-
NetAssert is architected for compatibility with Kubernetes versions that offer support for ephemeral containers. We have thoroughly tested NetAssert with Kubernetes versions 1.25 to 1.28, confirming compatibility and performance stability.
330+
NetAssert is architected for compatibility with Kubernetes versions that offer support for ephemeral containers. We have thoroughly tested NetAssert with Kubernetes versions 1.25 to 1.35, confirming compatibility and performance stability.
293331

294332
For broader validation, our team has also executed comprehensive [end-to-end tests](./e2e/README.md) against various Kubernetes distributions and CNIs which is detailed below:
295333

296334
| Kubernetes Distribution | Supported Version | Container Network Interface (CNI) |
297335
|-------------------------|-------------------|------------------------------------
298-
| Amazon EKS | 1.25 and higher | AWS VPC CNI |
299-
| Amazon EKS | 1.25 and higher | Calico (Version 3.25 or later) |
300-
| Google GKE | 1.24 and higher | Google Cloud Platform VPC CNI |
301-
| Google GKE | 1.24 and higher | Google Cloud Dataplane V2 |
336+
| Amazon EKS | 1.34 and higher | AWS VPC CNI |
337+
| Amazon EKS | 1.34 and higher | Calico (Version 3.26 or later) |
338+
| Google GKE | 1.33 and higher | Google Cloud Platform VPC CNI |
339+
| Google GKE | 1.33 and higher | Google Cloud Dataplane V2 |
302340

303341
## Checking for ephemeral container support
304342

@@ -315,14 +353,14 @@ You can check for ephemeral container support using the following command:
315353
You can increase the logging level to `debug` by passing `--log-level` argument:
316354

317355
```bash
318-
❯ netassert run --input-file ./sample-tests/test-cases/test-cases.yaml --log-level=debug
356+
❯ netassert run --input-file ./e2e/manifests/test-cases.yaml --log-level=debug
319357
```
320358

321359
## RBAC Configuration
322360

323361
This tool can be run according to the Principle of Least Privilege (PoLP) by properly configuring the RBAC.
324362

325-
The list of required permissions can be found in the `netassert` ClusterRole `kubernetes/rbac/cluster-role.yaml`, which could be redefined as a Role for namespacing reasons if needed. This role can then be bound to a "principal" either through a RoleBinding or a ClusterRoleBinding, depending on whether the scope of the role is supposed to be namespaced or not. The ClusterRoleBinding `kubernetes/rbac/cluster-rolebinding.yaml` is an example where the user `netassert-user` is assigned the role `netassert` using a cluster-wide binding called `netassert`
363+
The list of required permissions can be found in the `netassert` ClusterRole `rbac/cluster-role.yaml`, which could be redefined as a Role for namespacing reasons if needed. This role can then be bound to a "principal" either through a RoleBinding or a ClusterRoleBinding, depending on whether the scope of the role is supposed to be namespaced or not. The ClusterRoleBinding `rbac/cluster-rolebinding.yaml` is an example where the user `netassert-user` is assigned the role `netassert` using a cluster-wide binding called `netassert`
326364

327365
## Limitations
328366

@@ -349,6 +387,6 @@ The list of required permissions can be found in the `netassert` ClusterRole `ku
349387

350388
- Please check this [README.md](./e2e/README.md)
351389

352-
[testing_workflow_badge]: https://github.com/controlplaneio/netassert/workflows/Lint%20and%20Build/badge.svg
390+
[testing_workflow_badge]: https://github.com/controlplaneio/netassert/actions/workflows/build.yaml/badge.svg
353391

354-
[release_workflow_badge]: https://github.com/controlplaneio/netassert/workflows/goreleaser/badge.svg
392+
[release_workflow_badge]: https://github.com/controlplaneio/netassert/actions/workflows/release.yaml/badge.svg

justfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,21 @@ kind-down:
3434
k8s-apply:
3535
kubectl apply -f ./e2e/manifests/workload.yaml
3636

37-
# delete kubernetes deployObj
3837
k8s-rm-apply:
3938
kubectl delete -f ./e2e/manifests/workload.yaml
4039

40+
netpol-apply:
41+
kubectl apply -f ./e2e/manifests/networkpolicies.yaml
42+
43+
netpol-rm-apply:
44+
kubectl delete -f ./e2e/manifests/networkpolicies.yaml
45+
46+
calico-apply:
47+
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.31.3/manifests/calico.yaml
48+
49+
calico-rm-apply:
50+
kubectl delete -f https://raw.githubusercontent.com/projectcalico/calico/v3.31.3/manifests/calico.yaml
51+
4152
# build docker image and tag it 0.0.01
4253
docker-build:
4354
docker build -f Dockerfile --no-cache --tag packet-capture:{{version}} .

0 commit comments

Comments
 (0)