@@ -704,6 +704,7 @@ func endpointManagerTests(ipVersion uint8) func() {
704
704
false ,
705
705
hepListener ,
706
706
newCallbacks (),
707
+ true ,
707
708
)
708
709
})
709
710
@@ -1416,7 +1417,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1416
1417
}))
1417
1418
})
1418
1419
})
1419
-
1420
1420
})
1421
1421
1422
1422
Context ("with host endpoint configured before interface signaled" , func () {
@@ -1470,7 +1470,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1470
1470
}
1471
1471
1472
1472
Describe ("workload endpoints" , func () {
1473
-
1474
1473
Context ("with a workload endpoint" , func () {
1475
1474
wlEPID1 := proto.WorkloadEndpointID {
1476
1475
OrchestratorId : "k8s" ,
@@ -1514,7 +1513,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1514
1513
It ("should have expected chains" , expectWlChainsFor ("cali12345-ab_policy1" ))
1515
1514
1516
1515
Context ("with another endpoint with the same interface name and earlier workload ID, and no policy" , func () {
1517
-
1518
1516
JustBeforeEach (func () {
1519
1517
epMgr .OnUpdate (& proto.WorkloadEndpointUpdate {
1520
1518
Id : & proto.WorkloadEndpointID {
@@ -1541,7 +1539,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1541
1539
It ("should have expected chains with no policy" , expectWlChainsFor ("cali12345-ab" ))
1542
1540
1543
1541
Context ("with the first endpoint removed" , func () {
1544
-
1545
1542
JustBeforeEach (func () {
1546
1543
epMgr .OnUpdate (& proto.WorkloadEndpointRemove {
1547
1544
Id : & wlEPID1 ,
@@ -1555,7 +1552,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1555
1552
It ("should have expected chains with no policy" , expectWlChainsFor ("cali12345-ab" ))
1556
1553
1557
1554
Context ("with the second endpoint removed" , func () {
1558
-
1559
1555
JustBeforeEach (func () {
1560
1556
epMgr .OnUpdate (& proto.WorkloadEndpointRemove {
1561
1557
Id : & proto.WorkloadEndpointID {
@@ -1576,7 +1572,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1576
1572
})
1577
1573
1578
1574
Context ("with another endpoint with the same interface name and later workload ID, and no policy" , func () {
1579
-
1580
1575
JustBeforeEach (func () {
1581
1576
epMgr .OnUpdate (& proto.WorkloadEndpointUpdate {
1582
1577
Id : & proto.WorkloadEndpointID {
@@ -1603,7 +1598,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1603
1598
It ("should have expected chains" , expectWlChainsFor ("cali12345-ab_policy1" ))
1604
1599
1605
1600
Context ("with the first endpoint removed" , func () {
1606
-
1607
1601
JustBeforeEach (func () {
1608
1602
epMgr .OnUpdate (& proto.WorkloadEndpointRemove {
1609
1603
Id : & wlEPID1 ,
@@ -1617,7 +1611,6 @@ func endpointManagerTests(ipVersion uint8) func() {
1617
1611
It ("should have expected chains with no policy" , expectWlChainsFor ("cali12345-ab" ))
1618
1612
1619
1613
Context ("with the second endpoint removed" , func () {
1620
-
1621
1614
JustBeforeEach (func () {
1622
1615
epMgr .OnUpdate (& proto.WorkloadEndpointRemove {
1623
1616
Id : & proto.WorkloadEndpointID {
@@ -1810,6 +1803,59 @@ func endpointManagerTests(ipVersion uint8) func() {
1810
1803
})
1811
1804
})
1812
1805
1806
+ // Test that by disabling floatingIPs on the endpoint manager, even workload endpoints
1807
+ // that have floating IP NAT addresses specified will not result in those routes being
1808
+ // programmed.
1809
+ Context ("with floating IPs disasbled, but added to the endpoint" , func () {
1810
+ JustBeforeEach (func () {
1811
+ epMgr .floatingIPsEnabled = false
1812
+ epMgr .OnUpdate (& proto.WorkloadEndpointUpdate {
1813
+ Id : & wlEPID1 ,
1814
+ Endpoint : & proto.WorkloadEndpoint {
1815
+ State : "active" ,
1816
+ Mac : "01:02:03:04:05:06" ,
1817
+ Name : "cali12345-ab" ,
1818
+ ProfileIds : []string {},
1819
+ Tiers : []* proto.TierInfo {},
1820
+ Ipv4Nets : []string {"10.0.240.2/24" },
1821
+ Ipv6Nets : []string {"2001:db8:2::2/128" },
1822
+ Ipv4Nat : []* proto.NatInfo {
1823
+ {ExtIp : "172.16.1.3" , IntIp : "10.0.240.2" },
1824
+ {ExtIp : "172.18.1.4" , IntIp : "10.0.240.2" },
1825
+ },
1826
+ Ipv6Nat : []* proto.NatInfo {
1827
+ {ExtIp : "2001:db8:3::2" , IntIp : "2001:db8:2::2" },
1828
+ {ExtIp : "2001:db8:4::2" , IntIp : "2001:db8:4::2" },
1829
+ },
1830
+ },
1831
+ })
1832
+ err := epMgr .ResolveUpdateBatch ()
1833
+ Expect (err ).ToNot (HaveOccurred ())
1834
+ err = epMgr .CompleteDeferredWork ()
1835
+ Expect (err ).ToNot (HaveOccurred ())
1836
+ })
1837
+
1838
+ It ("should have expected chains" , expectWlChainsFor ("cali12345-ab" ))
1839
+
1840
+ It ("should set routes with no floating IPs" , func () {
1841
+ if ipVersion == 6 {
1842
+ routeTable .checkRoutes ("cali12345-ab" , []routetable.Target {
1843
+ {
1844
+ CIDR : ip .MustParseCIDROrIP ("2001:db8:2::2/128" ),
1845
+ DestMAC : testutils .MustParseMAC ("01:02:03:04:05:06" ),
1846
+ },
1847
+ })
1848
+ } else {
1849
+ routeTable .checkRoutes ("cali12345-ab" , []routetable.Target {
1850
+ {
1851
+ CIDR : ip .MustParseCIDROrIP ("10.0.240.0/24" ),
1852
+ DestMAC : testutils .MustParseMAC ("01:02:03:04:05:06" ),
1853
+ },
1854
+ })
1855
+ }
1856
+ })
1857
+ })
1858
+
1813
1859
Context ("with the endpoint removed" , func () {
1814
1860
JustBeforeEach (func () {
1815
1861
epMgr .OnUpdate (& proto.WorkloadEndpointRemove {
@@ -1961,9 +2007,7 @@ type testProcSys struct {
1961
2007
Fail bool
1962
2008
}
1963
2009
1964
- var (
1965
- procSysFail = errors .New ("mock proc sys failure" )
1966
- )
2010
+ var procSysFail = errors .New ("mock proc sys failure" )
1967
2011
1968
2012
func (t * testProcSys ) write (path , value string ) error {
1969
2013
log .WithFields (log.Fields {
0 commit comments