Detect port collision and allow custom configuration
This commit is contained in:
parent
24d78cae8e
commit
5fc8c4cfe9
3 changed files with 25 additions and 2 deletions
|
@ -145,6 +145,8 @@ type Configuration struct {
|
||||||
UpdateStatus bool
|
UpdateStatus bool
|
||||||
ElectionID string
|
ElectionID string
|
||||||
UpdateStatusOnShutdown bool
|
UpdateStatusOnShutdown bool
|
||||||
|
|
||||||
|
ControllerPorts ingress.ControllerPorts
|
||||||
}
|
}
|
||||||
|
|
||||||
// newIngressController creates an Ingress controller
|
// newIngressController creates an Ingress controller
|
||||||
|
|
|
@ -90,9 +90,14 @@ func NewIngressController(backend ingress.Controller) *GenericController {
|
||||||
`Force namespace isolation. This flag is required to avoid the reference of secrets or
|
`Force namespace isolation. This flag is required to avoid the reference of secrets or
|
||||||
configmaps located in a different namespace than the specified in the flag --watch-namespace.`)
|
configmaps located in a different namespace than the specified in the flag --watch-namespace.`)
|
||||||
|
|
||||||
UpdateStatusOnShutdown = flags.Bool("update-status-on-shutdown", true, `Indicates if the
|
updateStatusOnShutdown = flags.Bool("update-status-on-shutdown", true, `Indicates if the
|
||||||
ingress controller should update the Ingress status IP/hostname when the controller
|
ingress controller should update the Ingress status IP/hostname when the controller
|
||||||
is being stopped. Default is true`)
|
is being stopped. Default is true`)
|
||||||
|
|
||||||
|
httpPort = flags.Int("http-port", 80, `Indicates the TCP port to use for HTTP traffic`)
|
||||||
|
httpsPort = flags.Int("https-port", 443, `Indicates the TCP port to use for HTTPS traffic`)
|
||||||
|
|
||||||
|
statusPort = flags.Int("https-port", 18080, `Indicates the TCP port to use for exposing the status of the backend`)
|
||||||
)
|
)
|
||||||
|
|
||||||
flags.AddGoFlagSet(flag.CommandLine)
|
flags.AddGoFlagSet(flag.CommandLine)
|
||||||
|
@ -151,6 +156,13 @@ func NewIngressController(backend ingress.Controller) *GenericController {
|
||||||
glog.Errorf("Failed to mkdir SSL directory: %v", err)
|
glog.Errorf("Failed to mkdir SSL directory: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ports := ingress.ControllerPorts{
|
||||||
|
HTTP: *httpPort,
|
||||||
|
HTTPS: *httpsPort,
|
||||||
|
Health: *healthzPort,
|
||||||
|
Status: *statusPort,
|
||||||
|
}
|
||||||
|
|
||||||
config := &Configuration{
|
config := &Configuration{
|
||||||
UpdateStatus: *updateStatus,
|
UpdateStatus: *updateStatus,
|
||||||
ElectionID: *electionID,
|
ElectionID: *electionID,
|
||||||
|
@ -168,7 +180,8 @@ func NewIngressController(backend ingress.Controller) *GenericController {
|
||||||
PublishService: *publishSvc,
|
PublishService: *publishSvc,
|
||||||
Backend: backend,
|
Backend: backend,
|
||||||
ForceNamespaceIsolation: *forceIsolation,
|
ForceNamespaceIsolation: *forceIsolation,
|
||||||
UpdateStatusOnShutdown: *UpdateStatusOnShutdown,
|
UpdateStatusOnShutdown: *updateStatusOnShutdown,
|
||||||
|
ControllerPorts: ports,
|
||||||
}
|
}
|
||||||
|
|
||||||
ic := newIngressController(config)
|
ic := newIngressController(config)
|
||||||
|
|
|
@ -320,3 +320,11 @@ type L4Backend struct {
|
||||||
Namespace string `json:"namespace"`
|
Namespace string `json:"namespace"`
|
||||||
Protocol api.Protocol `json:"protocol"`
|
Protocol api.Protocol `json:"protocol"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ControllerPorts describe the ports required to run the Ingress controller
|
||||||
|
type ControllerPorts struct {
|
||||||
|
HTTP int
|
||||||
|
HTTPS int
|
||||||
|
Status int
|
||||||
|
Health int
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue