87 Commits

Author SHA1 Message Date
Aaron U'Ren
8fe9f70dd5 Add Import Policy for Service VIPs (#721)
* rename export policies to make it direction independent

* split creating neighborsets and prefixsets from applying export policy

* add bgp import policy to deny service VIPs

* add tests for addition of import policy
2019-05-26 23:29:10 +05:30
Murali Reddy
d6a93d44fe
handle null *route (#732) 2019-05-12 14:12:32 +05:30
Aaron U'Ren
8bb50d5a8c do not setup ipip tunneling when --enable-overlay is false (#722) 2019-05-12 12:43:02 +05:30
milan
7181d6fa96 Prefer node PodCIDR from an annotation (#720)
Current implementation never considers the "kube-router.io/pod-cidr"
annotation when creating an ipset for the node pod network CIDR.
The Node.Spec.PodCIDR is always used instead.

This patch prefers the annotation PodCIDR over the Node.Spec.PodCIDR
2019-04-25 23:07:10 +05:30
Joakim Karlsson
54eedcd049 Issue 572 - Graceful termination + Update to go-1.10.8, alpine-3.9 (#706)
* update netlink

* update libnetwork to get ipvs stats

* update gopkg.lock for libnetwork update

* update libnetwork

* add cli options

* make endpoints delete gracefully

* move conntrack flusher

* get some order in the mainloop

* update to alpine 3.9 & go 1.11.1

* revert to 1.10.3 just update alpine

* and revert travis.yml

* lock version

* test 1.12

* test
2019-04-25 22:57:10 +05:30
Jimmy Zhang
736757d942 Support named port of network policy (#679)
* support named port of network policy

* gofmt
2019-04-20 23:57:25 +05:30
Lucas Servén Marín
e2301761a5 docs,pkgs: change 'can not' to 'cannot' (#701)
This commit fixes a grammar mistake in a doc and some log messages.
2019-04-04 10:27:28 +05:30
Jérôme Petazzoni
375ccc2737 Minor typo fix in logs (#700)
s/annotaion/annotation/
2019-04-02 09:36:21 +05:30
Lucas Mundim
8f9729a01d Introduces the option --overlay-type={subnet,full}, to be able to always generate IPIP tunnels regardless of node subnets (#666)
* Introduces the option --full-overlay, to always generate IPIP tunnels regardless of node subnets

* Use --overlay-type={subnet,full} instead of --full-overlay={true,false}
2019-03-23 23:31:42 +05:30
bazuchan
70969a3ad7 Add iptables rules for accessing tunneled services from node (#682) 2019-03-10 15:11:51 +05:30
Lucas Mundim
42997cb96c Delete iptables rule if --masquerade-all is false (#665) 2019-03-10 15:07:48 +05:30
Matus Kral
961d8ab84c fix #639 (#670)
* - refactor / clean up / extract code dupes into methods and reuse

* - fix 639
- get external IPs to withdraw as diff against previous generation
  of service
2019-03-10 15:00:16 +05:30
Lucas Mundim
00824cd84b Fix typo (#661) 2019-02-09 10:17:09 +05:30
Arvinderpal Wander
1876993862 Removes IPv6 address insertion into BGP IPv4-only nexthop field. (#606)
https://github.com/cloudnativelabs/kube-router/issues/605
2019-01-30 18:29:55 +05:30
Murali Reddy
e99b694194
make gobgp grpc server listen only nodeip and 127.0.0.1 (#649)
Fixes #640
2019-01-30 09:09:57 +05:30
Murali Reddy
62d0e866ad
handle network policies with named ports gracefully (#648) 2019-01-28 16:22:09 +05:30
bazuchan
0599a27e9a Add iptables INPUT rules for tunneled services (#610) 2019-01-24 12:57:12 +05:30
Jimmy Zhang
f07ec53589 avoid duplicate peer pods in npc rules variables (#634) 2019-01-24 12:37:34 +05:30
Aaron U'Ren
a968b2b4d2 cleanup local routes if nexthop moves outside host subnet (#629) 2019-01-22 23:29:53 +05:30
Adam Finn Tulinius
11ae253f12 Validate the presence of port definitions before attempting to access (#643)
This fixes #642, which causes kube-router to crash on valid network
policies, and also implements support for ingress and egress rules
without a port specified.
2019-01-21 11:10:57 +05:30
Steven Armstrong
4da8ee70f2 [RFC] prevent host services from being accessible through service IPs (#618)
* prevent host services from being accessible through service IPs

- on startup create ipsets and firewall rules
- on sync update ipsets
- on cleanup remove firewall rules and ipsets

Fixes #282.

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* ensure iptables rules are also available during cleanup

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* first check if chain exists

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* err not a new variable

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* more redeclared vars

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* maintain a ipset for local addresses and exclude those from our default deny rule

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* copy/paste errors

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>
2019-01-10 23:16:37 +05:30
bazuchan
34270e426d Periodicaly sync iptables MASQUERADE rules (#619) 2018-12-26 14:51:41 +05:30
Arvinderpal Wander
c63e71a523 Enable net.bridge.bridge-nf-call-ip6tables for IPv6. (#608)
https://github.com/cloudnativelabs/kube-router/issues/607
2018-12-15 18:14:13 +05:30
bazuchan
48e2c7b784 Add iptables input rules for ipvs services (#604) 2018-12-13 16:19:34 +05:30
Eric Lindvall
c38e8f66ff Change append to insert for iptables rules (#596)
* Change append to insert for iptables rules

Updates how iptables FORWARD rules are applied to accommodate an existing final DROP rule for the chain.

* Fix the calls to Insert() to include a position

* iptables rules indexes are 1-based
2018-12-13 12:52:38 +05:30
bazuchan
853b75b156 Periodicaly sync default forward rules (#603) 2018-12-13 12:40:36 +05:30
Lars Ekman
6cdc237377 Make ipv6 routing to pods (CNI routing) work for ipv6 (#578) 2018-12-09 11:45:56 +05:30
Steven Armstrong
1a30f9e2e1 implement per-service annotations to control IP advertisment (#575)
* add unit tests for implementing #75

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* integration tests for #75

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* update docs for #75

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* define new kube-router.io/service.advertise.* annotations

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* Implement per service annotations for advertising IPs.

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* more consistent annotation names

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>

* remove redundant tests

Signed-off-by: Steven Armstrong <steven.armstrong@id.ethz.ch>
2018-12-09 10:38:12 +05:30
Joakim Karlsson
e5d599b14c
Roffe/metrics polish (#595)
* update metrics docs & dashboard
* renamed `namespace` label to `svc_namespace` for service metrics as it would be overwritten by most Prometheus setups
* Made histograms for all the controller sync times for better visualization
* added `controller_routes_sync_time`, `controller_bgp_advertisements_sent` & `controller_policy_chains_sync_time` metrics
2018-12-07 16:22:41 +01:00
Joakim Karlsson
5bfab47145
unified function to set sysctl values (#580)
* unified function to set sysctl values and Enable arp_ignore and arp_announce
2018-11-22 21:11:57 +01:00
Joakim Karlsson
4dce4b7c1d
fix typo (#579) 2018-11-19 18:24:19 +01:00
Joakim Karlsson
87718c971d make NSC set net.ipv4.vs.conn_reuse_mode=0 (#577)
* make IPVS proxier set net/ipv4/vs/conn_reuse_mode to 0 by default, which will fix the IPVS low throughput issue

* better error message

* check and inform if to old kernel to use feature
2018-11-19 22:31:24 +05:30
rillion
c39c13b6cf No reason to restrict Peer ASN's to private only. (#576)
* No reason to restrict Peer ASN's to private only. This change is to restrict to public and private ranges.

* gofmt
2018-11-16 11:12:31 +05:30
Murali Reddy
4d6b7faaf9
Fixes regression in BGP route reflector functionality. (#573)
Use proper conversion so correct cluster ID is passed to GoBGP library
2018-11-15 08:45:56 +05:30
Inju Song
cf9bf47d52 Integrate ip_vs_mh scheduler into kube-router (#564)
* Add to set ip_vs_mh scheduler and flags

Signed-off-by: Inju Song <inju.song@navercorp.com>

* Use scheduler flags when adding or updating service

Signed-off-by: Inju Song <inju.song@navercorp.com>

* Refactor with gofmt, generate moq file and fix test source

Signed-off-by: Inju Song <inju.song@navercorp.com>
2018-11-12 14:13:07 +01:00
Lars Ekman
535fcc5abe Added "--router-id=" parameter. (#563)
For ipv6 it is not possible to use the ip address as router-id
and this parameter is required.
2018-11-02 11:00:02 +05:30
Lars Ekman
f95cdedfaa Improved detect in ipv6IsEnabled() (#555)
* Improved detect in ipv6IsEnabled()

* Added comments in ipv6IsEnabled.

Problem described in #155
2018-10-27 09:21:38 +05:30
Murali Reddy
827bbbcd4d
infer endpoint is local from endpoints "subset.addresses.nodeName" (#560)
Fixes #557
2018-10-27 09:19:24 +05:30
Lars Ekman
077ff86bcc Ipv6; BGP peering (#545)
* Use ip6tables for ipv6 and handle ipv6 for egress rules

* Make the temp ipset's fit into 31 characters

This should be improved. Some hash string should be used for
temp names.
2018-10-10 11:02:59 +05:30
Jimmy Zhang
a47e0f4541 Add support for 'except' feature of network policy rule (#543)
* add support for 'except' feature in NPC

* support CIDR with zero prefix size in NPC
2018-10-03 12:50:37 +05:30
Lars Ekman
05907d8def Ipv6; Support ipset with "family inet6" (#538)
* Ipv6; Support ipset with "family inet6"

* Removed unnecessary comment
2018-09-23 12:42:52 +05:30
rjosephwright
77459ddb2c Add CLI option to toggle disabling of source-dest-check in EC2 (#541)
When the number of nodes in a cluster is high enough, the
`disableSourceDestinationCheck()` logic creates a high number
of requests to EC2, resulting in throttling and subsequent
problems, such as the inability to attach EBS volumes. This is
not necessarily mitigated by the `ec2IamAuthorized` attribute
which was added to overcome this issue, as the number of
requests can still be high enough to reach Amazon's request
limits. In addition, it is not necessary to run this multiple
times in a loop for all the nodes in a cluster, as it is
sufficient to set it once when an instance boots.

This CLI option allows an administrator to turn off this
feature for kube-router so they can use some other means of
setting the attribute.
2018-09-23 00:20:37 +05:30
Jimmy Zhang
cadba6c863 Use ipset to manage multiple CIDRs in a network policy rule (#529)
* using ipset to manage multiple src CIDRs

* using ipset to manage multiple dst CIDRs

* soft-code the prefix of iptables chain name and ipset name

* gofmt
2018-09-18 18:31:28 +05:30
Jimmy Zhang
1b7ae13e2c make the comments of the iptables rules more accurate and reasonable (#527) 2018-09-10 23:36:00 +05:30
Andrew Sy Kim
7496b00ddd dont shutdown gobgp server if graceful restart is enabled (#526) 2018-08-31 16:49:24 +05:30
Murali Reddy
01ec8837fa
prevent IPIP tunnel creation when --override-nexthop=ture (#518) 2018-08-15 23:03:22 +05:30
Johan Thomsen
1db83adfb9 Added support for custom BGP ports with 179 still being default (#492) (#493)
* Introduced new cmdline flag --bgp-port, which controls BGP Server listening port and remote port of in-cluster node peers

    * Introduced new cmdline flag --peer-router-ports, which controls remote BGP port for external peers

    * Introduced new node annotation kube-router.io/peer.ports with same effect as --peer-router-ports
2018-08-15 22:59:47 +05:30
Murali Reddy
86ba7840a6
Introduces the option --override-nexthop, to override the next hop used in advertised routes (#502)
* Introduces the option --override-nexthop, setting it to true will make
advertised next hop for the routers to the peers will be automatically
selected to be appropriate reachable local IP. This will be overrider
any next-hop set for the routes in the RIB. Kube-router by defauly set
the next-hop to `node IP` which is not correct in case of nodes with
multiple interfaces and use differnt interaces for differect external
peers.

Fixes #480

* add next-hop-self documentation
2018-08-13 20:12:55 +05:30
JuanJo Ciarlante
b76d22f0d8 [jjo] ipAddrDel(): also delete VIP local rt addition (#514) 2018-08-13 18:21:30 +05:30
Murali Reddy
624c74f865
issue-385: make it optional on which ip address BGP server listens (#473)
* introduces per node anntation kube-router.io/bgp-local-addresses to configure IP address on which BGP server should lister

* docs
2018-08-13 17:47:23 +05:30