Add healthcheck timeout as CLA
This commit is contained in:
parent
9fe500319c
commit
9f2a0b6363
3 changed files with 9 additions and 4 deletions
|
@ -84,6 +84,8 @@ Takes the form "namespace/name".`)
|
||||||
Configured inside the NGINX status server. All requests received on the port
|
Configured inside the NGINX status server. All requests received on the port
|
||||||
defined by the healthz-port parameter are forwarded internally to this path.`)
|
defined by the healthz-port parameter are forwarded internally to this path.`)
|
||||||
|
|
||||||
|
healthCheckTimeout = flags.Duration("health-check-timeout", 10, `Time limit, in seconds, for a probe to health-check-path to succeed.`)
|
||||||
|
|
||||||
updateStatus = flags.Bool("update-status", true,
|
updateStatus = flags.Bool("update-status", true,
|
||||||
`Update the load-balancer status of Ingress objects this controller satisfies.
|
`Update the load-balancer status of Ingress objects this controller satisfies.
|
||||||
Requires setting the publish-service parameter to a valid Service reference.`)
|
Requires setting the publish-service parameter to a valid Service reference.`)
|
||||||
|
@ -217,6 +219,7 @@ Feature backed by OpenResty Lua libraries. Requires that OCSP stapling is not en
|
||||||
ConfigMapName: *configMap,
|
ConfigMapName: *configMap,
|
||||||
DefaultSSLCertificate: *defSSLCertificate,
|
DefaultSSLCertificate: *defSSLCertificate,
|
||||||
DefaultHealthzURL: *defHealthzURL,
|
DefaultHealthzURL: *defHealthzURL,
|
||||||
|
HealthCheckTimeout: *healthCheckTimeout,
|
||||||
PublishService: *publishSvc,
|
PublishService: *publishSvc,
|
||||||
PublishStatusAddress: *publishStatusAddress,
|
PublishStatusAddress: *publishStatusAddress,
|
||||||
ForceNamespaceIsolation: *forceIsolation,
|
ForceNamespaceIsolation: *forceIsolation,
|
||||||
|
|
|
@ -38,7 +38,8 @@ func (n NGINXController) Name() string {
|
||||||
func (n *NGINXController) Check(_ *http.Request) error {
|
func (n *NGINXController) Check(_ *http.Request) error {
|
||||||
|
|
||||||
url := fmt.Sprintf("http://127.0.0.1:%v%v", n.cfg.ListenPorts.Status, ngxHealthPath)
|
url := fmt.Sprintf("http://127.0.0.1:%v%v", n.cfg.ListenPorts.Status, ngxHealthPath)
|
||||||
statusCode, err := simpleGet(url)
|
timeout := n.cfg.HealthCheckTimeout
|
||||||
|
statusCode, err := simpleGet(url, timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -48,7 +49,7 @@ func (n *NGINXController) Check(_ *http.Request) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
url = fmt.Sprintf("http://127.0.0.1:%v/is-dynamic-lb-initialized", n.cfg.ListenPorts.Status)
|
url = fmt.Sprintf("http://127.0.0.1:%v/is-dynamic-lb-initialized", n.cfg.ListenPorts.Status)
|
||||||
statusCode, err = simpleGet(url)
|
statusCode, err = simpleGet(url, timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -75,9 +76,9 @@ func (n *NGINXController) Check(_ *http.Request) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func simpleGet(url string) (int, error) {
|
func simpleGet(url string, timeout time.Duration) (int, error) {
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Timeout: 10 * time.Second,
|
Timeout: timeout * time.Second,
|
||||||
Transport: &http.Transport{DisableKeepAlives: true},
|
Transport: &http.Transport{DisableKeepAlives: true},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ type Configuration struct {
|
||||||
ForceNamespaceIsolation bool
|
ForceNamespaceIsolation bool
|
||||||
|
|
||||||
DefaultHealthzURL string
|
DefaultHealthzURL string
|
||||||
|
HealthCheckTimeout time.Duration
|
||||||
DefaultSSLCertificate string
|
DefaultSSLCertificate string
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
|
|
Loading…
Reference in a new issue