From 3d789f14169ce1af77aa857451401de46b31d129 Mon Sep 17 00:00:00 2001 From: Michael Cambria Date: Mon, 20 Feb 2017 12:18:17 -0500 Subject: [PATCH] Deal with mesos not supporting CNI_ARGS --- 20-macvlan0.conf | 1 + cni-quagga-bgp.txt | 14 ++++++++++++++ mcc-manual-add-static-env.sh | 2 +- mcc-manual-del-static-env.sh | 2 +- .../ipam/vz-local/backend/allocator/config.go | 17 ++++++++++++++++- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/20-macvlan0.conf b/20-macvlan0.conf index 6e219fa..67a8d85 100644 --- a/20-macvlan0.conf +++ b/20-macvlan0.conf @@ -13,6 +13,7 @@ { "key" : "mccKey1", "value" : "mccVal1" }, { "key" : "bs", "value" : "bsVal" }, { "key" : "StaticIP", "value" : "172.19.0.209" }, + { "key" : "viaIP", "value" : "eth1p0" }, { "key" : "mccKey2", "value" : "mccVal2" }, { "key" : "env", "value" : "prod" } ] diff --git a/cni-quagga-bgp.txt b/cni-quagga-bgp.txt index 6af686c..afb04c0 100644 --- a/cni-quagga-bgp.txt +++ b/cni-quagga-bgp.txt @@ -13,4 +13,18 @@ sudo ip netns exec mcc-cni-test1 /bin/bash /var/lib/cni/networks/ +vtysh 2506 +node-36-20# show ip bgp +BGP table version is 0, local router ID is 10.36.20.1 +Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, + i internal, r RIB-failure, S Stale, R Removed +Origin codes: i - IGP, e - EGP, ? - incomplete + + Network Next Hop Metric LocPrf Weight Path +* 0.0.0.0 169.254.0.2 0 64513 65531 i +*> 169.254.0.1 0 64512 65531 i +*> 198.159.134.4/32 0.0.0.0 0 32768 i +*> 198.159.134.33/32 + 0.0.0.0 0 32768 i + diff --git a/mcc-manual-add-static-env.sh b/mcc-manual-add-static-env.sh index bb084a5..cfc47ab 100755 --- a/mcc-manual-add-static-env.sh +++ b/mcc-manual-add-static-env.sh @@ -8,7 +8,7 @@ export CNI_COMMAND=ADD export CNI_NETNS=/var/run/netns/mcc-cni-test0 export CNI_CONTAINERID=mcc-cni-test0 -export CNI_ARGS="IP=172.19.99.99;UPLINK=eth1p0" +##export CNI_ARGS="IP=172.19.99.99;UPLINK=eth1p0" #export CNI_ARGS="IP=172.19.99.99" #export CNI_ARGS+=";UPLINK=cbr0" diff --git a/mcc-manual-del-static-env.sh b/mcc-manual-del-static-env.sh index 84af1c2..83bbd05 100755 --- a/mcc-manual-del-static-env.sh +++ b/mcc-manual-del-static-env.sh @@ -8,7 +8,7 @@ export CNI_COMMAND=DEL export CNI_NETNS=/var/run/netns/mcc-cni-test0 export CNI_CONTAINERID=mcc-cni-test0 -export CNI_ARGS="IP=172.19.99.99;UPLINK=eth1p0" +##export CNI_ARGS="IP=172.19.99.99;UPLINK=eth1p0" #export CNI_ARGS="IP=172.19.99.99" #export CNI_ARGS+=";UPLINK=cbr0" diff --git a/plugins/ipam/vz-local/backend/allocator/config.go b/plugins/ipam/vz-local/backend/allocator/config.go index e4ef561..ad95ce6 100644 --- a/plugins/ipam/vz-local/backend/allocator/config.go +++ b/plugins/ipam/vz-local/backend/allocator/config.go @@ -91,8 +91,11 @@ func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, string, error) { return nil, "", err } + // MikeC for now + n.IPAM.Args = &IPAMArgs{} if args != "" { - n.IPAM.Args = &IPAMArgs{} + // MikeC for now + // n.IPAM.Args = &IPAMArgs{} err := types.LoadArgs(args, n.IPAM.Args) if err != nil { return nil, "", err @@ -159,6 +162,18 @@ func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, string, error) { println("StaticIP label NOT set") } + viaIP, found := labels["viaIP"] + if found { + println("viaIP is: ", viaIP) + log.Println("viaIP is: ", viaIP) + n.IPAM.Args.UPLINK= types.UnmarshallableString(viaIP) + log.Println("IPAM args: n.IPAM.UPLINK is:", n.IPAM.Args.UPLINK) + } else { + println("viaIP label NOT set") + } + + + bull, found := labels["bull"] if !found { println("Hard to believe, but bull not found") -- 2.44.0