Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
c6000e6c
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,发现更多精彩内容 >>
未验证
提交
c6000e6c
编写于
7月 20, 2020
作者:
M
Medya Ghazizadeh
提交者:
GitHub
7月 20, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8777 from afbjorklund/kic-var
Make sure to prepare the kic volume after creation
上级
263bcd3a
22585c3a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
21 deletion
+31
-21
pkg/drivers/kic/kic.go
pkg/drivers/kic/kic.go
+16
-21
pkg/drivers/kic/oci/oci.go
pkg/drivers/kic/oci/oci.go
+4
-0
pkg/drivers/kic/oci/volumes.go
pkg/drivers/kic/oci/volumes.go
+11
-0
未找到文件。
pkg/drivers/kic/kic.go
浏览文件 @
c6000e6c
...
...
@@ -122,27 +122,22 @@ func (d *Driver) Create() error {
}
var
waitForPreload
sync
.
WaitGroup
if
d
.
NodeConfig
.
OCIBinary
==
oci
.
Docker
{
waitForPreload
.
Add
(
1
)
go
func
()
{
defer
waitForPreload
.
Done
()
// If preload doesn't exist, don't bother extracting tarball to volume
if
!
download
.
PreloadExists
(
d
.
NodeConfig
.
KubernetesVersion
,
d
.
NodeConfig
.
ContainerRuntime
)
{
return
}
t
:=
time
.
Now
()
glog
.
Infof
(
"Starting extracting preloaded images to volume ..."
)
// Extract preloaded images to container
if
err
:=
oci
.
ExtractTarballToVolume
(
d
.
NodeConfig
.
OCIBinary
,
download
.
TarballPath
(
d
.
NodeConfig
.
KubernetesVersion
,
d
.
NodeConfig
.
ContainerRuntime
),
params
.
Name
,
d
.
NodeConfig
.
ImageDigest
);
err
!=
nil
{
glog
.
Infof
(
"Unable to extract preloaded tarball to volume: %v"
,
err
)
}
else
{
glog
.
Infof
(
"duration metric: took %f seconds to extract preloaded images to volume"
,
time
.
Since
(
t
)
.
Seconds
())
}
}()
}
else
{
// driver == "podman"
glog
.
Info
(
"Driver isn't docker, skipping extracting preloaded images"
)
}
waitForPreload
.
Add
(
1
)
go
func
()
{
defer
waitForPreload
.
Done
()
// If preload doesn't exist, don't bother extracting tarball to volume
if
!
download
.
PreloadExists
(
d
.
NodeConfig
.
KubernetesVersion
,
d
.
NodeConfig
.
ContainerRuntime
)
{
return
}
t
:=
time
.
Now
()
glog
.
Infof
(
"Starting extracting preloaded images to volume ..."
)
// Extract preloaded images to container
if
err
:=
oci
.
ExtractTarballToVolume
(
d
.
NodeConfig
.
OCIBinary
,
download
.
TarballPath
(
d
.
NodeConfig
.
KubernetesVersion
,
d
.
NodeConfig
.
ContainerRuntime
),
params
.
Name
,
d
.
NodeConfig
.
ImageDigest
);
err
!=
nil
{
glog
.
Infof
(
"Unable to extract preloaded tarball to volume: %v"
,
err
)
}
else
{
glog
.
Infof
(
"duration metric: took %f seconds to extract preloaded images to volume"
,
time
.
Since
(
t
)
.
Seconds
())
}
}()
if
err
:=
oci
.
CreateContainerNode
(
params
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"create kic node"
)
...
...
pkg/drivers/kic/oci/oci.go
浏览文件 @
c6000e6c
...
...
@@ -99,6 +99,10 @@ func PrepareContainerNode(p CreateParams) error {
return
errors
.
Wrapf
(
err
,
"creating volume for %s container"
,
p
.
Name
)
}
glog
.
Infof
(
"Successfully created a %s volume %s"
,
p
.
OCIBinary
,
p
.
Name
)
if
err
:=
prepareVolume
(
p
.
OCIBinary
,
p
.
Image
,
p
.
Name
);
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"preparing volume for %s container"
,
p
.
Name
)
}
glog
.
Infof
(
"Successfully prepared a %s volume %s"
,
p
.
OCIBinary
,
p
.
Name
)
return
nil
}
...
...
pkg/drivers/kic/oci/volumes.go
浏览文件 @
c6000e6c
...
...
@@ -106,3 +106,14 @@ func createVolume(ociBin string, profile string, nodeName string) error {
}
return
nil
}
// prepareVolume will copy the initial content of the mount point by starting a container to check the expected content
func
prepareVolume
(
ociBin
string
,
imageName
string
,
nodeName
string
)
error
{
cmdArgs
:=
[]
string
{
"run"
,
"--rm"
,
"--entrypoint"
,
"/usr/bin/test"
}
cmdArgs
=
append
(
cmdArgs
,
"-v"
,
fmt
.
Sprintf
(
"%s:/var"
,
nodeName
),
imageName
,
"-d"
,
"/var/lib"
)
cmd
:=
exec
.
Command
(
ociBin
,
cmdArgs
...
)
if
_
,
err
:=
runCmd
(
cmd
);
err
!=
nil
{
return
err
}
return
nil
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录