From 08164fd911b3a9387a325f01f065ddcfcefda43e Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 27 Sep 2024 19:27:30 +0530 Subject: [PATCH] fix error handling Signed-off-by: MUzairS15 --- utils/kubernetes/client.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/kubernetes/client.go b/utils/kubernetes/client.go index 6570fefe..9e554779 100644 --- a/utils/kubernetes/client.go +++ b/utils/kubernetes/client.go @@ -21,13 +21,13 @@ func DetectKubeConfig(configfile []byte) (config *rest.Config, err error) { } if config, err = clientcmd.RESTConfigFromKubeConfig(cfgFile); err == nil { - return config, ErrRestConfigFromKubeConfig(err) + return config, nil } } // If deployed within the cluster if config, err = rest.InClusterConfig(); err == nil { - return config, ErrRestConfigFromKubeConfig(err) + return config, nil } // Look for kubeconfig from the path mentioned in $KUBECONFIG @@ -38,7 +38,7 @@ func DetectKubeConfig(configfile []byte) (config *rest.Config, err error) { return nil, err } if config, err = clientcmd.RESTConfigFromKubeConfig(cfgFile); err == nil { - return config, ErrRestConfigFromKubeConfig(err) + return config, nil } } @@ -49,10 +49,10 @@ func DetectKubeConfig(configfile []byte) (config *rest.Config, err error) { return nil, err } if config, err = clientcmd.RESTConfigFromKubeConfig(cfgFile); err == nil { - return config, ErrRestConfigFromKubeConfig(err) + return config, nil } - return + return nil, ErrRestConfigFromKubeConfig(err) } // ProcessConfig handles loading, validating, and optionally saving or returning a kubeconfig