Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
2490bf78
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,发现更多精彩内容 >>
未验证
提交
2490bf78
编写于
4月 20, 2020
作者:
M
Medya Ghazizadeh
提交者:
GitHub
4月 20, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7821 from medyagh/fix_preload
fix preload script
上级
bfdb7102
dc84091d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
17 deletion
+20
-17
hack/preload-images/generate.go
hack/preload-images/generate.go
+2
-9
hack/preload-images/preload_images.go
hack/preload-images/preload_images.go
+18
-8
未找到文件。
hack/preload-images/generate.go
浏览文件 @
2490bf78
...
...
@@ -30,7 +30,6 @@ import (
"k8s.io/minikube/pkg/minikube/bootstrapper/images"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/cruntime"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/localpath"
...
...
@@ -40,12 +39,6 @@ import (
)
func
generateTarball
(
kubernetesVersion
,
containerRuntime
,
tarballFilename
string
)
error
{
defer
func
()
{
if
err
:=
deleteMinikube
();
err
!=
nil
{
fmt
.
Println
(
err
)
}
}()
driver
:=
kic
.
NewDriver
(
kic
.
Config
{
KubernetesVersion
:
kubernetesVersion
,
ContainerRuntime
:
driver
.
Docker
,
...
...
@@ -80,7 +73,7 @@ func generateTarball(kubernetesVersion, containerRuntime, tarballFilename string
runner
:=
command
.
NewKICRunner
(
profile
,
driver
.
OCIBinary
)
// will need to do this to enable the container run-time service
sv
,
err
:=
util
.
ParseKubernetesVersion
(
constants
.
DefaultK
ubernetesVersion
)
sv
,
err
:=
util
.
ParseKubernetesVersion
(
k
ubernetesVersion
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"Failed to parse kubernetes version"
)
}
...
...
@@ -182,7 +175,7 @@ func copyTarballToHost(tarballFilename string) error {
}
func
deleteMinikube
()
error
{
cmd
:=
exec
.
Command
(
minikubePath
,
"delete"
,
"-
-all"
,
"--prune"
)
// to avoid https://github.com/kubernetes/minikube/issues/7814
cmd
:=
exec
.
Command
(
minikubePath
,
"delete"
,
"-
p"
,
profile
)
// to avoid https://github.com/kubernetes/minikube/issues/7814
cmd
.
Stdout
=
os
.
Stdout
return
cmd
.
Run
()
}
hack/preload-images/preload_images.go
浏览文件 @
2490bf78
...
...
@@ -20,12 +20,13 @@ import (
"bytes"
"flag"
"fmt"
"os"
"os/exec"
"runtime/debug"
"strings"
"github.com/spf13/viper"
"k8s.io/minikube/pkg/minikube/download"
"k8s.io/minikube/pkg/minikube/exit"
)
const
(
...
...
@@ -52,22 +53,22 @@ func init() {
func
main
()
{
defer
func
()
{
if
err
:=
deleteMinikube
();
err
!=
nil
{
fmt
.
Printf
(
"error cleaning up minikube: %v"
,
err
)
fmt
.
Printf
(
"error cleaning up minikube: %v
\n
"
,
err
)
}
}()
if
err
:=
deleteMinikube
();
err
!=
nil
{
fmt
.
Printf
(
"error cleaning up minikube at start up: %v"
,
err
)
fmt
.
Printf
(
"error cleaning up minikube at start up: %v
\n
"
,
err
)
}
if
err
:=
verifyDockerStorage
();
err
!=
nil
{
exit
.
WithError
(
"Docker storage type is incompatible: %v
\n
"
,
err
)
exit
(
"Docker storage type is incompatible: %v
\n
"
,
err
)
}
if
k8sVersions
==
nil
{
var
err
error
k8sVersions
,
err
=
RecentK8sVersions
()
if
err
!=
nil
{
exit
.
WithError
(
"Unable to get recent k8s versions: %v
\n
"
,
err
)
exit
(
"Unable to get recent k8s versions: %v
\n
"
,
err
)
}
}
...
...
@@ -80,14 +81,14 @@ func main() {
}
fmt
.
Printf
(
"A preloaded tarball for k8s version %s - runtime %q doesn't exist, generating now...
\n
"
,
kv
,
cr
)
if
err
:=
generateTarball
(
kv
,
cr
,
tf
);
err
!=
nil
{
exit
.
WithError
(
fmt
.
Sprintf
(
"generating tarball for k8s version %s with %s"
,
kv
,
cr
),
err
)
exit
(
fmt
.
Sprintf
(
"generating tarball for k8s version %s with %s"
,
kv
,
cr
),
err
)
}
if
err
:=
uploadTarball
(
tf
);
err
!=
nil
{
exit
.
WithError
(
fmt
.
Sprintf
(
"uploading tarball for k8s version %s with %s"
,
kv
,
cr
),
err
)
exit
(
fmt
.
Sprintf
(
"uploading tarball for k8s version %s with %s"
,
kv
,
cr
),
err
)
}
if
err
:=
deleteMinikube
();
err
!=
nil
{
fmt
.
Printf
(
"error cleaning up minikube
at start up: %v
"
,
err
)
fmt
.
Printf
(
"error cleaning up minikube
before finishing up: %v
\n
"
,
err
)
}
}
...
...
@@ -108,3 +109,12 @@ func verifyDockerStorage() error {
}
return
nil
}
// exit will exit and clean up minikube
func
exit
(
msg
string
,
err
error
)
{
fmt
.
Printf
(
"WithError(%s)=%v called from:
\n
%s"
,
msg
,
err
,
debug
.
Stack
())
if
err
:=
deleteMinikube
();
err
!=
nil
{
fmt
.
Printf
(
"error cleaning up minikube at start up: %v
\n
"
,
err
)
}
os
.
Exit
(
60
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录