mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
fix: set default work_dir is "./kubekey". (#2354)
Signed-off-by: joyceliu <joyceliu@yunify.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
parent
1aa519d295
commit
647ae222bf
|
|
@ -73,7 +73,7 @@ func newCommonOptions() CommonOptions {
|
|||
klog.ErrorS(err, "get current dir error")
|
||||
o.WorkDir = "/tmp/kubekey"
|
||||
} else {
|
||||
o.WorkDir = wd
|
||||
o.WorkDir = filepath.Join(wd, "kubekey")
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func (c *kubernetesConnector) Init(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
// set rootDir
|
||||
c.rootDir = filepath.Join(_const.GetWorkDir(), "kubernetes", c.clusterName)
|
||||
c.rootDir = filepath.Join(_const.GetWorkDir(), _const.KubernetesDir, c.clusterName)
|
||||
if _, err := os.Stat(c.rootDir); err != nil && os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(c.rootDir, os.ModePerm); err != nil {
|
||||
klog.V(4).ErrorS(err, "Failed to create local dir", "cluster", c.clusterName)
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ workdir/
|
|||
| | | | |-- inventory.yaml
|
||||
|
|
||||
|-- kubekey/
|
||||
|
|
||||
|-- kubernetes/
|
||||
|
||||
*/
|
||||
|
||||
// workDir is the user-specified working directory. By default, it is the same as the directory where the kubekey command is executed.
|
||||
|
|
@ -117,3 +120,6 @@ const RuntimePipelineVariableDir = "variable"
|
|||
// "kubekey" is the default directory name under the working directory. It is used to store
|
||||
// files required when executing the kubekey command (such as: docker, etcd, image packages, etc.).
|
||||
// These files will be downloaded locally and distributed to remote nodes.
|
||||
|
||||
// KubernetesDir represents the remote host directory for each kubernetes connection
|
||||
const KubernetesDir = "kubernetes"
|
||||
|
|
|
|||
Loading…
Reference in New Issue