Add a flag to specify address to bind the healthz server (#7541)
* Add a flag to specify address to bind the healthz server Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com> * Add healthz host to the helm chart Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com> * Apply suggestions from code review Co-authored-by: Ricardo Katz <rikatz@users.noreply.github.com> Co-authored-by: Ricardo Katz <rikatz@users.noreply.github.com>
This commit is contained in:
parent
66c2a716da
commit
4c4013904a
7 changed files with 19 additions and 4 deletions
|
|
@ -150,7 +150,7 @@ func main() {
|
|||
registerHealthz(nginx.HealthPath, ngx, mux)
|
||||
registerMetrics(reg, mux)
|
||||
|
||||
go startHTTPServer(conf.ListenPorts.Health, mux)
|
||||
go startHTTPServer(conf.HealthCheckHost, conf.ListenPorts.Health, mux)
|
||||
go ngx.Start()
|
||||
|
||||
handleSigterm(ngx, func(code int) {
|
||||
|
|
@ -324,9 +324,9 @@ func registerProfiler() {
|
|||
klog.Fatal(server.ListenAndServe())
|
||||
}
|
||||
|
||||
func startHTTPServer(port int, mux *http.ServeMux) {
|
||||
func startHTTPServer(host string, port int, mux *http.ServeMux) {
|
||||
server := &http.Server{
|
||||
Addr: fmt.Sprintf(":%v", port),
|
||||
Addr: fmt.Sprintf("%s:%v", host, port),
|
||||
Handler: mux,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
ReadHeaderTimeout: 10 * time.Second,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue