Skip to content

Commit 500360c

Browse files
committed
BUG/MINOR: make sure old frontend snippet still works in all cases
1 parent 78b7142 commit 500360c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/annotations/cfgSnippet.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,16 @@ func UpdateFrontendCfgSnippet(api api.HAProxyClient, frontends ...string) (updat
274274
newData = append(newData, v.value...)
275275
updated = append(updated, v.updated...)
276276
}
277-
newData = append(newData, "### custom annotations end ###")
278-
data = &cfgData{value: append(newData, data.value...)}
277+
if len(customData) > 0 {
278+
newData = append(newData, "### custom annotations end ###")
279+
}
280+
if data != nil && len(data.value) > 0 {
281+
data = &cfgData{value: append(newData, data.value...)}
282+
}
283+
}
284+
if data == nil {
285+
continue
279286
}
280-
281287
err = api.FrontendCfgSnippetSet(ft, data.value)
282288
if err != nil {
283289
return updated, err

0 commit comments

Comments
 (0)