cmd/k8s-operator: send operator logs to tailscale (#17110)

This commit modifies the k8s operator to wrap its logger using the logtail
logger provided via the tsnet server. This causes any logs written by
the operator to make their way to Tailscale in the same fashion as
wireguard logs to be used by support.

This functionality can also be opted-out of entirely using the
"TS_NO_LOGS_NO_SUPPORT" environment variable.

Updates https://github.com/tailscale/corp/issues/32037

Signed-off-by: David Bond <davidsbond93@gmail.com>
This commit is contained in:
David Bond
2025-09-22 13:55:16 +01:00
committed by GitHub
parent 986b4d1b0b
commit cc1761e8d2
4 changed files with 48 additions and 14 deletions

View File

@@ -495,14 +495,14 @@ func (s *Server) TailscaleIPs() (ip4, ip6 netip.Addr) {
return ip4, ip6
}
// Logtailf returns a [logger.Logf] that outputs to Tailscale's logging service and will be only visible to Tailscale's
// LogtailWriter returns an [io.Writer] that writes to Tailscale's logging service and will be only visible to Tailscale's
// support team. Logs written there cannot be retrieved by the user. This method always returns a non-nil value.
func (s *Server) Logtailf() logger.Logf {
func (s *Server) LogtailWriter() io.Writer {
if s.logtail == nil {
return logger.Discard
return io.Discard
}
return s.logtail.Logf
return s.logtail
}
func (s *Server) getAuthKey() string {