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:
@@ -44,6 +44,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"tailscale.com/envknob"
|
||||
|
||||
"tailscale.com/client/local"
|
||||
"tailscale.com/client/tailscale"
|
||||
@@ -133,6 +134,14 @@ func main() {
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Operator log uploads can be opted-out using the "TS_NO_LOGS_NO_SUPPORT" environment variable.
|
||||
if !envknob.NoLogsNoSupport() {
|
||||
zlog = zlog.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
|
||||
return wrapZapCore(core, s.LogtailWriter())
|
||||
}))
|
||||
}
|
||||
|
||||
rOpts := reconcilerOpts{
|
||||
log: zlog,
|
||||
tsServer: s,
|
||||
|
||||
Reference in New Issue
Block a user