Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] Auto pick #6512: Limit rate of logging 'Wireguard is not supported' to fix log #6518: Fix construction of rateLimitedLogger in wireguard #6534

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions felix/wireguard/wireguard.go
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/projectcalico/calico/felix/routerule"
"github.com/projectcalico/calico/felix/routetable"
"github.com/projectcalico/calico/felix/timeshim"
lclogutils "github.com/projectcalico/calico/libcalico-go/lib/logutils"
)

const (
Expand Down Expand Up @@ -166,7 +167,8 @@ type Wireguard struct {
// The write proc sys function.
writeProcSys func(path, value string) error

logCtx *log.Entry
logCtx *log.Entry
rateLimitedLogger *lclogutils.RateLimitedLogger
}

func New(
Expand Down Expand Up @@ -282,6 +284,7 @@ func NewWithShims(
writeProcSys: writeProcSys,
opRecorder: opRecorder,
logCtx: logCtx,
rateLimitedLogger: lclogutils.NewRateLimitedLogger(lclogutils.OptInterval(4 * time.Hour)).WithFields(logCtx.Data),
}
}

Expand Down Expand Up @@ -661,7 +664,7 @@ func (w *Wireguard) Apply() (err error) {
}

if w.wireguardNotSupported {
w.logCtx.Info("Wireguard is not supported")
w.rateLimitedLogger.Info("Wireguard is not supported")
return
}

Expand Down