112 Commits

Author SHA1 Message Date
Lucas Mundim
5156f878d6 Add a default route 0.0.0.0/8 import policy deny rule 2021-08-05 12:02:42 -05:00
Aaron U'Ren
06e246ff30 fix(NRC): PR feedback fixes 2021-07-30 12:59:32 -05:00
Aaron U'Ren
445ad9a1b5 fix(injectRoute): process withdrawls first
Avoid extra and unneeded work by processing withdrawls first. Also makes
the logic a lot more clear.
2021-07-30 12:59:32 -05:00
Aaron U'Ren
2e590a4185 fix(NRC): consolidate route delete logic
This also makes the call that happens upon path withdrawl safer, by
checking to see if the route exists before deleting it.

One departure here is that we used to only log errors, now we return
errors as soon as they are encountered, this may cause some routes to
persist even if they had been cleaned before by stopping at the first
error. However, I think that it makes for more consistent and expected
behavior if this needs to be called in another place.
2021-07-30 12:59:32 -05:00
Aaron U'Ren
d0501c0763 fix(injectRoute): cleanup tunnels & routes when peer drops 2021-07-30 12:59:32 -05:00
Aaron U'Ren
94640acf81 doc(injectRoute): improve comments on logic flow 2021-07-30 12:59:32 -05:00
Aaron U'Ren
4959da43a4 feat(NRC): reduce verbosity of log messages for common overlay cases 2021-07-30 12:59:32 -05:00
Aaron U'Ren
38222a350b fact(injectRoute): extract setupOverlayTunnel() and cleanupTunnels() 2021-07-30 12:59:32 -05:00
Aaron U'Ren
63c3b90e05 fact(injectRoute): extract parseBGPPath method to simplify 2021-07-30 12:59:32 -05:00
Aaron U'Ren
e9be04ef2f
fix: add nil checking to ipsetMutex cleanup actions (#1129) 2021-07-20 01:22:48 +05:30
Aaron U'Ren
fa8d69edd8 fix: add locking around ipset invocations 2021-06-01 10:42:08 -05:00
Aaron U'Ren
a610596277 fact(GetMTUFromNodeIP): move up a layer of abstraction
This function is useful for more than just the NRC, move it up a layer
into the global utils so it can be used from multiple controllers.
2021-05-17 16:33:15 -05:00
Aaron U'Ren
9cbc3763b3 feat(bgp): add BGP communities support via node annotation 2021-05-17 12:08:36 -05:00
Aaron U'Ren
ae9d0e31e8 fix(bgp_policies_test.go): actually test policy
Previously, this section was commented out and full testing to ensure
that the policies matched was not performed. Now the unit tests are more
complete and actually test that the expected policies are present.
2021-05-17 12:08:36 -05:00
Aaron U'Ren
fa7bcdeb06 fix(bgp_policies_test.go): use startBgpServer()
Use startBgpServer() rather than doing things individually, so that we
can follow the logic path of how kube-router actually works better. This
allows us to use annotations rather than set stuff manually and allows
us to test more of the code-path of the NRC.

Additionally, this change allows us to actually test some errors better
such as, make sure that startBgpServer() actually throws the error we
expect when only one part of the prepend ASN annotation is present.
Previously, we were not actually testing this code path.
2021-05-17 12:08:36 -05:00
Aaron U'Ren
a5d6560751 fact(bgp_policies_test): move BGP policy tests into their own file 2021-05-17 12:08:36 -05:00
Aaron U'Ren
ef827d3dbf fix: protect uint32 conversion
See the following for more details:
https://github.com/cloudnativelabs/kube-router/security/code-scanning?query=ref%3Arefs%2Fpull%2F1065%2Fmerge+tool%3ACodeQL
2021-04-14 16:23:59 -05:00
Aaron U'Ren
1816886cb4 fix: remove possible BGP password leak via logs
See:
https://github.com/cloudnativelabs/kube-router/security/code-scanning/1?query=ref%3Arefs%2Fpull%2F1065%2Fmerge
2021-04-14 16:23:59 -05:00
Aaron U'Ren
be01f317c7 fact: other misc cleanups 2021-04-14 16:23:59 -05:00
Aaron U'Ren
0faf772fbd fix: don't overload function names with vars 2021-04-14 16:23:59 -05:00
Aaron U'Ren
53cfbe30eb fix: return early when we might be holding nil references 2021-04-14 16:23:59 -05:00
Aaron U'Ren
4efa5ccc48 fact: remove function parameters that are never referenced 2021-04-14 16:23:59 -05:00
Aaron U'Ren
a86b3fad35 fact: handle errors from Close() explicitely 2021-04-14 16:23:59 -05:00
Aaron U'Ren
96675e620b fix: don't capitalize error messages
It is standard practice in Go to not capitalize error messages:
https://github.com/golang/go/wiki/CodeReviewComments#error-strings
2021-04-14 16:23:59 -05:00
Aaron U'Ren
e9c77d0a35 fix(comments): misspellings and bad doc strings 2021-04-14 16:23:59 -05:00
Manuel Rüger
7d47aefe7d Replace github.com/golang/glog with k8s.io/klog/v2
glog is effectively unmaintained and the kubernetes ecosystem is mainly
using its fork klog

Fixes: #1051
2021-04-11 13:16:03 -05:00
Murali Reddy
c309b276ae skip logging Error when there is no Service object for an Endpoint 2021-03-24 14:30:27 -05:00
Aaron U'Ren
43c3c9de86
Handle headless services (#1047)
* doc(ecmp_vip.go): add info around extra withdraw

Rename getWithdraw to make it more explicit what its doing here. Also
add documentation as to why this is needed on Update and not
Create/Delete as well as why we only treat externalIPs.

* fix(ecmp_vip.go): remove superfluous AddPolicies

AddPolicies is already called downstream of nrc.OnEndpointsUpdate() so
there is no need to do it here as well, the only result is that this
expensive operation and idempotent operation is run twice.

* feat: better handling of headless services

Also introduces a consolidated Service utilities section for controller
functionality related to services that is shared.

* fix: add logging back to tryHandleServiceDelete
2021-03-24 08:31:39 +05:30
Murali Reddy
40512f104a serialize the iptables changes by NRC and NPC while starting 2021-03-18 09:21:22 -05:00
yydzhou
49b9add056
Making IPIP/tunnel and override-nexthop independent (#1025)
* enable tunnel plus override-nexthop config

* add docs

* feedback integration

Co-authored-by: deng.zhou <deng.zhou@bytedance.com>
2021-02-09 18:44:56 +05:30
Murali Reddy
54b921f1f8 Merge remote-tracking branch 'iamakulov/master' 2021-01-04 16:56:41 +05:30
Aaron U'Ren
f8aed0c92a fix(nrc): multiple services with the same VIP
Properly consider the readiness of all services in the case where
multiple services share the same VIP. Don't withdraw a VIP just because
one service is not ready.
2020-12-11 11:05:33 -06:00
ᗪєνιη ᗷυнʟ
8e3f36c679
Add LoadBalancer to getExternalIPs (#995)
* add LoadBalancer to getExternalIPs

* fix up network_routes_controller tests

* update ecmp_vip tests
2020-10-02 16:34:14 +05:30
Murali Reddy
92b914e7fd review comments 2020-10-01 23:00:36 -05:00
Murali Reddy
7904b7c950 addressing review comments 2020-10-01 23:00:36 -05:00
Murali Reddy
947bb246e4 fix lint error 2020-10-01 23:00:36 -05:00
Murali Reddy
db1bd5611e set mtu in cni spec to auto configure MTU's of the pod's veth's and kube-bridge interfaces
Fixes #165
2020-10-01 23:00:36 -05:00
Aaron U'Ren
824614d162
Add Support for Reading Peer Passwords via a File (#986)
* Add support for reading peer passwords via a file

Syntax of the file is the same as for --peer-router-passwords, that is,
a comma separated list of base64 encoded passwords.

Passwords specified with --peer-router-passwords have precedence over
passwords read from peer-router-passwords-file.

* fix(options): peer password file linting and doc

Co-authored-by: Jean Raby <jean@raby.sh>
2020-09-08 16:16:21 -05:00
Murali Reddy
3c734fb96a
merge gobgp-update into master (#982)
* merge gobgp-update into master

* update travis.yaml go version:

* go get github.com/osrg/gobgp to build gobgp

* install git as go get needs it
2020-09-07 10:27:58 +05:30
Ivan Akulov
1a487d2140
Remove options passed to .Refresh()
To match the existing code behavior that existed for at least two years
2020-08-19 21:50:37 +03:00
Aaron U'Ren
e35dc9d61e
Merge pull request #958 from coufalja/random-all
Add --random-fully to MASQ iptables rules to mitigate conntrack issues
2020-08-04 16:49:06 -05:00
jakub.coufal
68dba40d58 Clean original iptables rule if --random-fully is supported 2020-08-04 07:33:17 +02:00
Murali Reddy
a33089d292
[testing] run go linters (#943)
* run go linters for static code checking

* fix(lint): fix all goimports linting errors

* fix(lint): fix all golint errors

* fix(lint): fix all spelling errors

Co-authored-by: Aaron U'Ren <aauren@gmail.com>
2020-07-28 23:52:41 +05:30
jakub.coufal
8d424ea09b Fix pod egress rule cleanup 2020-07-28 14:02:00 +02:00
jakub.coufal
d66a3bb06e Activate --random-fully where supported 2020-07-27 14:43:06 +02:00
Murali Reddy
bb35b9ad2e fix lint error: minor fix to catch the error from .bgpServer.Stop() 2020-07-17 06:54:34 +05:30
Aaron U'Ren
031a9926d6
Merge pull request #786 from jdrahos/rr_ipv4_785
Allow to configure RR cluster id using IPv4 strings
2020-07-16 09:41:13 -05:00
CloudNativer
1c184624d1
The bgp-holdtime function parameter of setting holdtime is added to adjust the holdtime of BGP negotiation with the connected network devices. (#921)
The bgp-holdtime function parameter of setting holdtime is added to adjust the holdtime of BGP negotiation with the connected network devices.
2020-07-13 09:10:31 -05:00
Aaron U'Ren
b07f53f4b8 fix(graceful_restart): gofmt and doc fixes so unit tests pass 2020-07-10 16:26:54 -05:00
Jean Raby
1c594b2827 Allow setting BGP Graceful restart time from CLI
Default value remains the same as GoBGP (90s)
2020-07-10 13:57:04 -05:00