Skip to content

Commit

Permalink
Move warning options to 'GetKubeClientForConfig'
Browse files Browse the repository at this point in the history
As this function is used by more functions to create Kubernetes clients, more KUDO subcommands will benefit from reduced CRD deprecation warnings when running on Kubernetes >=1.19.

Signed-off-by: Jan Schlicht <[email protected]>
  • Loading branch information
Jan Schlicht committed Oct 15, 2020
1 parent 1a452f7 commit fb28846
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kudoctl/kube/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ func GetKubeClient(kubeconfig string) (*Client, error) {
if err != nil {
return nil, err
}
config.WarningHandler = rest.NewWarningWriter(os.Stderr, rest.WarningWriterOptions{Deduplicate: true, Color: term.AllowsColorOutput(os.Stderr)})
return GetKubeClientForConfig(config)
}

func GetKubeClientForConfig(config *rest.Config) (*Client, error) {
config.WarningHandler = rest.NewWarningWriter(os.Stderr, rest.WarningWriterOptions{Deduplicate: true, Color: term.AllowsColorOutput(os.Stderr)})
kubeClient, err := kubernetes.NewForConfig(config)
if err != nil {
return nil, fmt.Errorf("could not get Kubernetes client: %s", err)
Expand Down

0 comments on commit fb28846

Please sign in to comment.