add --track-logs-interval flag (#2807)

* add --track-logs-interval flag

Signed-off-by: pznamensky <kompastver@gmail.com>

* address review nits: logsInterval plumbing and test coverage

- kubedog: move defaultLogsInterval next to TrackOptions in options.go,
  where the field it defaults lives
- kubedog: pass logsInterval through newProgressPrinter instead of a
  post-construction field assignment; zero falls back to the default
- kubedog: cover WithLogsInterval and the LogsInterval default in
  tracker tests
- config: document that defaultTrackLogsInterval is shared by sync and
  apply and mirrors kubedog's default
- config: add a negative-interval validation test case

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: pznamensky <kompastver@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
pznamensky
2026-09-30 08:30:21 +08:00
committed by GitHub
co-authored by yxxhero
parent 9263200ed7
commit 5ed585e223
17 changed files with 246 additions and 55 deletions
+2
View File
@@ -2125,6 +2125,7 @@ Do you really want to apply?
TrackTimeout: c.TrackTimeout(),
TrackLogs: c.TrackLogs(),
TrackFailedLogs: c.TrackFailedLogs(),
TrackLogsInterval: c.TrackLogsInterval(),
HelmStuckGrace: c.HelmStuckGrace(),
TrackFailOnError: c.TrackFailOnError(),
Description: c.Description(),
@@ -2622,6 +2623,7 @@ Do you really want to sync?
TrackTimeout: c.TrackTimeout(),
TrackLogs: c.TrackLogs(),
TrackFailedLogs: c.TrackFailedLogs(),
TrackLogsInterval: c.TrackLogsInterval(),
HelmStuckGrace: c.HelmStuckGrace(),
TrackFailOnError: c.TrackFailOnError(),
Description: c.Description(),
+6
View File
@@ -13,6 +13,7 @@ import (
"strings"
"sync"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/helmfile/vals"
@@ -2556,6 +2557,7 @@ type applyConfig struct {
trackMode string
trackTimeout int
trackLogs bool
trackLogsInterval time.Duration
trackFailOnError bool
// template-only options
@@ -2804,6 +2806,10 @@ func (a applyConfig) TrackFailedLogs() bool {
return false
}
func (a applyConfig) TrackLogsInterval() time.Duration {
return a.trackLogsInterval
}
func (a applyConfig) HelmStuckGrace() int {
return 0
}
+4
View File
@@ -1,6 +1,8 @@
package app
import (
"time"
"go.uber.org/zap"
"github.com/helmfile/helmfile/pkg/agent/llm"
@@ -102,6 +104,7 @@ type ApplyConfigProvider interface {
TrackTimeout() int
TrackLogs() bool
TrackFailedLogs() bool
TrackLogsInterval() time.Duration
HelmStuckGrace() int
TrackFailOnError() bool
@@ -146,6 +149,7 @@ type SyncConfigProvider interface {
TrackTimeout() int
TrackLogs() bool
TrackFailedLogs() bool
TrackLogsInterval() time.Duration
HelmStuckGrace() int
TrackFailOnError() bool