Skip to content

Commit

Permalink
demo: Fix demo2.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Graf <thomas@cilium.io>
  • Loading branch information
tgraf committed Mar 22, 2017
1 parent 06151ae commit 17999e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
10 changes: 5 additions & 5 deletions examples/demo/demo2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
. $(dirname ${BASH_SOURCE})/../../contrib/shell/util.sh

NETWORK="cilium"
CLIENT_LABEL="client"
SERVER_LABEL="server"
CLIENT_LABEL="id.client"
SERVER_LABEL="id.server"

function cleanup {
docker rm -f server client 2> /dev/null || true
}

trap cleanup EXIT

cilium policy delete root 2> /dev/null && true

desc "Demo: Create network, attach container, import policy"
desc ""

Expand All @@ -22,8 +24,6 @@ desc "This step is only required once, all containers can be attached to the sam
desc "thus creating a single flat network. Isolation can then be defined based on labels."
run "docker network create --ipv6 --subnet ::1/112 --driver cilium --ipam-driver cilium $NETWORK"

cilium policy delete .

desc "Start a container with label $SERVER_LABEL"
run "docker run -d --net cilium --name server -l $SERVER_LABEL noironetworks/netperf"
sleep 3
Expand Down Expand Up @@ -62,7 +62,7 @@ run "docker exec -ti client ping6 -c 4 $SERVER_IP"

desc "Show policy table of server container"
desc "The table maintains a packets/bytes counter for each allowed consumer"
run "sudo cilium endpoint policy get $SERVER_ID"
run "sudo cilium bpf policy list $SERVER_ID"

desc "Policies are directional and stateful, allowing client->server does not"
desc "automatically allow the reverse direction server->client. Only reply"
Expand Down
15 changes: 5 additions & 10 deletions examples/demo/policy.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"name": "io.cilium",
"children": {
"client": { },
"server": {
"rules": [{
"allow": ["reserved:host", "../client"]
}]
}

}
"name": "root",
"rules": [{
"coverage": ["id.server"],
"allow": ["reserved:host", "id.client"]
}]
}

0 comments on commit 17999e6

Please sign in to comment.