Problem
Interactively, topf upgrade emits one slog line per event:
time=... level=INFO msg=drain command=upgrade node=... message="evicting pod dielinke/datastorewriter-..."
time=... level=INFO msg=drain command=upgrade node=... message="evicting pod kube-system/hubble-ui-..."
time=... level=INFO msg=drain command=upgrade node=... message="evicting pod cert-manager/cert-manager-webhook-..."
talosctl upgrade shows the same information as a colorized, in-place updating status line with a spinner. For interactive use that is much easier to follow, while the slog stream is the right thing for CI.
Current state
topf already depends on github.com/siderolabs/talos/pkg/reporter, but only uses the reporter.Update type as a callback parameter and forwards each update to slog:
uncordonReport := func(u reporter.Update) {
logger.Info("uncordon", "k8s_node", k8sNodeName, "message", u.Message)
}
reporter.New is never constructed.
talosctl builds one reporter per run and threads it through every phase:
rep := reporter.New(reporter.WithOutputMode(upgradeCmdFlags.progress.Value()))
...
imagePullInternal(ctx, c, containerdInstance, nodes, upgradeCmdFlags.upgradeImage, rep)
upgradeInternal(ctx, c, containerdInstance, nodes, upgradeCmdFlags.upgradeImage, rep)
drainNodes(ctx, c, nodes, upgradeCmdFlags.drainTimeout, rep)
uncordonNodes(ctx, c, nodeNames, upgradeCmdFlags.timeout, rep)
rebootInternal(upgradeCmdFlags.wait, upgradeCmdFlags.debug, upgradeCmdFlags.timeout, rep, opts...)
Proposal
Construct a reporter.Reporter per run and report from topf's own phases (pullInstallerImage, runUpgrade, drain/uncordon, reboot, Stabilize), keeping slog for the non-TTY case.
reporter.OutputModeAuto already does the detection (isatty.IsTerminal(os.Stderr.Fd())), so CI output stays plain with no extra work. talosctl exposes the choice as --progress AUTO|PLAIN.
Worth noting this is more than swapping a sink: topf implements the upgrade phases itself rather than calling talosctl's internals, so each phase would need to report into it.
Possibly related to #133.
Problem
Interactively,
topf upgradeemits one slog line per event:talosctl upgradeshows the same information as a colorized, in-place updating status line with a spinner. For interactive use that is much easier to follow, while the slog stream is the right thing for CI.Current state
topf already depends on
github.com/siderolabs/talos/pkg/reporter, but only uses thereporter.Updatetype as a callback parameter and forwards each update to slog:reporter.Newis never constructed.talosctl builds one reporter per run and threads it through every phase:
Proposal
Construct a
reporter.Reporterper run and report from topf's own phases (pullInstallerImage,runUpgrade, drain/uncordon, reboot,Stabilize), keeping slog for the non-TTY case.reporter.OutputModeAutoalready does the detection (isatty.IsTerminal(os.Stderr.Fd())), so CI output stays plain with no extra work. talosctl exposes the choice as--progress AUTO|PLAIN.Worth noting this is more than swapping a sink: topf implements the upgrade phases itself rather than calling talosctl's internals, so each phase would need to report into it.
Possibly related to #133.