Skip to content

Instantly share code, notes, and snippets.

@s1061123
Created May 12, 2021 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save s1061123/e5903c2042db324a9cfe0870eb7d90fe to your computer and use it in GitHub Desktop.
Save s1061123/e5903c2042db324a9cfe0870eb7d90fe to your computer and use it in GitHub Desktop.
metallb dev-env /bgp + koko log
## note:
## change e2e-bgp (not use frr container)
[tohayash@tohayash-lab2 metallb]$ git diff
diff --git a/e2etest/bgp_test.go b/e2etest/bgp_test.go
index 2ba2032f..a7be9c16 100644
--- a/e2etest/bgp_test.go
+++ b/e2etest/bgp_test.go
@@ -73,7 +73,7 @@ var _ = ginkgo.Describe("BGP", func() {
hostport := fmt.Sprintf("http://%s:%d/",
ingressIP,
svcTCPPort)
- _, err = runCommand(true, "wget", "-O-", "-q", hostport)
+ _, err = runCommand(false, "wget", "-O-", "-q", hostport)
framework.ExpectNoError(err)
})
--------
[tohayash@tohayash-lab2 metallb]$ inv dev-env -p bgp
kind version
kind v0.10.0 go1.16.4 linux/amd64
kind create cluster --name=kind --config=/tmp/tmpnd4whp04
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.20.2) 🖼
✓ Preparing nodes 📦 📦 📦
(snip)
go build -v -o build/amd64/controller/controller -ldflags '-X go.universe.tf/metallb/internal/version.gitCommit=fd82c016-dirty -X go.universe.tf/metallb/internal/version.gitBranch=HEAD' go.universe.tf/metallb/controller
### Get koko
[tohayash@tohayash-lab2 metallb]$ curl -LO https://github.com/redhat-nfvpe/koko/releases/download/v0.83/koko_0.83_linux_amd64
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 627 100 627 0 0 881 0 --:--:-- --:--:-- --:--:-- 880
100 14.6M 100 14.6M 0 0 6925k 0 0:00:02 0:00:02 --:--:-- 14.3M
[tohayash@tohayash-lab2 metallb]$ chmod +x koko_0.83_linux_amd64
[tohayash@tohayash-lab2 metallb]$ mv koko_0.83_linux_amd64 koko
# note: koko option
# -d: create veth into docker
# -c: create veth into current network namespace (= container host)
[tohayash@tohayash-lab2 metallb]$ sudo ./koko -d frr,egress,192.168.200.1/24 -c frr,192.168.200.2/24
Create veth...done
[tohayash@tohayash-lab2 metallb]$ docker exec frr ip a show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
53: eth0@if54: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:12:00:05 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.18.0.5/16 brd 172.18.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fc00:f853:ccd:e793::5/64 scope global nodad
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe12:5/64 scope link
valid_lft forever preferred_lft forever
56: egress@if55: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether aa:e3:45:0b:d8:c5 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.200.1/24 brd 192.168.200.255 scope global egress
valid_lft forever preferred_lft forever
[tohayash@tohayash-lab2 metallb]$ sudo ip route add 192.168.10.0/24 via 192.168.200.1
[tohayash@tohayash-lab2 metallb]$ inv e2etest
kind version
kind v0.10.0 go1.16.4 linux/amd64
kind export kubeconfig --name=kind --kubeconfig=/tmp/tmpbku6sovq
Set kubectl context to "kind-kind"
/home/tohayash/work/metallb/tasks.py:538: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe.
(snip)
STEP: Destroying namespace "bgp-8081" for this suite.
[AfterEach] BGP
/home/tohayash/work/metallb/e2etest/bgp_test.go:44
• [SLOW TEST:24.703 seconds]
BGP
/home/tohayash/work/metallb/e2etest/bgp_test.go:33
should work for type=Loadbalancer
/home/tohayash/work/metallb/e2etest/bgp_test.go:50
------------------------------
Ran 1 of 2 Specs in 24.703 seconds
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 1 Skipped
PASS
ok go.universe.tf/metallb/e2etest 24.742s
[tohayash@tohayash-lab2 metallb]$
------------ additional demo
[tohayash@tohayash-lab2 metallb]$ kubectl create -f dev-env/testsvc.yaml
deployment.apps/nginx created
service/nginx created
[tohayash@tohayash-lab2 metallb]$ kubectl get pod
NAME READY STATUS RESTARTS AGE
mirror-bjt65 1/1 Running 0 19m
mirror-jpm7s 1/1 Running 0 19m
nginx-8c9df995d-xjvhq 1/1 Running 0 23s
[tohayash@tohayash-lab2 metallb]$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 22m
nginx LoadBalancer 10.96.33.5 192.168.10.0 80:30734/TCP 26s
[tohayash@tohayash-lab2 metallb]$ ip route get 192.168.10.0
192.168.10.0 via 192.168.200.1 dev frr src 192.168.200.2 uid 1000
cache
[tohayash@tohayash-lab2 metallb]$ curl 192.168.10.0
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[tohayash@tohayash-lab2 metallb]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment