Skip to content

Commit a8d2a6d

Browse files
author
Mohd Uzair
authored
Merge pull request #596 from MUzairS15/MUzairS15/fix-logic
fix error handling
2 parents 6fd2108 + 08164fd commit a8d2a6d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

utils/kubernetes/client.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ func DetectKubeConfig(configfile []byte) (config *rest.Config, err error) {
2121
}
2222

2323
if config, err = clientcmd.RESTConfigFromKubeConfig(cfgFile); err == nil {
24-
return config, ErrRestConfigFromKubeConfig(err)
24+
return config, nil
2525
}
2626
}
2727

2828
// If deployed within the cluster
2929
if config, err = rest.InClusterConfig(); err == nil {
30-
return config, ErrRestConfigFromKubeConfig(err)
30+
return config, nil
3131
}
3232

3333
// Look for kubeconfig from the path mentioned in $KUBECONFIG
@@ -38,7 +38,7 @@ func DetectKubeConfig(configfile []byte) (config *rest.Config, err error) {
3838
return nil, err
3939
}
4040
if config, err = clientcmd.RESTConfigFromKubeConfig(cfgFile); err == nil {
41-
return config, ErrRestConfigFromKubeConfig(err)
41+
return config, nil
4242
}
4343
}
4444

@@ -49,10 +49,10 @@ func DetectKubeConfig(configfile []byte) (config *rest.Config, err error) {
4949
return nil, err
5050
}
5151
if config, err = clientcmd.RESTConfigFromKubeConfig(cfgFile); err == nil {
52-
return config, ErrRestConfigFromKubeConfig(err)
52+
return config, nil
5353
}
5454

55-
return
55+
return nil, ErrRestConfigFromKubeConfig(err)
5656
}
5757

5858
// ProcessConfig handles loading, validating, and optionally saving or returning a kubeconfig

0 commit comments

Comments
 (0)