Skip to content

Commit 98d2b90

Browse files
fabianonunesoktalz
authored andcommitted
BUG/MINOR: prevents unecessary restart when using multiple syslog servers
When using more than one syslog server, the algorithm for comparing log targets never succeeds, because the conversion of each `syslog-server` annotation's line into a `models.LogTarget` will always set the `.Index` field equal to 0. In this scenario, any change causes a restart because `lg` and `newLg` will never be equal (either because of the slice order, or because of the different `.Index` fields)
1 parent fe28b69 commit 98d2b90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/annotations/global/syslogServer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (a *SyslogServers) GetName() string {
3535
func (a *SyslogServers) Process(k store.K8s, annotations ...map[string]string) error {
3636
input := common.GetValue(a.GetName(), annotations...)
3737
a.stdout = false
38-
for _, syslogLine := range strings.Split(input, "\n") {
38+
for i, syslogLine := range strings.Split(input, "\n") {
3939
if syslogLine == "" {
4040
continue
4141
}
@@ -56,7 +56,7 @@ func (a *SyslogServers) Process(k store.K8s, annotations ...map[string]string) e
5656
}
5757
}
5858
// populate annotation data
59-
logTarget := models.LogTarget{Index: utils.PtrInt64(0)}
59+
logTarget := models.LogTarget{Index: utils.PtrInt64(int64(i))}
6060
address, ok := logParams["address"]
6161
if !ok {
6262
return fmt.Errorf("incorrect syslog Line: no address param in '%s'", syslogLine)

0 commit comments

Comments
 (0)