File tree Expand file tree Collapse file tree 4 files changed +42
-44
lines changed Expand file tree Collapse file tree 4 files changed +42
-44
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ all: build test
55test :
66 @echo " + $@ "
77 ./scripts/test
8+ example :
9+ @echo " + $@ "
10+ ./scripts/example
811build :
912 @echo " + $@ "
1013 ./scripts/build
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -eu
4+
5+ kubectl delete -f examples/ns.yaml || true
6+
7+ kubectl delete psp psp-privileged psp-restricted || true
8+
9+ # create namespaces
10+ kubectl apply -f examples/ns.yaml || true
11+
12+ # create service accounts
13+ kubectl apply -f examples/sa.yaml || true
14+
15+ # create roles and rolebindings for service accounts to use pod security policies
16+ kubectl apply -f examples/roles.yaml || true
17+
18+ # create pods
19+ kubectl apply -f examples/pods.yaml || true
20+
21+ # generate psp and update the pod security policy name
22+ ./kube-psp-advisor --namespace privileged | sed -e ' s/pod-security.*/psp-privileged/g' | kubectl apply -f -
23+
24+ ./kube-psp-advisor --namespace restricted | sed -e ' s/pod-security.*/psp-restricted/g' | kubectl apply -f -
25+
26+ # test creating pods that pass the pod security policies
27+ kubectl apply -f examples/pods-allow.yaml || true
28+
29+ kubectl get pods -n privileged
30+
31+ kubectl get pods -n restricted
32+
33+ # test creating pod that violate pod security policies
34+ kubectl apply -f examples/pods-deny.yaml || true
35+
36+ kubectl get pods -n privileged
37+
38+ kubectl get pods -n restricted
39+
You can’t perform that action at this time.
0 commit comments