Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
129e2fdb
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
129e2fdb
编写于
6月 24, 2019
作者:
M
Medya Gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve readability, defer close api
上级
34fda98f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
85 addition
and
80 deletion
+85
-80
cmd/minikube/cmd/delete.go
cmd/minikube/cmd/delete.go
+47
-45
cmd/minikube/cmd/start.go
cmd/minikube/cmd/start.go
+2
-1
cmd/minikube/cmd/stop.go
cmd/minikube/cmd/stop.go
+36
-34
未找到文件。
cmd/minikube/cmd/delete.go
浏览文件 @
129e2fdb
...
...
@@ -39,7 +39,11 @@ var deleteCmd = &cobra.Command{
Short
:
"Deletes a local kubernetes cluster"
,
Long
:
`Deletes a local kubernetes cluster. This command deletes the VM, and removes all
associated files.`
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
runDelete
,
}
// runDelete handles the executes the flow of "minikube delete"
func
runDelete
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
if
len
(
args
)
>
0
{
exit
.
Usage
(
"usage: minikube delete"
)
}
...
...
@@ -63,11 +67,10 @@ associated files.`,
clusterBootstrapper
,
err
:=
GetClusterBootstrapper
(
api
,
viper
.
GetString
(
cmdcfg
.
Bootstrapper
))
if
err
!=
nil
{
console
.
ErrLn
(
"Unable to get bootstrapper: %v"
,
err
)
}
else
{
if
err
=
clusterBootstrapper
.
DeleteCluster
(
kc
);
err
!=
nil
{
}
else
if
err
=
clusterBootstrapper
.
DeleteCluster
(
kc
);
err
!=
nil
{
console
.
ErrLn
(
"Failed to delete cluster: %v"
,
err
)
}
}
}
if
err
=
cluster
.
DeleteHost
(
api
);
err
!=
nil
{
...
...
@@ -91,7 +94,6 @@ associated files.`,
exit
.
WithError
(
"Failed to remove profile"
,
err
)
}
console
.
OutStyle
(
console
.
Crushed
,
"The %q cluster has been deleted."
,
profile
)
},
}
func
init
()
{
...
...
cmd/minikube/cmd/start.go
浏览文件 @
129e2fdb
...
...
@@ -204,6 +204,7 @@ func runStart(cmd *cobra.Command, args []string) {
}
m
,
err
:=
machine
.
NewAPIClient
()
defer
m
.
Close
()
if
err
!=
nil
{
exit
.
WithError
(
"Failed to get machine client"
,
err
)
}
...
...
@@ -525,7 +526,7 @@ func generateConfig(cmd *cobra.Command, k8sVersion string) (cfg.Config, error) {
return
cfg
,
nil
}
// autoSetOptions sets the options needed for specific
configuration
automatically.
// autoSetOptions sets the options needed for specific
vm-driver
automatically.
func
autoSetOptions
(
vmDriver
string
)
error
{
// options for none driver
if
vmDriver
==
constants
.
DriverNone
{
...
...
cmd/minikube/cmd/stop.go
浏览文件 @
129e2fdb
...
...
@@ -39,7 +39,11 @@ var stopCmd = &cobra.Command{
Short
:
"Stops a running local kubernetes cluster"
,
Long
:
`Stops a local kubernetes cluster running in Virtualbox. This command stops the VM
itself, leaving all files intact. The cluster can be started again with the "start" command.`
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
runStop
,
}
// runStop handles the executes the flow of "minikube stop"
func
runStop
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
profile
:=
viper
.
GetString
(
pkg_config
.
MachineProfile
)
api
,
err
:=
machine
.
NewAPIClient
()
if
err
!=
nil
{
...
...
@@ -60,7 +64,7 @@ itself, leaving all files intact. The cluster can be started again with the "sta
return
err
}
}
if
err
:=
pkgutil
.
RetryAfter
(
5
,
stop
,
1
*
time
.
Second
);
err
!=
nil
{
if
err
:=
pkgutil
.
RetryAfter
(
5
,
stop
,
2
*
time
.
Second
);
err
!=
nil
{
exit
.
WithError
(
"Unable to stop VM"
,
err
)
}
if
!
nonexistent
{
...
...
@@ -76,9 +80,7 @@ itself, leaving all files intact. The cluster can be started again with the "sta
if
err
!=
nil
{
exit
.
WithError
(
"update config"
,
err
)
}
},
}
func
init
()
{
RootCmd
.
AddCommand
(
stopCmd
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录