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 and robert-ulbrich-mercedes-benz committed Jul 2, 2024
1 parent d71d311 commit 6d91ade
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions flytectl/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 6d91ade

Please sign in to comment.