Skip to content

Commit

Permalink
Deduplicate API warnings so they are only logged once
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Watts <[email protected]>
  • Loading branch information
jbw976 committed Jun 2, 2023
1 parent 9abbcf2 commit c0f03f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/crossplane/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ package core
import (
"net/http"
"net/http/pprof"
"os"
"path/filepath"
"time"

"github.com/alecthomas/kong"
"github.com/google/go-containerregistry/pkg/name"
"github.com/spf13/afero"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/leaderelection/resourcelock"
ctrl "sigs.k8s.io/controller-runtime"

Expand Down Expand Up @@ -136,6 +138,11 @@ func (c *startCommand) Run(s *runtime.Scheme, log logging.Logger) error { //noli
return errors.Wrap(err, "Cannot get config")
}

cfg.WarningHandler = rest.NewWarningWriter(os.Stderr, rest.WarningWriterOptions{
// Warnings from API requests should be deduplicated so they are only logged once
Deduplicate: true,
})

mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, c.MaxReconcileRate), ctrl.Options{
Scheme: s,
SyncPeriod: &c.SyncInterval,
Expand Down

0 comments on commit c0f03f9

Please sign in to comment.