-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathrun.sh
executable file
·57 lines (50 loc) · 1.25 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -x
PATH="$PATH:/usr/go/bin"
PATH="$(go env GOPATH)/bin/:$PATH"
tee namespace-blue.json << "EOF"
{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": {
"name": "blue",
"labels": {
"name": "blue"
},
"annotations": {
"opencontrail.org/network": "{'project': 'k8s-blue', 'domain': 'default-domain', 'name': 'vn_blue'}"
}
}
}
EOF
read
sudo kubectl create -f namespace-blue.json
read
tee vn_blue.yml << "EOF"
resources:
- kind: virtual_network
data:
virtual_network_properties:
forwarding_mode: l3
allow_transit:
network_id:
max_flow_rate:
mirror_destination: false
vxlan_network_identifier:
max_flows:
rpf:
fq_name: ["default-domain", "k8s-blue", "vn_blue"]
address_allocation_mode: flat-subnet-only
parent_type: project
network_ipam_refs:
- to: ["default-domain", "k8s-default", "k8s-pod-ipam"]
attr:
ipam_subnets: []
host_routes:
fabric_snat: false
EOF
read
contrailcli -c config.yml sync vn_blue.yml
read
read -p 'Run pod in second terminal using command: "sudo kubectl run -i --tty busybox-one --image=busybox --namespace blue -- sh"'
sudo kubectl run -i --tty busybox-two --image=busybox --namespace blue -- sh