Skip to content

Commit e37fc50

Browse files
committed
add flag to poenable rt forward ting of he loadbalancer ports
Change-Id: Ide7ec2da641da3ec0f7c51413a692c356d65bf56
1 parent d3563f5 commit e37fc50

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

cmd/app.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ import (
2121
)
2222

2323
var (
24-
flagV int
25-
enableLogDump bool
26-
logDumpDir string
24+
flagV int
25+
enableLogDump bool
26+
logDumpDir string
27+
enableLBPortMapping bool
2728
)
2829

2930
func init() {
3031
flag.IntVar(&flagV, "v", 2, "Verbosity level")
3132
flag.BoolVar(&enableLogDump, "enable-log-dumping", false, "store logs to a temporal directory or to the directory specified using the logs-dir flag")
3233
flag.StringVar(&logDumpDir, "logs-dir", "", "store logs to the specified directory")
34+
flag.BoolVar(&enableLBPortMapping, "enable-lb-port-mapping", false, "enable port-mapping on the load balancer ports")
3335

3436
flag.Usage = func() {
3537
fmt.Fprint(os.Stderr, "Usage: cloud-provider-kind [options]\n\n")
@@ -106,6 +108,11 @@ func Main() {
106108
config.DefaultConfig.LoadBalancerConnectivity = config.Tunnel
107109
}
108110

111+
// flag overrides autodetection
112+
if enableLBPortMapping {
113+
config.DefaultConfig.LoadBalancerConnectivity = config.Portmap
114+
}
115+
109116
// default control plane connectivity to portmap, it will be
110117
// overriden if the first cluster added detects direct
111118
// connecitivity

pkg/loadbalancer/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ func (s *Server) createLoadBalancer(clusterName string, service *v1.Service, ima
220220
}...)
221221
}
222222

223-
if s.tunnelManager != nil {
223+
if s.tunnelManager != nil ||
224+
config.DefaultConfig.LoadBalancerConnectivity == config.Portmap {
224225
// Forward the Service Ports to the host so they are accessible on Mac and Windows
225226
for _, port := range service.Spec.Ports {
226227
if port.Protocol != v1.ProtocolTCP && port.Protocol != v1.ProtocolUDP {

0 commit comments

Comments
 (0)