@@ -177,6 +177,10 @@ func (c *HAProxyController) updateHAProxy() {
177177
178178 fs .Writer .WaitUntilWritesDone ()
179179
180+ if ! c .ready {
181+ c .setToReady ()
182+ }
183+
180184 err = c .haproxy .APICommitTransaction ()
181185 if err != nil {
182186 logger .Error ("unable to Sync HAProxy configuration !!" )
@@ -195,10 +199,6 @@ func (c *HAProxyController) updateHAProxy() {
195199 return
196200 }
197201
198- if ! c .ready {
199- c .setToReady ()
200- }
201-
202202 if instance .NeedReload () {
203203 fs .RunDelayedFuncs ()
204204 if err = c .haproxy .Service ("reload" ); err != nil {
@@ -220,41 +220,35 @@ func (c *HAProxyController) updateHAProxy() {
220220// setToRready exposes readiness endpoint
221221func (c * HAProxyController ) setToReady () {
222222 healthzPort := c .osArgs .HealthzBindPort
223- logger .Panic (c .clientAPIClosure (func () error {
224- return c .haproxy .FrontendBindCreate ("healthz" ,
223+ logger .Panic (c .haproxy .FrontendBindCreate ("healthz" ,
224+ models.Bind {
225+ BindParams : models.BindParams {
226+ Name : "v4" ,
227+ Thread : c .osArgs .HealthzBindThread ,
228+ },
229+ Address : fmt .Sprintf ("0.0.0.0:%d" , healthzPort ),
230+ }))
231+ if ! c .osArgs .DisableIPV6 {
232+ logger .Panic (c .haproxy .FrontendBindCreate ("healthz" ,
225233 models.Bind {
226234 BindParams : models.BindParams {
227- Name : "v4" ,
235+ Name : "v6" ,
236+ V4v6 : true ,
228237 Thread : c .osArgs .HealthzBindThread ,
229238 },
230- Address : fmt .Sprintf ("0.0.0.0:%d" , healthzPort ),
231- })
232- }))
233- if ! c .osArgs .DisableIPV6 {
234- logger .Panic (c .clientAPIClosure (func () error {
235- return c .haproxy .FrontendBindCreate ("healthz" ,
236- models.Bind {
237- BindParams : models.BindParams {
238- Name : "v6" ,
239- V4v6 : true ,
240- Thread : c .osArgs .HealthzBindThread ,
241- },
242- Address : fmt .Sprintf (":::%d" , healthzPort ),
243- })
244- }))
239+ Address : fmt .Sprintf (":::%d" , healthzPort ),
240+ }))
245241 }
246242
247- logger .Panic (c .clientAPIClosure (func () error {
248- return c .haproxy .FrontendBindCreate ("stats" ,
249- models.Bind {
250- BindParams : models.BindParams {
251- Name : "stats" ,
252- Thread : c .osArgs .StatsBindThread ,
253- },
254- Address : fmt .Sprintf ("*:%d" , c .osArgs .StatsBindPort ),
243+ logger .Panic (c .haproxy .FrontendBindCreate ("stats" ,
244+ models.Bind {
245+ BindParams : models.BindParams {
246+ Name : "stats" ,
247+ Thread : c .osArgs .StatsBindThread ,
255248 },
256- )
257- }))
249+ Address : fmt .Sprintf ("*:%d" , c .osArgs .StatsBindPort ),
250+ },
251+ ))
258252
259253 logger .Debugf ("healthz frontend exposed for readiness probe" )
260254 cm := c .store .ConfigMaps .Main
0 commit comments