Skip to content

Commit ee3d464

Browse files
matttrachlukasboettcherjlamillan
authored
fix: [v8] validate connection (#1606)
Signed-off-by: Lukas Boettcher <1340215+lukasboettcher@users.noreply.github.com> Signed-off-by: jesse.millan <jesse.millan@oracle.com> Co-authored-by: lukasboettcher <1340215+lukasboettcher@users.noreply.github.com> Co-authored-by: Jesse Millan <jesse.millan@oracle.com>
1 parent 054ce34 commit ee3d464

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

rancher2/resource_rancher2_cluster.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,11 @@ func isKubeConfigValid(c *Config, config string) (string, bool, error) {
556556
if err != nil {
557557
return "", false, fmt.Errorf("checking Kubeconfig: %v", err)
558558
}
559-
_, err = kubernetes.NewForConfig(kubeconfig)
559+
client, err := kubernetes.NewForConfig(kubeconfig)
560+
if err != nil {
561+
return token, false, nil
562+
}
563+
_, err = client.DiscoveryClient.ServerVersion()
560564
if err != nil {
561565
return token, false, nil
562566
}

0 commit comments

Comments
 (0)