39 Commits

Author SHA1 Message Date
Murali Reddy
8ce5e4fe3d
Fix potential issues in DSR due to Golang limitations in switching network namespaces and add verbose logging (#258)
Fixes #248

https://www.weave.works/blog/linux-namespaces-and-go-don-t-mix
docker/libnetwork#1113
https://groups.google.com/forum/#!topic/golang-dev/6G4rq0DCKfo/discussion
2017-12-24 22:28:36 +05:30
Murali Reddy
76ea8c01a2
fix TCP vs 6 string comparision in publishMetrics (#257) 2017-12-24 15:08:44 +05:30
Murali Reddy
22f05e99fd
service prometheus metrics (#255) 2017-12-24 11:32:42 +05:30
Murali Reddy
d13339c6fa
IPVS sync services performnce improvement (#253)
During periodic sync of IPVS services there is a check if the required service
already existing in IPVS. For the check the list of currnet IPVS services are
read from IPVS. This is causing performance hit as number of services increases.

With this fix, Kube-router reads once from ipvs and use for further during service sync
2017-12-19 17:24:18 +05:30
David Robinson
5323b4b8a9 Fix --hairpin-mode=true (#243)
The option was not plumbed through to the controller.
2017-12-11 17:52:34 -06:00
Daniel Beal
75bdfa2a10 Fix --nodeport-bind-all-ip option so that it works (#217)
Works by configuring a IPVS service for all interface IPs found on the
system.

NOTE: Does not support IPv6 because I have not tested
2017-11-09 00:33:07 +05:30
Murali Reddy
28c5dd20ef
use table id instead of table name for custom routing tables (#215) 2017-11-08 07:35:47 +05:30
Murali Reddy
b180094836 set priority for custom routing tables so that, FWMARK packets are delivered locally
and for the rest of the traffic policy routing sets endpoints (dev kube-bridge) as
next hop for external IP's
2017-10-30 17:19:20 +05:30
Murali Reddy
5f425ebb89
Fixes direct server return on exteranl IP's (#210)
- add a route to exteranl ip in custom routing table to prevent martian packets
- switch between Masqurade and Tunnel for forwarding when DSR in disabled and enabled
2017-10-30 11:37:39 +05:30
Murali Reddy
6a3fadae05 Direct Server Return Fixes (#209)
as you annotate and remove DSR annotation, switch the IPVS server
type to tunneling to masqurade mode

also restrict preparing the pod for DSR only to the local pods
2017-10-27 13:40:44 +05:30
Murali Reddy
77f45e356b Use service annotations to choose IPVS scheduling method (#207)
Fixes #6
2017-10-25 11:38:50 +05:30
Murali Reddy
6d432681de support for direct server return (#204)
new annotation is added `kube-router.io/service.dsr=tunnel` to enable DSR

Fixes #40
2017-10-24 18:20:58 +05:30
Murali Reddy
ba7697b72e Support for Services with externalIPs (#201)
Fixes #26
2017-10-16 22:45:06 +05:30
Bryan Zubrod
342ea5ac9f Prevent masquerading pod -> NodeIP traffic (#174)
* Move getNodeIP logic to utils package

Remove redundant ipset lookups

utils.NewIPSet() does this for us.

* Don't masquerade pod -> nodeAddrsIPSet traffic

Previously with Pod egress enabled, this would get masqueraded.
This change also adds cleanup for said ipset.

* Enhanced cleanup of Pod egress, overlay networking

- Delete old/bad pod egress iptables rule(s) from old versions
- When pod egress or overlay are disabled, cleanup as needed

* Update IPSet.Sets to map type

* ipset enhancements

- Avoid providing method that would delete all ipset sets on a system
- New method DestroyAllWithin() destroys sets tracked by an IPSet
- Create() now handles cases where Sets/System state are not in sync
- Refresh() now handles leftover -temp set gracefully
- Swap() now uses ipset swap
- Delete() improved sync of Sets and system state
- Get() now validates if map element exists before trying
- etc

* Update routes controller to reflect ipset changes
2017-10-07 04:14:13 -05:00
bzub
a5a446a6ca Use forward domain notation for annotations
"kube-router.io/..."
This is in line with convention set by k8s upstream.
2017-10-05 22:18:18 -05:00
Bryan Zubrod
e19f2a69c2 BGP peer password auth, consistent configurations (#164)
* Add --peer-router-password option
Also:
- Consolodated NRC peer fields into a []config.NeighborConfig
  to store address, asn, and password for each peer.
- BREAKING: --peer-router and --peer-asn flags now take slices
  rather than strings.

* Add password auth node annotation for external peer

* Update documentation

New CLI flags and annotations
Renamed ones as well

* Consistent CLI flags, annotations, and peer config

BGP configs now all accept multiple values and are treated consistently.
Other refactoring was done as well.

* Stop bgpserver on peering errors to avoid listener leak

* Clarify BGP doc sections

Fix some typos
2017-09-24 23:21:12 -05:00
Bryan Zubrod
d433fa55ea Fix IPVS persistence flag (#160)
* Fix IPVS persistence flag

* Improve service proxy logging

* Fix Destination string

* Enhanced ipvs ServiceFlags handling
2017-09-13 21:24:00 -05:00
Murali Reddy
62900c7659 NodePort service listens on all ip/interfaces in case of kube-proxy. Currently kube-router listens only on node IP.
This fix introduces flag nodeport-bindon-all-ip with which you can have kube-proxy like behaviour. If not specified
only nodeIP will be open for connections.

Fixes #139
2017-09-07 14:31:34 +05:30
Murali Reddy
f6a5e239f0 fixing gofmt, go_vet, gocyclo, golint errors 2017-09-04 17:10:48 +05:30
Murali Reddy
020d93238e fixing gofmt, go_vet, gocyclo, golint errorswq 2017-09-04 14:49:45 +05:30
Murali Reddy
ed935a4d7a fix gofmt, go_vet, misspells 2017-09-02 00:29:35 +05:30
Bryan Zubrod
c81bfbb616 Enable pod egress masquerading by default (#111)
* Enable pod egress masquerading by default
- Adds flag "--enable-pod-egress" (default: true)
- Removes previously created iptables rule if option is changed to false
* Use an ipset to match Pod egress traffic to be masqueraded
* Set --cluster-cidr as depreciated flag
If set to anything, normal dynamic Pod egress masquerading is turned on.
* Use Replace else Add logic for updating export policy
Fixes errors logged due to existing statement in poliy.
2017-08-10 11:50:06 -05:00
Murali Reddy
7934759ac2 Randomize service endpoint addition when configuring destination on ipvs service
Fixes #99
2017-08-05 03:38:36 +05:30
Bryan Zubrod
9e75203598 Use libnetwork/ipvs instead of libipvs (#101)
* Use libnetwork/ipvs alternative
* PR image tag simplification
* Remove nested vendor directories
2017-08-04 14:07:57 -05:00
Murali Reddy
a86bc44ecc fix null pointer dereference during kube-router --cleanup-config
Fixes #79
2017-07-27 23:24:03 +05:30
Murali Reddy
ef66b01002 WIP prometheus metrics: add pps in and out per service backend 2017-07-20 01:01:38 +05:30
Murali Reddy
60482bcd4c WIP : Expose active/inactive connection to service backend as prometheus metrics
putting basic skelton framework to use prometheus

Fixes #5
2017-07-16 03:11:13 +05:30
Bryan Zubrod
a3bddf6ecd services-controller: Add LoadBalancer Service support (#53)
* Allow LoadBalancer Service type
* Update docs
2017-07-11 18:12:11 -05:00
Bryan Zubrod
e5b47ed139 NetworkServiceController: Add hairpin-mode support (#44)
* network_services_controller: Cosmetic updates
* Docs: Add hairpin-mode
* NSC: Add hairpin-mode support
* Reorder logic to ensure no hairpin rules without hairpin settings
* Fine-tune rules to include vport
* Fix delete rules logic/bugs
2017-07-07 00:23:17 -05:00
bzub
cb661f871c controller: - Replace panics with errors
- Add context to errors for debugging
            - Refactor init() code so ipset isn't required to run
              "kube-router --help" for example
2017-07-05 21:57:29 -05:00
Murali Reddy
29396f9662 add option '--hostname-override' to deal with cases where kubelet is launched
with --hostname-override flag

Fixes #23
2017-06-10 07:10:38 +05:30
Murali Reddy
4b3d1a31b0 re-use ipvs handle for add/delete ipvs service, servers and listing services and server
using ipvslib New() is causing system thread leak resulting in hitting GOLANG 10000 thread limit

Fixes #19, #24
2017-06-07 23:49:29 +05:30
Murali Reddy
d4f32978fb use NODE_NAME env variable to get the node object when running as daemon set
If NODE_NAME env is not set, fall back to hostname.

Partial fix towards #23 we still have issue where kube-router is run as agent
and kubelet is started with --hostname-overide flag
2017-06-07 02:28:21 +05:30
Murali Reddy
4531a915bb Handle both cases where node can be registered with master either
by host name or FQDN. kubelet can be started with --hostname-override with configurable value.
In AWS envirinment typcally its set FQDN obtained from the metda data. This fix ensures
we can deploy kube-router in case nodes are registered with FQDN

Fixes #17
2017-05-30 03:11:51 +05:30
Murali Reddy
89cdc2a318 Incorrect generation of unique service key when building service and endpoint maps
use spec.ports.name in the service manifest to uniqely generate service key used
internally to lookup services info and endpoints info maps

closes #3
2017-05-13 01:15:13 +05:30
Murali Reddy
7004632cb3 BUG 1: If service manifest has "SessionAffinity" set, then configure IPVS to provide session persistence
configure ipvs service configuration to provide persistence
2017-05-09 00:44:04 +05:30
Murali Reddy
231e5cee71 enable kube-router to be run as daemonset 2017-04-27 03:08:37 +05:30
Murali Reddy
a4e773bd91 edit README and handle external (outside from cluster) access to nodeport services
by masqurading the traffic so the return traffic from the pod hits the node before
going to the client
2017-04-18 03:37:46 +05:30
Murali Reddy
04a5cc033a base line version tested with kube 1.5.6, 1.6 2017-04-17 10:33:09 +05:30