-
Notifications
You must be signed in to change notification settings - Fork 4
/
workspace.go
37 lines (28 loc) · 954 Bytes
/
workspace.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package remote_development
import (
"os"
"path/filepath"
"bunnyshell.com/cli/pkg/lib"
"bunnyshell.com/cli/pkg/util"
)
const (
KubeConfigFilename = "kube-config.yaml"
)
// @deprecated Use bunnyshell.com/cli/pkg/remote_development/workspace
func (r *RemoteDevelopment) ensureEnvironmentWorkspaceDir() error {
workspace, err := util.GetWorkspaceDir()
if err != nil {
return err
}
r.WithEnvironmentWorkspaceDir(filepath.Join(workspace, r.environmentResource.Environment.GetId()))
return os.MkdirAll(r.environmentWorkspaceDir, 0755)
}
// @deprecated Use bunnyshell.com/cli/pkg/remote_development/workspace
func (r *RemoteDevelopment) ensureEnvironmentKubeConfig() error {
kubeConfigPath := filepath.Join(r.environmentWorkspaceDir, KubeConfigFilename)
if err := lib.DownloadEnvironmentKubeConfig(kubeConfigPath, r.environmentResource.Environment.GetId()); err != nil {
return err
}
r.WithKubeConfigPath(kubeConfigPath)
return nil
}