kilo/pkg
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
..
calico pkg/mesh,pkg/wireguard: allow DNS name endpoints 2020-02-22 17:17:13 +01:00
encapsulation Nodes without private IPs 2021-01-24 22:37:24 +01:00
iproute pkg/{encapsulation,mesh}: abstract encapsulation 2019-05-13 18:30:03 +02:00
ipset init 2019-01-18 02:50:10 +01:00
iptables pkg/iptables: reduce calls to iptables 2021-02-20 19:24:06 +01:00
k8s pkg/k8s: bump headers for 2021 2021-01-30 17:40:01 +01:00
mesh pkg/iptables: reduce calls to iptables 2021-02-20 19:24:06 +01:00
route pkg/route,pkg/mesh: replace NAT with ip rules 2020-02-20 21:27:50 +01:00
version init 2019-01-18 02:50:10 +01:00
wireguard pkg/*: allow kgctl to compile for other OSes 2020-11-14 12:16:07 +01:00