Skip to content

Commit

Permalink
Added check before creating empty k8s config (flyteorg#211)
Browse files Browse the repository at this point in the history
* Added check before creating empty k8s config

Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored Nov 2, 2021
1 parent de0c1c9 commit f6b95da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ func SetupFlyteDir() error {
if err := os.MkdirAll(f.FilePathJoin(f.UserHomeDir(), ".flyte", "k3s"), os.ModePerm); err != nil {
return err
}

// Created a empty file with right permission
if err := ioutil.WriteFile(docker.Kubeconfig, []byte(""), os.ModePerm); err != nil {
return err
if _, err := os.Stat(docker.Kubeconfig); err != nil {
if os.IsNotExist(err) {
if err := ioutil.WriteFile(docker.Kubeconfig, []byte(""), os.ModePerm); err != nil {
return err
}
}
}

return nil
}

Expand Down

0 comments on commit f6b95da

Please sign in to comment.