mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 14:41:10 +01:00
fix: add info for error return
This commit is contained in:
@@ -67,11 +67,11 @@ func GetMasterFromKubeconfig(filename string) (string, error) {
|
|||||||
|
|
||||||
context, ok := config.Contexts[config.CurrentContext]
|
context, ok := config.Contexts[config.CurrentContext]
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", fmt.Errorf("failed to get master address from kubeconfig")
|
return "", fmt.Errorf("failed to get master address from kubeconfig: current context not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
if val, ok := config.Clusters[context.Cluster]; ok {
|
if val, ok := config.Clusters[context.Cluster]; ok {
|
||||||
return val.Server, nil
|
return val.Server, nil
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("failed to get master address from kubeconfig")
|
return "", fmt.Errorf("failed to get master address from kubeconfig: cluster information not found")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user