Fix ports collision when hostNetwork=true (#4617)
This commit is contained in:
parent
9ecec0de63
commit
d5d2b4037c
5 changed files with 40 additions and 8 deletions
|
|
@ -261,17 +261,21 @@ func (n *NGINXController) getStreamServices(configmapName string, proto apiv1.Pr
|
|||
klog.Errorf("Error getting ConfigMap %q: %v", configmapName, err)
|
||||
return []ingress.L4Service{}
|
||||
}
|
||||
|
||||
var svcs []ingress.L4Service
|
||||
var svcProxyProtocol ingress.ProxyProtocol
|
||||
|
||||
rp := []int{
|
||||
n.cfg.ListenPorts.HTTP,
|
||||
n.cfg.ListenPorts.HTTPS,
|
||||
n.cfg.ListenPorts.SSLProxy,
|
||||
n.cfg.ListenPorts.Health,
|
||||
n.cfg.ListenPorts.Default,
|
||||
10255, // profiling port
|
||||
nginx.ProfilerPort,
|
||||
nginx.StatusPort,
|
||||
nginx.StreamPort,
|
||||
}
|
||||
|
||||
reserverdPorts := sets.NewInt(rp...)
|
||||
// svcRef format: <(str)namespace>/<(str)service>:<(intstr)port>[:<("PROXY")decode>:<("PROXY")encode>]
|
||||
for port, svcRef := range configmap.Data {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ import (
|
|||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// TODO: Check https://github.com/kubernetes/kubernetes/blob/master/pkg/master/ports/ports.go for ports already being used
|
||||
|
||||
// ProfilerPort port used by the ingress controller to expose the Go Profiler when it is enabled.
|
||||
var ProfilerPort = 10245
|
||||
|
||||
// TemplatePath path of the NGINX template
|
||||
var TemplatePath = "/etc/nginx/template/nginx.tmpl"
|
||||
|
||||
|
|
@ -38,7 +43,7 @@ var TemplatePath = "/etc/nginx/template/nginx.tmpl"
|
|||
var PID = "/tmp/nginx.pid"
|
||||
|
||||
// StatusPort port used by NGINX for the status server
|
||||
var StatusPort = 10256
|
||||
var StatusPort = 10246
|
||||
|
||||
// HealthPath defines the path used to define the health check location in NGINX
|
||||
var HealthPath = "/healthz"
|
||||
|
|
@ -51,7 +56,7 @@ var HealthCheckTimeout = 10 * time.Second
|
|||
var StatusPath = "/nginx_status"
|
||||
|
||||
// StreamPort defines the port used by NGINX for the NGINX stream configuration socket
|
||||
var StreamPort = 10257
|
||||
var StreamPort = 10247
|
||||
|
||||
// NewGetStatusRequest creates a new GET request to the internal NGINX status server
|
||||
func NewGetStatusRequest(path string) (int, []byte, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue