-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: karampok <karampok@gmail.com>
- Loading branch information
Showing
13 changed files
with
253 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
clab-vlab | ||
*.bak | ||
.pull-secret.json | ||
.github-argo | ||
pull-secret.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: red-two | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: red-two | ||
template: | ||
metadata: | ||
labels: | ||
app: red-two | ||
spec: | ||
containers: | ||
- name: agnhost | ||
image: quay.io/karampok/snife:latest | ||
imagePullPolicy: Always | ||
securityContext: | ||
privileged: true | ||
- name: server | ||
image: registry.k8s.io/e2e-test-images/agnhost:2.40 | ||
command: | ||
- /agnhost | ||
- netexec | ||
- --http-port=8080 | ||
env: | ||
- name: NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
- command: ["bash", "-c"] | ||
args: ["iperf3 -s -p 60000"] | ||
image: quay.io/karampok/snife:latest | ||
imagePullPolicy: Always | ||
name: iperf3 | ||
ports: | ||
- name: iperf3 | ||
containerPort: 60000 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
metallb.universe.tf/address-pool: red | ||
metallb.universe.tf/allow-shared-ip: "key-to-share-red-two" | ||
name: red-two-svc-http | ||
spec: | ||
type: LoadBalancer | ||
externalTrafficPolicy: Local | ||
allocateLoadBalancerNodePorts: false | ||
ports: | ||
- name: http | ||
port: 5555 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: red-two | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
metallb.universe.tf/address-pool: red | ||
metallb.universe.tf/allow-shared-ip: "key-to-share-red-two" | ||
name: red-two-svc-iperf-tcp | ||
spec: | ||
type: LoadBalancer | ||
externalTrafficPolicy: Local | ||
allocateLoadBalancerNodePorts: false | ||
ports: | ||
- name: tcp | ||
port: 60000 | ||
protocol: TCP | ||
targetPort: 60000 | ||
selector: | ||
app: red-two | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
metallb.universe.tf/address-pool: red | ||
metallb.universe.tf/allow-shared-ip: "key-to-share-red-two" | ||
name: red-two-svc-iperf-udp | ||
spec: | ||
type: LoadBalancer | ||
externalTrafficPolicy: Local | ||
allocateLoadBalancerNodePorts: false | ||
ports: | ||
- name: udp | ||
port: 60000 | ||
protocol: UDP | ||
targetPort: 60000 | ||
selector: | ||
app: red-two | ||
|
||
# show bgp vrf red ipv4 summary | ||
# from red | ||
# alias urlencode="python3 -c \"import sys, urllib.parse; print(urllib.parse.quote(''.join(sys.stdin.readlines())))\"" | ||
# curl -s http://6.6.6.1/shell?cmd="$(echo "env|grep -i node" | urlencode)"|jq -r '.output' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,36 @@ | ||
package pkg | ||
|
||
var bridges = `ip link add name sw0 type bridge | ||
ip link set mtu 9000 dev sw0 | ||
ip link set dev sw0 up | ||
var bridges = `ip link add name dataplane type bridge | ||
ip link set dev dataplane up | ||
ip link add name sw1 type bridge | ||
ip link set mtu 9000 dev sw1 | ||
ip link set dev sw1 up | ||
ip link add name ixp-net type bridge | ||
ip link set mtu 9000 dev ixp-net | ||
ip link set dev ixp-net up` | ||
|
||
var cmd02 = `mkdir -p /etc/cni/net.d | ||
cp ./opt/cni.d/{access,baremetal,green-net,red-net,bmc}.conflist /etc/cni/net.d/ | ||
# podman network ls (minimal CNI, no ipam, gateway or anything)` | ||
|
||
var cmd03 = `cat > /tmp/baremetal.xml <<EOM | ||
<network> | ||
<name>baremetal</name> | ||
<forward mode="bridge"/> | ||
<bridge name="baremetal"/> | ||
</network> | ||
EOM | ||
virsh net-create /tmp/baremetal.xml | ||
cat > /tmp/bmc.xml <<EOM | ||
var cmd03 = `cat > /tmp/sw1.xml <<EOM | ||
<network> | ||
<name>bmc</name> | ||
<name>sw1</name> | ||
<forward mode="bridge"/> | ||
<bridge name="bmc"/> | ||
<bridge name="sw1"/> | ||
</network> | ||
EOM | ||
virsh net-create /tmp/bmc.xml | ||
cat > /tmp/dataplane.xml <<EOM | ||
virsh net-create /tmp/sw1.xml | ||
rm /tmp/sw1.xml | ||
<network> | ||
<name>dataplane</name> | ||
<forward mode="bridge"/> | ||
<bridge name="dataplane"/> | ||
</network> | ||
EOM | ||
virsh net-create /tmp/dataplane.xml | ||
cat > /tmp/access.xml <<EOM | ||
<network> | ||
<name>access</name> | ||
<forward mode="bridge"/> | ||
<bridge name="access"/> | ||
</network> | ||
EOM | ||
virsh net-create /tmp/access.xml | ||
rm /tmp/sw1.xml | ||
#virsh net-list` | ||
|
||
var cleanupL2 = []string{ | ||
"ip link delete access", | ||
`iptables -F | ||
iptables -X | ||
iptables -t nat -F | ||
iptables -t mangle -F | ||
iptables -X -t nat | ||
ip link del dev cni-podman0 | ||
ip link del dev virbr0`, | ||
"ip link delete baremetal", | ||
"ip link delete green-net", | ||
"ip link delete red-net", | ||
"ip link delete bmc", | ||
"ip link delete sw1", | ||
"ip link delete dataplane", | ||
"rm /etc/cni/net.d/*", | ||
"virsh net-destroy baremetal", | ||
"virsh net-destroy access", | ||
"ip link delete ixp-net", | ||
"virsh net-destroy sw1", | ||
"virsh net-destroy dataplane", | ||
"rm /tmp/*.xml", | ||
} |
Oops, something went wrong.