Skip to content

Commit 03e1711

Browse files
azzidbrb
authored andcommitted
Allow example to run as script
Doing apply, logs, delete in sequence as fast as a script does has the unfortuante effect that it does logs before the pod is ready. Adding a wait sorts that. Sending ctrl+c to break logs will however terminate bash before delete can run. Putting delete in a trap sorts that.
1 parent df2c42a commit 03e1711

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ docker run --privileged --rm -t --pid=host -v /sys/kernel/debug/:/sys/kernel/deb
8686

8787
The following example shows how to run `pwru` on a given node:
8888
```
89+
#!/usr/bin/env bash
8990
NODE=kind-control-plane
9091
PWRU_ARGS="--output-tuple 'host 1.1.1.1'"
9192
93+
trap " kubectl delete --wait=false pod pwru " EXIT
94+
9295
kubectl apply -f - <<EOF
9396
apiVersion: v1
9497
kind: Pod
@@ -116,8 +119,8 @@ spec:
116119
hostPID: true
117120
EOF
118121
122+
kubectl wait pod pwru --for condition=Ready --timeout=90s
119123
kubectl logs -f pwru
120-
kubectl delete pod pwru
121124
```
122125

123126
### Running on Vagrant

0 commit comments

Comments
 (0)