@@ -174,6 +174,10 @@ func (c *HAProxyController) updateHAProxy() {
174
174
logger .Error (handler .Update (c .store , c .haproxy , c .annotations ))
175
175
}
176
176
177
+ if ! c .ready {
178
+ c .setToReady ()
179
+ }
180
+
177
181
err = c .haproxy .APICommitTransaction ()
178
182
if err != nil {
179
183
logger .Error ("unable to Sync HAProxy configuration !!" )
@@ -192,10 +196,6 @@ func (c *HAProxyController) updateHAProxy() {
192
196
return
193
197
}
194
198
195
- if ! c .ready {
196
- c .setToReady ()
197
- }
198
-
199
199
if instance .NeedReload () {
200
200
if err = c .haproxy .Service ("reload" ); err != nil {
201
201
logger .Error (err )
@@ -213,38 +213,32 @@ func (c *HAProxyController) updateHAProxy() {
213
213
// setToRready exposes readiness endpoint
214
214
func (c * HAProxyController ) setToReady () {
215
215
healthzPort := c .osArgs .HealthzBindPort
216
- logger .Panic (c .clientAPIClosure (func () error {
217
- return c .haproxy .FrontendBindCreate ("healthz" ,
216
+ logger .Panic (c .haproxy .FrontendBindCreate ("healthz" ,
217
+ models.Bind {
218
+ BindParams : models.BindParams {
219
+ Name : "v4" ,
220
+ },
221
+ Address : fmt .Sprintf ("0.0.0.0:%d" , healthzPort ),
222
+ }))
223
+ if ! c .osArgs .DisableIPV6 {
224
+ logger .Panic (c .haproxy .FrontendBindCreate ("healthz" ,
218
225
models.Bind {
219
226
BindParams : models.BindParams {
220
- Name : "v4" ,
227
+ Name : "v6" ,
228
+ V4v6 : true ,
221
229
},
222
- Address : fmt .Sprintf ("0.0.0.0:%d" , healthzPort ),
223
- })
224
- }))
225
- if ! c .osArgs .DisableIPV6 {
226
- logger .Panic (c .clientAPIClosure (func () error {
227
- return c .haproxy .FrontendBindCreate ("healthz" ,
228
- models.Bind {
229
- BindParams : models.BindParams {
230
- Name : "v6" ,
231
- V4v6 : true ,
232
- },
233
- Address : fmt .Sprintf (":::%d" , healthzPort ),
234
- })
235
- }))
230
+ Address : fmt .Sprintf (":::%d" , healthzPort ),
231
+ }))
236
232
}
237
233
238
- logger .Panic (c .clientAPIClosure (func () error {
239
- return c .haproxy .FrontendBindCreate ("stats" ,
240
- models.Bind {
241
- BindParams : models.BindParams {
242
- Name : "stats" ,
243
- },
244
- Address : fmt .Sprintf ("*:%d" , c .osArgs .StatsBindPort ),
234
+ logger .Panic (c .haproxy .FrontendBindCreate ("stats" ,
235
+ models.Bind {
236
+ BindParams : models.BindParams {
237
+ Name : "stats" ,
245
238
},
246
- )
247
- }))
239
+ Address : fmt .Sprintf ("*:%d" , c .osArgs .StatsBindPort ),
240
+ },
241
+ ))
248
242
249
243
logger .Debugf ("healthz frontend exposed for readiness probe" )
250
244
cm := c .store .ConfigMaps .Main
0 commit comments