fix: Fix broken `trackLogs` functionality in Kubedog tracker

When using helmfile with the following setup

```
releases:
  - name: my-app
    chart: ./mychart
    trackMode: kubedog
    trackLogs: true
    trackFailOnError: true
```

We don't actually see any logs from the container being printed.

This is because when building the options for the Kubedog tracker, we never
specify `SaveLogsOnlyForNumberOfReplicas` which means this defaults to 0.

Looking at the logic in `pkg/tracker/deployment/tracker.go` we see

```
ignoreLogs := job.ignoreLogs || job.savingLogsReplicas >= job.SaveLogsOnlyForNumberOfReplicas
```

With job.SaveLogsOnlyForNumberOfReplicas always defaulting to 0, this will always ignore logs

This change sets it to a reasonable default of tracking logs from up to 10 pods.

Signed-off-by: Graeme Gillies <ggillies@gitlab.com>
This commit is contained in:
Graeme Gillies 2026-06-10 10:10:22 +10:00 committed by yxxhero
parent f4686027ff
commit 9e4577cbc3
1 changed files with 4 additions and 0 deletions

View File

@ -238,6 +238,10 @@ func (t *Tracker) TrackResources(ctx context.Context, resources []*resource.Reso
IgnoreLogs: !t.trackOptions.Logs,
}
if t.trackOptions.Logs {
opts.SaveLogsOnlyForNumberOfReplicas = 10
}
var wg sync.WaitGroup
errCh := make(chan error, len(targets))