kilo/pkg/mesh
Lucas Servén Marín acfd0bbaec
pkg/iptables: reduce calls to iptables
Currently, every time the iptables controller syncs rules, it spawns an
an iptables process for every rule it checks. This causes two problems:
1. it creates unnecessary load on the system; and
2. it causes contention on the xtables lock file.

This commit creates a lazy cache for iptables rules and chains that
avoids spawning iptables processes. This means that each time the
iptables rules are reconciled, if no rules need to be changed then at
most one iptables process should be spawned to check all of the rules in
a chain and at most one process should be spawned to check all of the
chains in a table.

Note: the success of this reduction in calls to iptables depends on a
somewhat fragile comparison of iptables rule text. The text of any rule
must match exactly, including the order of the flags. An improvement to
come would be to implement an iptables rule parser than can be used to
check semantic equivalence betweem iptables rules.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2021-02-20 19:24:06 +01:00
..
backend.go Nodes without private IPs 2021-01-24 22:37:24 +01:00
cni.go pkg/*: allow kgctl to compile for other OSes 2020-11-14 12:16:07 +01:00
discoverips.go Nodes without private IPs 2021-01-24 22:37:24 +01:00
graph.go Merge pull request #105 from squat/fix_graph_title 2021-01-29 18:21:11 +01:00
ip_test.go pkg/mesh: fix ip allocator helper 2020-02-20 13:54:11 +01:00
ip.go pkg/*: allow kgctl to compile for other OSes 2020-11-14 12:16:07 +01:00
mesh_test.go pkg/mesh,pkg/wireguard: allow DNS name endpoints 2020-02-22 17:17:13 +01:00
mesh.go pkg/mesh/mesh.go: iptables rules in encapsulation 2021-02-20 02:00:57 +01:00
routes_test.go Nodes without private IPs 2021-01-24 22:37:24 +01:00
routes.go pkg/iptables: reduce calls to iptables 2021-02-20 19:24:06 +01:00
topology_test.go Nodes without private IPs 2021-01-24 22:37:24 +01:00
topology.go Nodes without private IPs 2021-01-24 22:37:24 +01:00