Skip built-in k8s services in HAProxy config

Builtin k8s services "kubernetes" and "kubernetes-ro" caused port conflicts with
installed applications if they use ports 80 and/or 43

Change-Id: Ibf7be47d0f63dffeae7553dc3ffe9f1903ccce8f
Closes-Bug: #1444213
This commit is contained in:
Stan Lagun 2015-04-15 03:35:37 +03:00
parent a855e9a879
commit c4c92bf152

View File

@ -8,10 +8,12 @@ defaults
{{range $svc := ls "/registry/services/endpoints/default"}}
{{$se := printf "/registry/services/endpoints/default/%s" $svc }}{{$ss := printf "/registry/services/specs/default/%s" $svc }}
{{$seKey := get $se}}{{$ssKey := get $ss}}{{$seJson := json $seKey.Value}}{{$ssJson := json $ssKey.Value}}
listen {{base $svc}} 0.0.0.0:{{$ssJson.port}}
{{$seKey := get $se}}{{$ssKey := get $ss}}{{$seJson := json $seKey.Value}}{{$ssJson := json $ssKey.Value}}{{$baseSvc := base $svc}}
{{if and (ne "kubernetes" $baseSvc) (ne "kubernetes-ro" $baseSvc)}}
listen {{$baseSvc}} 0.0.0.0:{{$ssJson.port}}
mode tcp
balance leastconn
{{range $index, $endpoint := $seJson.endpoints}}
server svr{{$index}} {{$endpoint}}{{end}}
{{end}}
{{end}}{{end}}