Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
34fafc78
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,发现更多精彩内容 >>
提交
34fafc78
编写于
4月 14, 2020
作者:
M
Medya Gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fine tune
上级
29280cef
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
7 deletion
+16
-7
pkg/drivers/kic/kic.go
pkg/drivers/kic/kic.go
+9
-0
pkg/drivers/kic/oci/oci.go
pkg/drivers/kic/oci/oci.go
+5
-3
pkg/drivers/kic/oci/types.go
pkg/drivers/kic/oci/types.go
+0
-2
pkg/minikube/machine/stop.go
pkg/minikube/machine/stop.go
+2
-2
未找到文件。
pkg/drivers/kic/kic.go
浏览文件 @
34fafc78
...
@@ -282,6 +282,10 @@ func (d *Driver) Remove() error {
...
@@ -282,6 +282,10 @@ func (d *Driver) Remove() error {
}
}
}
}
if
id
,
err
:=
oci
.
ContainerID
(
d
.
OCIBinary
,
d
.
MachineName
);
err
==
nil
&&
id
!=
""
{
return
fmt
.
Errorf
(
"expected no container ID be found for %q after delete. but got %q"
,
d
.
MachineName
,
id
)
}
return
nil
return
nil
}
}
...
@@ -370,6 +374,11 @@ func (d *Driver) Stop() error {
...
@@ -370,6 +374,11 @@ func (d *Driver) Stop() error {
return
nil
return
nil
}
}
// RunSSHCommandFromDriver implements direct ssh control to the driver
func
(
d
*
Driver
)
RunSSHCommandFromDriver
()
error
{
return
fmt
.
Errorf
(
"driver does not support RunSSHCommandFromDriver commands"
)
}
// killAPIServerProc will kill an api server proc if it exists
// killAPIServerProc will kill an api server proc if it exists
// to ensure this never happens https://github.com/kubernetes/minikube/issues/7521
// to ensure this never happens https://github.com/kubernetes/minikube/issues/7521
func
killAPIServerProc
(
runner
command
.
Runner
)
error
{
func
killAPIServerProc
(
runner
command
.
Runner
)
error
{
...
...
pkg/drivers/kic/oci/oci.go
浏览文件 @
34fafc78
...
@@ -497,15 +497,17 @@ func ContainerStatus(ociBin string, name string) (string, error) {
...
@@ -497,15 +497,17 @@ 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"
,
"--privileged"
,
"-t"
,
name
,
"
sudo"
,
"init"
,
"
0"
)
cmd
:=
exec
.
Command
(
ociBin
,
"exec"
,
"--privileged"
,
"-t"
,
name
,
"
/bin/bash"
,
"-c"
,
"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
)
glog
.
Infof
(
"error shutdown %s output %q : %v"
,
name
,
out
,
err
)
}
}
// helps with allowing docker realize the container is exited and report its status correctly.
time
.
Sleep
(
time
.
Second
*
1
)
// wait till it is stoped
// wait till it is stoped
stopped
:=
func
()
error
{
stopped
:=
func
()
error
{
st
,
err
:=
ContainerStatus
(
ociBin
,
name
)
st
,
err
:=
ContainerStatus
(
ociBin
,
name
)
if
st
==
"exited"
{
if
st
==
"exited"
{
glog
.
Infof
(
"container %s status is %s"
,
name
,
st
)
return
nil
return
nil
}
}
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/drivers/kic/oci/types.go
浏览文件 @
34fafc78
...
@@ -31,8 +31,6 @@ const (
...
@@ -31,8 +31,6 @@ const (
nodeRoleLabelKey
=
"role.minikube.sigs.k8s.io"
nodeRoleLabelKey
=
"role.minikube.sigs.k8s.io"
// CreatedByLabelKey is applied to any container/volume that is created by minikube created_by.minikube.sigs.k8s.io=true
// CreatedByLabelKey is applied to any container/volume that is created by minikube created_by.minikube.sigs.k8s.io=true
CreatedByLabelKey
=
"created_by.minikube.sigs.k8s.io"
CreatedByLabelKey
=
"created_by.minikube.sigs.k8s.io"
// ShutownCmd is the command halt and stop the container
ShutownCmd
=
"sudo init 0"
)
)
// CreateParams are parameters needed to create a container
// CreateParams are parameters needed to create a container
...
...
pkg/minikube/machine/stop.go
浏览文件 @
34fafc78
...
@@ -80,8 +80,8 @@ func trySSHPowerOff(h *host.Host) error {
...
@@ -80,8 +80,8 @@ func trySSHPowerOff(h *host.Host) error {
out
.
T
(
out
.
Shutdown
,
`Powering off "{{.profile_name}}" via SSH ...`
,
out
.
V
{
"profile_name"
:
h
.
Name
})
out
.
T
(
out
.
Shutdown
,
`Powering off "{{.profile_name}}" via SSH ...`
,
out
.
V
{
"profile_name"
:
h
.
Name
})
if
driver
.
IsKIC
(
h
.
DriverName
)
{
if
driver
.
IsKIC
(
h
.
DriverName
)
{
out
,
err
:=
h
.
RunSSHCommand
(
oci
.
ShutownCmd
)
err
:=
oci
.
ShutDown
(
h
.
DriverName
,
h
.
Name
)
glog
.
Infof
(
"shutdown c
md %q result: out=%s, err=%v"
,
oci
.
ShutownCmd
,
out
,
err
)
glog
.
Infof
(
"shutdown c
ontainer: err=%v"
,
err
)
}
else
{
}
else
{
out
,
err
:=
h
.
RunSSHCommand
(
"sudo poweroff"
)
out
,
err
:=
h
.
RunSSHCommand
(
"sudo poweroff"
)
// poweroff always results in an error, since the host disconnects.
// poweroff always results in an error, since the host disconnects.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录