315 Commits

Author SHA1 Message Date
Aaron U'Ren
0023dedc4d fix(NRC): error when nec. host IP not found
If we can't find an appropriate IP to add for nextHop to injectRoute or
overlay tunnel, raise error rather than trying to continue.
2023-10-07 08:52:31 -05:00
Aaron U'Ren
4f284be53e fix(NRC): add IPv6 logic to bgp-local-addresses 2023-10-07 08:52:31 -05:00
Aaron U'Ren
b3e0768281 fix(options): make clusterIP specification similar to other options 2023-10-07 08:52:31 -05:00
Aaron U'Ren
a31511d987 fix(NPC): actually separate chain indices for ipv4 / ipv6 2023-10-07 08:52:31 -05:00
Aaron U'Ren
096da81f92 fact(NPC): pluralize newIPTablesHandler 2023-10-07 08:52:31 -05:00
Aaron U'Ren
ddb0e63c46 feat(NRC): make NRC dual stack 2023-10-07 08:52:31 -05:00
Aaron U'Ren
01f2ff2aa1 fact(NRC): convert BGP set names to const
Convert all BGP set names to constants and then refer to them via the
constant across the code base so that we reduce the effect of typos.
2023-10-07 08:52:31 -05:00
Aaron U'Ren
85cecb6e61 feat(pod_cidr): handle multiple pod CIDRs 2023-10-07 08:52:31 -05:00
Aaron U'Ren
3db482be3b fix(NPC): separate chain indices for ipv4 / ipv6
Without this, kube-router would end up sharing the index between ipv4
and ipv6 which would cause it to error out when one incremented beyond
the number of rules that actually existed in the chain.
2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
d7e2a146f3 fix golangci issues 2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
12561f9faa fix test compilation error 2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
76e5d20c5a use createGenericHashIPSet 2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
b3dcaa0878 rename utilsnet import to netutils 2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
4256a60705 syncPodFirewallChains: loop on all NodeIp
to find the pods running on a given Node
- Load PodIp in podInfo struct and use it instead of pod.ips[0].IP
2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
92e91df9d2 refactor whitelisting of cluster IP Range 2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
6fea9c2d19 Validate that ClusterIP service range type matches the configuration
and update documentation
2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
26d06c40aa Turn IPTablesSaveRestore into an interface 2023-10-07 08:52:31 -05:00
Thomas Ferrandiz
3839ec1d8e init iptablesCmdHandlers and ipSetHandlers inside NewNetworkPolicyController 2023-10-07 08:52:31 -05:00
Michal Rostecki
5d04a9fd97 netpol: Add dual-stack support
This change allows to define two cluster CIDRs for compatibility with
Kubernetes dual-stack, with an assumption that two CIDRs are usually
IPv4 and IPv6.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2023-10-07 08:52:31 -05:00
Aaron U'Ren
5d7189734e fix(NRC): withdraw advertised VIPs based on annotation
Annotations were taken into account during startup, but after they were
advertised the affect of annotations was only additive because we
were only tracking current state of VIPs that should be advertised and
not taking into account VIPs that should be withdrawn for anything other
than service locality.

