Skip to content

Commit 025a11d

Browse files
fabianonunesoktalz
authored andcommitted
BUG/MINOR: avoid hard restarts when using a Global CRD
When using a global CRD, every state change triggers a hard restart on HAProxy (even a simple pod scale): ```text 2022/08/03 16:20:49 DEBUG global.go:81 Global config updated: [TuneOptions: <nil pointer> != models.GlobalTuneOptions] Restart required ``` When synchronizing a `core.haproxy.org.Global` resource, the comparison with the corresponding settings in the HAProxy will always fail, because the `TuneOptions` attribute of an initialized `models.Global` is a `<nil pointer>` and the corresponding value returned by HAProxy is an empty `models.GlobalTuneOptions`. This PR sets an empty `models.GlobalTuneOptions` as default value of `.TuneOptions` attribute to prevent unnecessary restarts.
1 parent 000976f commit 025a11d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/haproxy/env/defaults.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ func SetGlobal(global *models.Global, logTargets *models.LogTargets, env Env) {
4545
if global.SslDefaultBindOptions == "" {
4646
global.SslDefaultBindOptions = "no-sslv3 no-tls-tickets no-tlsv10"
4747
}
48+
if global.TuneOptions == nil {
49+
global.TuneOptions = &models.GlobalTuneOptions{}
50+
}
4851
if len(*logTargets) == 0 {
4952
*logTargets = []*models.LogTarget{{
5053
Index: utils.PtrInt64(0),

0 commit comments

Comments
 (0)