Skip to content

Commit

Permalink
more intuitive error message when kubeconfig couldn't be copied from …
Browse files Browse the repository at this point in the history
…container
  • Loading branch information
iwilltry42 committed Jan 31, 2020
1 parent fdefd62 commit 0ec51e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,21 @@ func createKubeConfigFile(cluster string) error {
}

// get kubeconfig file from container and read contents

kubeconfigerror := func() {
log.Warnf("Couldn't get the kubeconfig from cluster '%s': Maybe it's not ready yet and you can try again later.", cluster)
}

reader, _, err := docker.CopyFromContainer(ctx, server[0].ID, "/output/kubeconfig.yaml")
if err != nil {
kubeconfigerror()
return fmt.Errorf(" Couldn't copy kubeconfig.yaml from server container %s\n%+v", server[0].ID, err)
}
defer reader.Close()

readBytes, err := ioutil.ReadAll(reader)
if err != nil {
kubeconfigerror()
return fmt.Errorf(" Couldn't read kubeconfig from container\n%+v", err)
}

Expand Down

0 comments on commit 0ec51e1

Please sign in to comment.