Skip to content

Commit c6400c9

Browse files
authored
Feature/allow vip sharing (#137)
* implement sharing of loadblancer IPs Add option "allow-share-<namespace>", following the behavior of the ranges. If all used ports of a service are available on a 'used' loadblancer IP it assigns the service to this IP (if allow-share is true). Signed-off-by: Thomas Schätzlein <[email protected]>
1 parent 64d9b38 commit c6400c9

File tree

6 files changed

+508
-137
lines changed

6 files changed

+508
-137
lines changed

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The `kube-vip-cloud-provider` will only implement the `loadBalancer` functionali
2121
- Support for dualstack via the annotation: `kube-vip.io/loadbalancerIPs: 192.168.10.10,2001:db8::1`
2222
- Support ascending and descending search order when allocating IP from pool or range by setting search-order=desc
2323
- Support loadbalancerClass `kube-vip.io/kube-vip-class`
24+
- Support assigning multiple services on single VIP (IPv4 only, optional)
2425

2526
## Installing the `kube-vip-cloud-provider`
2627

@@ -140,6 +141,28 @@ Set the CIDR to `0.0.0.0/32`, that will make the controller to give all _LoadBal
140141

141142
If users only want kube-vip-cloud-provider to allocate ip for specific set of services, they can pass `KUBEVIP_ENABLE_LOADBALANCERCLASS: true` as an environment variable to kube-vip-cloud-provider. kube-vip-cloud-provider will only allocate ip to service with `spec.loadBalancerClass: kube-vip.io/kube-vip-class`.
142143

144+
## Allow multiple IPv4 services to share a VIP
145+
146+
When enabled, kube-vip-cloud-provider tries to assign services to already used VIPs if the ports of the services
147+
do not overlap.
148+
If you want to enable VIP-sharing between services, you can set `allow-shared`-`namespace` to true. It follows the same rules as
149+
the configuration for global and namespace pools.
150+
151+
Example-object with sharing enabled for namespace `development`:
152+
```
153+
$ kubectl get configmap -n kube-system kubevip -o yaml
154+
155+
apiVersion: v1
156+
kind: ConfigMap
157+
metadata:
158+
name: kubevip
159+
namespace: kube-system
160+
data:
161+
cidr-default: 192.168.0.200/29
162+
cidr-development: 192.168.0.210/29
163+
allow-share-development: true
164+
```
165+
143166

144167
## Debugging
145168

example/configmap/0.1.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ metadata:
44
name: kubevip
55
namespace: kube-system
66
data:
7+
allow-share-global: true
78
cidr-default: 192.168.0.200/29
89
cidr-plunder: 192.168.0.210/29
10+
allow-share-plunder: false
911
cidr-testing: 192.168.0.220/29

0 commit comments

Comments
 (0)