Fixes #1491
2023-07-17 08:20:05 -05:00
Manuel Rüger
ef77a2d58b Fix lint 2023-02-10 08:44:38 -08:00
Kevin Sauter
4c751b0904 Register BGP sent metric 2023-01-31 17:24:22 -06:00
Kevin Sauter
4c7ca8afe6 Add sent metric to vip bgp announcement. To distinguish between the different sent counters, the new "type" label can be used. 2023-01-31 17:24:22 -06:00
Aaron U'Ren
1d1ff0599a fix(NSC): add check for podCidr before use
Fixes #1434
2023-01-31 12:05:57 -06:00
Richard Kojedzinszky
e6fd1b2519
Support for kube-router.io/peer.localips annotation (#1392)
* Support for kube-router.io/peer.localips annotation

* Fix checking for valid addresses in kube-router.io/peer.localips
2022-11-15 15:19:29 -06:00
Tamihiro Lee
efd100154f fix invalid MTU in CNI config file 2022-10-20 08:48:36 -05:00
Manuel Rüger
1d37130447 Fix linting 2022-10-17 11:37:07 -05:00
Aaron U'Ren
6dbd3a1d6d fix(NSC): don't check protocol on DSR svcs
DSR IPVS inherently don't have a protocol, so don't check for protocol
with these services and ensure that they are cleaned up correctly.

Fixes #1328
2022-07-29 17:19:07 -05:00
Aaron U'Ren
4615e85496 fix(bgp): set graceful restart on enabled family
Rather than setting BGP Graceful Restart on both IPv4 and IPv6
regardless of which family is enabled, check the current mode via
nrc.isIpv6 and only set on appropriate family.

Note, this mode is exclusive as the current portions of NRC kube-router
code are only meant to work with IPv4 or IPv6 not both at the same time.

Fixes #1323
2022-07-12 19:44:15 -05:00
Aaron U'Ren
f97eb7cc1a fix: remove multiple MTU reductions
fixes cloudnativelabs#1033
2022-06-24 17:51:49 -05:00
Aaron U'Ren
e370cb018d gobgp: update to 3.X 2022-06-11 12:03:27 -05:00
Manuel Rüger
9d315229c8 Ignore gosec linting issue 2022-05-29 13:37:32 -05:00
Xiang Liu
8fcebb3106 fix(constant): use constant from resourcelock package 2022-05-26 22:55:40 -05:00
Aaron U'Ren
b5028025b2 fix(NPC): add missing quotes 2022-04-05 17:13:34 -05:00
Aaron U'Ren
3771745872 fix(customimportreject): reject all in subnet
Changes the custom import reject annotation support to not only block
the given subnet exactly, but also all subnets of the subnet given.

For example, this change blocks 10.100.100.0/24 when customimportreject
annotation has 10.100.0.0/16 in it.
2022-03-23 09:27:38 -05:00
Lucas Mundim
badf8645be feat(bgp): add custom BGP import rejection policy support via node annotation 2022-03-23 09:27:38 -05:00
Aaron U'Ren
2d9fb92547 test(sync_routes): add unit testing 2022-03-18 15:02:02 -05:00
Aaron U'Ren
4fd7bc4d19 fix(sync_routes): add deletion / immediate syncing
Added the following items to the original logic:
* Added map route entry deletion on withdrawl so that the system doesn't
  incorrectly sync it back to the kernel's routing table
* Added an immediate route sync upon BGP path receive
* Added a mutex to ensure that deleted routes aren't accidentally synced
  back to the system
* Added stopCh and wg (wait group) handling
* Increase default sync time from 15 seconds to 1 minute since this
  scenario is unlikely and netlink calls could potentially be burdensome
  in large clusters.
2022-03-18 15:02:02 -05:00
RusoX89
23ac78cf94 Routes Synchronization Routine 2022-03-18 15:02:02 -05:00
Xiang Liu
492e0d126b fix(NPC): make code more understandable 2022-03-15 12:06:22 -05:00
Tamihiro Lee
1db19931a2 skip binding device to ipip tunnel if node's interface is loopback 2022-03-11 16:41:14 -06:00
Tamihiro Lee
184976a536 start peering connection to neighbors from node's advertise-ip 2022-03-11 16:19:00 -06:00
Aaron U'Ren
4b6cf6c896 fact(protocol): standardize protocol conversions 2022-02-11 17:34:10 -06:00
Aaron U'Ren
28aab6ea20 fact(service_endpoints_sync): simplify external IP logic
This is an attempt to make the external IP logic easier to follow and
more straight forward for future changes like consolidating the iptables
logic.
2022-02-11 17:34:10 -06:00
noillir
d27c317891
change to account for internet headers also when setting MSS (#1232)
Co-authored-by: noillir <miq@noillir.eu>
2022-02-02 15:46:18 -06:00
Aaron U'Ren
a9f0084665
Revert "feat(metrics): add more iptables sync metrics" (#1216)
This reverts commit 22b031beaa3393f8f02812242a9f637ce525b4eb.

@MikeSpreitzer pointed out that these metrics are already present in the
histogram type as *_count and *_sum and these two added metrics just add
duplicates. I've also proved out in my own environments that these
metric values are identical to the ones already carried in the
histogram.
2021-12-10 23:26:19 +05:30
Aaron U'Ren
b74689785a
feat(nsc): only hairpin endpoints on local node (#1208) 2021-12-10 23:19:20 +05:30
Aaron U'Ren
2ca39f14f8 fix(nsc): properly check hairpinning rule
Previously, we would iterate over rulesFromNode, but then check it
against the entirety of the rulesNeeded hash. This resulted in the loop
breaking as soon as it found any matching rule from the host rather than
it breaking if it matched the rule that we were currently processing.
2021-12-03 11:02:55 -06:00
Aaron U'Ren
146786ad8a fix(nsc): sync hairpinning on service modification
When we receive service or endpoint updates from Kubernetes we process a
type of partial sync because the service and endpoints have already been
updated by the handler. However, previously, this partial update did not
include updating the hairpinning rules for services.

This would cause hairpinning changes to be delayed until the next full
sync or until kube-router restart. This changes adds hairpinning into
the partial service sync flow.
2021-12-03 11:02:55 -06:00
Aaron U'Ren
8f13f069b6 fix(nsc): don't overwrite err & add comments 2021-12-03 11:02:55 -06:00