Skip to content

Commit

Permalink
fix: redirect warnings in manifest apply k8s client
Browse files Browse the repository at this point in the history
These warnings by default go to stderr, so to server console and flood
console with messages. Send warnings to the logger, so they stay
within controller-runtime logs.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Feb 20, 2021
1 parent c37f2c6 commit e355d4f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/app/machined/pkg/controllers/k8s/manifest_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func (ctrl *ManifestApplyController) Run(ctx context.Context, r controller.Runti
return fmt.Errorf("error loading kubeconfig: %w", err)
}

kubeconfig.WarningHandler = rest.NewWarningWriter(logger.Writer(), rest.WarningWriterOptions{
Deduplicate: true,
})

dc, err = discovery.NewDiscoveryClientForConfig(kubeconfig)
if err != nil {
return fmt.Errorf("error building discovery client: %w", err)
Expand Down

0 comments on commit e355d4f

Please sign in to comment.