Skip to content

Commit

Permalink
Merge c66b03f into 72ea3cd
Browse files Browse the repository at this point in the history
  • Loading branch information
valaparthvi authored Apr 13, 2023
2 parents 72ea3cd + c66b03f commit da41036
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/kclient/kclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package kclient

import (
"fmt"
"github.com/redhat-developer/odo/pkg/log"
"k8s.io/kubectl/pkg/util/term"
"strings"

"k8s.io/cli-runtime/pkg/genericclioptions"
Expand Down Expand Up @@ -127,6 +129,14 @@ func NewForConfig(config clientcmd.ClientConfig) (client *Client, err error) {
client.KubeClientConfig.QPS = defaultQPS
client.KubeClientConfig.Burst = defaultBurst

// This warning handler ensures that warnings are not duplicated
client.KubeClientConfig.WarningHandler = rest.NewWarningWriter(log.GetStderr(), rest.WarningWriterOptions{
// only print a given warning the first time we receive it
Deduplicate: true,
// highlight the output with color when the output supports it
Color: term.AllowsColorOutput(log.GetStderr()),
})

client.KubeClient, err = kubernetes.NewForConfig(client.KubeClientConfig)
if err != nil {
return nil, err
Expand Down

0 comments on commit da41036

Please sign in to comment.