Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
7303ccf0
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,发现更多精彩内容 >>
提交
7303ccf0
编写于
4月 14, 2020
作者:
M
Medya Gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lint
上级
54aa958f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
22 addition
and
5 deletion
+22
-5
pkg/drivers/kic/kic.go
pkg/drivers/kic/kic.go
+2
-2
pkg/drivers/kic/oci/oci.go
pkg/drivers/kic/oci/oci.go
+20
-3
未找到文件。
pkg/drivers/kic/kic.go
浏览文件 @
7303ccf0
...
@@ -268,7 +268,7 @@ func (d *Driver) Kill() error {
...
@@ -268,7 +268,7 @@ func (d *Driver) Kill() error {
// Remove will delete the Kic Node Container
// Remove will delete the Kic Node Container
func
(
d
*
Driver
)
Remove
()
error
{
func
(
d
*
Driver
)
Remove
()
error
{
if
_
,
err
:=
oci
.
ContainerID
(
d
.
OCIBinary
,
d
.
MachineName
);
err
!=
nil
{
if
_
,
err
:=
oci
.
ContainerID
(
d
.
OCIBinary
,
d
.
MachineName
);
err
!=
nil
{
glog
.
Info
(
"could not find the container %s to remove it. will try anyways"
,
d
.
MachineName
)
glog
.
Info
f
(
"could not find the container %s to remove it. will try anyways"
,
d
.
MachineName
)
}
}
if
err
:=
oci
.
DeleteContainer
(
d
.
NodeConfig
.
OCIBinary
,
d
.
MachineName
);
err
!=
nil
{
if
err
:=
oci
.
DeleteContainer
(
d
.
NodeConfig
.
OCIBinary
,
d
.
MachineName
);
err
!=
nil
{
...
@@ -277,7 +277,7 @@ func (d *Driver) Remove() error {
...
@@ -277,7 +277,7 @@ func (d *Driver) Remove() error {
return
err
return
err
}
}
if
strings
.
Contains
(
err
.
Error
(),
"No such container:"
)
{
if
strings
.
Contains
(
err
.
Error
(),
"No such container:"
)
{
glog
.
Info
(
"no container name %q found to delete"
,
d
.
MachineName
)
glog
.
Info
f
(
"no container name %q found to delete"
,
d
.
MachineName
)
return
nil
return
nil
}
}
...
...
pkg/drivers/kic/oci/oci.go
浏览文件 @
7303ccf0
...
@@ -61,7 +61,7 @@ func DeleteContainersByLabel(ociBin string, label string) []error {
...
@@ -61,7 +61,7 @@ func DeleteContainersByLabel(ociBin string, label string) []error {
continue
continue
}
}
if
err
:=
ShutDown
(
ociBin
,
c
);
err
!=
nil
{
if
err
:=
ShutDown
(
ociBin
,
c
);
err
!=
nil
{
glog
.
Info
(
"couldn't shut down %s (might be okay): %v "
,
c
,
err
)
glog
.
Info
f
(
"couldn't shut down %s (might be okay): %v "
,
c
,
err
)
}
}
cmd
:=
exec
.
Command
(
ociBin
,
"rm"
,
"-f"
,
"-v"
,
c
)
cmd
:=
exec
.
Command
(
ociBin
,
"rm"
,
"-f"
,
"-v"
,
c
)
if
out
,
err
:=
cmd
.
CombinedOutput
();
err
!=
nil
{
if
out
,
err
:=
cmd
.
CombinedOutput
();
err
!=
nil
{
...
@@ -81,7 +81,7 @@ func DeleteContainer(ociBin string, name string) error {
...
@@ -81,7 +81,7 @@ func DeleteContainer(ociBin string, name string) error {
}
}
// try to delete anyways
// try to delete anyways
if
err
:=
ShutDown
(
ociBin
,
name
);
err
!=
nil
{
if
err
:=
ShutDown
(
ociBin
,
name
);
err
!=
nil
{
glog
.
Info
(
"couldn't shut down %s (might be okay): %v "
,
name
,
err
)
glog
.
Info
f
(
"couldn't shut down %s (might be okay): %v "
,
name
,
err
)
}
}
cmd
:=
exec
.
Command
(
ociBin
,
"rm"
,
"-f"
,
"-v"
,
name
)
cmd
:=
exec
.
Command
(
ociBin
,
"rm"
,
"-f"
,
"-v"
,
name
)
if
out
,
err
:=
cmd
.
CombinedOutput
();
err
!=
nil
{
if
out
,
err
:=
cmd
.
CombinedOutput
();
err
!=
nil
{
...
@@ -497,9 +497,26 @@ func ContainerStatus(ociBin string, name string) (string, error) {
...
@@ -497,9 +497,26 @@ func ContainerStatus(ociBin string, name string) (string, error) {
// to ensure the containers process and networking bindings are all closed
// to ensure the containers process and networking bindings are all closed
// to avoid containers getting stuck before delete https://github.com/kubernetes/minikube/issues/7657
// to avoid containers getting stuck before delete https://github.com/kubernetes/minikube/issues/7657
func
ShutDown
(
ociBin
string
,
name
string
)
error
{
func
ShutDown
(
ociBin
string
,
name
string
)
error
{
cmd
:=
exec
.
Command
(
ociBin
,
"exec"
,
"-
it"
,
name
,
"sudo init
0"
)
cmd
:=
exec
.
Command
(
ociBin
,
"exec"
,
"-
-privileged"
,
"-t"
,
name
,
"sudo"
,
"init"
,
"
0"
)
if
out
,
err
:=
cmd
.
CombinedOutput
();
err
!=
nil
{
if
out
,
err
:=
cmd
.
CombinedOutput
();
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"shutdown %s: output %q"
,
name
,
out
)
return
errors
.
Wrapf
(
err
,
"shutdown %s: output %q"
,
name
,
out
)
}
}
// wait till it is stoped
stopped
:=
func
()
error
{
st
,
err
:=
ContainerStatus
(
ociBin
,
name
)
if
st
==
"exited"
{
return
nil
}
if
err
!=
nil
{
glog
.
Infof
(
"temporary error verifying shutdown: %v"
,
err
)
}
glog
.
Infof
(
"temporary error: container %s status is %s but expect it to be exited"
,
name
,
st
)
return
errors
.
Wrap
(
err
,
"couldn't verify cointainer is exited. %v"
)
}
if
err
:=
retry
.
Expo
(
stopped
,
time
.
Millisecond
*
500
,
time
.
Second
*
20
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"verify shutdown"
)
}
glog
.
Infof
(
"Successfully shutdown container %s"
,
name
)
return
nil
return
nil
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录