Repository navigation
add --track-logs-interval flag - #2807
Conversation
2ed4bbb to
690f949
Compare
|
@pznamensky is ready for review? |
Yes. Thanks. |
yxxhero
left a comment
There was a problem hiding this comment.
Reviewed in depth — no blockers found. The design is sound and the concurrency holds up.
What I verified (the non-obvious parts):
- Moving the final flush out of
progressPrinter.run()intoTrackResourcesis correct on every exit path: the<-printerDonejoin guarantees the printer goroutine has stopped before the flush, all log producers are joined via<-trackersDone, and the failure watchdog is read-only on the stores. - It's an improvement over the old code in two paths: previously a parent-context cancel skipped the final flush entirely, and on a tracker error the flush depended on which
selectcase the printer happened to pick. - Double-flush is harmless:
flushLogsis cursor-based (lastCounts) andflushProgressdedupes vialastStatus, so a log tick racingdonecan't duplicate output. time.NewTickercan never receive ≤ 0 (it panics): the> 0guards inhelmx.go/tracker.goplus theNewTrackOptionsdefault make theValidateConfigcheck pure UX, not panic prevention.- The
NewApplyOptions()switch incmd/apply.gois load-bearing — a zero-valuedApplyOptionswould make the flag default0and instantly fail the new validation. - Default-cadence behavior is preserved: previously logs flushed on both the progress tick and the logs tick (both 10s, started together); now only the logs tick — net effect identical.
Follow-up commit d797bce — pushed to address minor review nits, no behavior change:
defaultLogsIntervalmoved fromprinter.gotooptions.go, next to the field it defaults.logsIntervalnow flows through thenewProgressPrinterconstructor (zero falls back to the default) instead of a post-construction field assignment in the tracker — consistent with every other printer setting.TestNewTrackOptions/TestTrackOptions_Chaining_AllSettersnow coverLogsInterval/WithLogsInterval; addedTestTrackOptions_WithLogsIntervalmatching the per-setter test convention.- Added a negative-interval case to the validation tests —
< time.Secondalready rejected it, but the case documents intent. - Documented that
defaultTrackLogsIntervalinpkg/configis shared by sync and apply and mirrors kubedog's default.
Left as-is deliberately: no per-release trackLogsInterval setting (fine as a follow-up — trackTimeout/trackLogs already have per-release overrides), and validation firing even when kubedog tracking is disabled (strict but reasonable).
Thanks! The final-drain reasoning in the tracker comments is a nice touch — it made the review much easier.
Signed-off-by: pznamensky <[email protected]>
- 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 <[email protected]>
d797bce to
70491a1
Compare
yxxhero
left a comment
There was a problem hiding this comment.
Approving after a deep review — see my earlier comment review for the full analysis.
Verified in detail:
- The final-flush move from
progressPrinter.run()intoTrackResourcesis correct on every exit path: the<-printerDonejoin guarantees the printer goroutine has stopped before flushing, all log producers are joined via<-trackersDone, and the failure watchdog is read-only on the stores. It also fixes two pre-existing gaps where the final flush could be skipped (parent-context cancel, tracker-error race in the printer's select). - No panic path for
time.NewTicker(≤0 guarded at every layer); theValidateConfigcheck is pure UX. - Default 10s cadence preserved; zero-value fallback is consistent end-to-end.
- Minor nits (const placement, logsInterval via constructor, setter/default test coverage, negative-interval case) addressed in 70491a1 and verified intact after the rebase.
Thanks @pznamensky!
…#829) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [aqua:helmfile/helmfile](https://github.com/helmfile/helmfile) | tools | patch | `1.8.0` → `1.8.1` | --- ### Release Notes <details> <summary>helmfile/helmfile (aqua:helmfile/helmfile)</summary> ### [`v1.8.1`](https://github.com/helmfile/helmfile/releases/tag/v1.8.1) [Compare Source](helmfile/helmfile@v1.8.0...v1.8.1) #### What's Changed - feat: add HELMFILE\_DISABLE\_VALS env var to skip vals processing by [@​jimmyR](https://github.com/jimmyR) in [#​2471](helmfile/helmfile#2471) - build(deps): bump github.com/mattn/go-runewidth from 0.0.29 to 0.0.30 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2796](helmfile/helmfile#2796) - build(deps): bump golang.org/x/term from 0.45.0 to 0.46.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2795](helmfile/helmfile#2795) - build(deps): bump github.com/sashabaranov/go-openai from 1.42.0 to 1.42.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2792](helmfile/helmfile#2792) - fix: cancel kubedog-tracked helm subprocesses on SIGINT/SIGTERM by [@​vulragrag-star](https://github.com/vulragrag-star) in [#​2791](helmfile/helmfile#2791) - build(deps): bump github.com/hashicorp/go-getter/v2 from 2.2.3 to 2.2.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2793](helmfile/helmfile#2793) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.33.3 to 1.33.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2794](helmfile/helmfile#2794) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.111.0 to 1.113.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2797](helmfile/helmfile#2797) - build: update Go to 1.27.1 and modernize the codebase by [@​yxxhero](https://github.com/yxxhero) in [#​2798](helmfile/helmfile#2798) - build(deps): bump github.com/helmfile/chartify from 0.28.2 to 0.29.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2803](helmfile/helmfile#2803) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.33.4 to 1.33.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2801](helmfile/helmfile#2801) - build(deps): bump github.com/hashicorp/hcl/v2 from 2.24.0 to 2.25.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2802](helmfile/helmfile#2802) - feat: add per-release continue-on-error support by [@​Tsukoyachi](https://github.com/Tsukoyachi) in [#​2804](helmfile/helmfile#2804) - fix: remove partially extracted chart when helm pull fails by [@​schmidtjohannes](https://github.com/schmidtjohannes) in [#​2805](helmfile/helmfile#2805) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.113.1 to 1.113.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2808](helmfile/helmfile#2808) - build(deps): bump github.com/helmfile/vals from 0.46.1 to 0.47.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2806](helmfile/helmfile#2806) - ci: publish a signed packslip with each release by [@​jdx](https://github.com/jdx) in [#​2809](helmfile/helmfile#2809) - build(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.113.2 to 1.113.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2811](helmfile/helmfile#2811) - build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.33.5 to 1.33.6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2810](helmfile/helmfile#2810) - add --track-logs-interval flag by [@​pznamensky](https://github.com/pznamensky) in [#​2807](helmfile/helmfile#2807) - fix: drop leading dot from release condition error message by [@​Cayan](https://github.com/Cayan) in [#​2812](helmfile/helmfile#2812) #### New Contributors - [@​jimmyR](https://github.com/jimmyR) made their first contribution in [#​2471](helmfile/helmfile#2471) - [@​vulragrag-star](https://github.com/vulragrag-star) made their first contribution in [#​2791](helmfile/helmfile#2791) - [@​Tsukoyachi](https://github.com/Tsukoyachi) made their first contribution in [#​2804](helmfile/helmfile#2804) - [@​schmidtjohannes](https://github.com/schmidtjohannes) made their first contribution in [#​2805](helmfile/helmfile#2805) - [@​jdx](https://github.com/jdx) made their first contribution in [#​2809](helmfile/helmfile#2809) - [@​pznamensky](https://github.com/pznamensky) made their first contribution in [#​2807](helmfile/helmfile#2807) - [@​Cayan](https://github.com/Cayan) made their first contribution in [#​2812](helmfile/helmfile#2812) **Full Changelog**: <helmfile/helmfile@v1.8.0...v1.8.1> </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/London) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.hayden.moe/hayden/phoebe/pulls/829
Why
Kubedog prints captured pod logs on a fixed 10-second cadence, which can delay useful output while a deployment is still running. This addresses #2800.
What changed
--track-logs-intervaltoapplyandsync(default10s, minimum1s). It works with both--track-logsand the existing--track-failed-logsmode.Validation
Passed race tests for the affected packages,
make check,make check-modernize, andgolangci-lint run.AI disclosure
I used LLMs to write and test this change as I'm not familiar with golang.
So it might be more useful to use this PR as source of inspiration.
However I've tested this branch it in our deployment and it seems to be working fine.