Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
f55fb58d
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,发现更多精彩内容 >>
提交
f55fb58d
编写于
8月 04, 2016
作者:
J
Jimmi Dyson
提交者:
GitHub
8月 04, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #451 from aaron-prindle/fix-file-uri
Fixing file:// uri issue for --iso-url flag
上级
a78a75c0
c8989902
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
9 deletion
+34
-9
pkg/minikube/cluster/cluster.go
pkg/minikube/cluster/cluster.go
+31
-6
pkg/minikube/cluster/cluster_darwin.go
pkg/minikube/cluster/cluster_darwin.go
+2
-2
pkg/minikube/cluster/cluster_linux.go
pkg/minikube/cluster/cluster_linux.go
+1
-1
未找到文件。
pkg/minikube/cluster/cluster.go
浏览文件 @
f55fb58d
...
...
@@ -26,6 +26,7 @@ import (
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
...
...
@@ -51,6 +52,8 @@ var (
certs
=
[]
string
{
"ca.crt"
,
"ca.key"
,
"apiserver.crt"
,
"apiserver.key"
}
)
const
fileScheme
=
"file"
//This init function is used to set the logtostderr variable to false so that INFO level log info does not clutter the CLI
//INFO lvl logging is displayed due to the kubernetes api calling flag.Set("logtostderr", "true") in its init()
//see: https://github.com/kubernetes/kubernetes/blob/master/pkg/util/logs.go#L32-34
...
...
@@ -350,14 +353,14 @@ func engineOptions(config MachineConfig) *engine.Options {
func
createVirtualboxHost
(
config
MachineConfig
)
drivers
.
Driver
{
d
:=
virtualbox
.
NewDriver
(
constants
.
MachineName
,
constants
.
Minipath
)
d
.
Boot2DockerURL
=
config
.
GetISO
Cache
FileURI
()
d
.
Boot2DockerURL
=
config
.
GetISOFileURI
()
d
.
Memory
=
config
.
Memory
d
.
CPU
=
config
.
CPUs
d
.
DiskSize
=
int
(
config
.
DiskSize
)
return
d
}
func
(
m
*
MachineConfig
)
CacheMinikubeISO
()
error
{
func
(
m
*
MachineConfig
)
CacheMinikubeISO
FromURL
()
error
{
// store the miniube-iso inside the .minikube dir
response
,
err
:=
http
.
Get
(
m
.
MinikubeISO
)
if
err
!=
nil
{
...
...
@@ -376,16 +379,38 @@ func (m *MachineConfig) CacheMinikubeISO() error {
return
nil
}
func
(
m
*
MachineConfig
)
ShouldCacheMinikubeISO
()
bool
{
// store the miniube-iso inside the .minikube dir
urlObj
,
err
:=
url
.
Parse
(
m
.
MinikubeISO
)
if
err
!=
nil
{
return
false
}
if
urlObj
.
Scheme
==
fileScheme
{
return
false
}
if
m
.
IsMinikubeISOCached
()
{
return
false
}
return
true
}
func
(
m
*
MachineConfig
)
GetISOCacheFilepath
()
string
{
return
filepath
.
Join
(
constants
.
Minipath
,
"cache"
,
"iso"
,
filepath
.
Base
(
m
.
MinikubeISO
))
}
func
(
m
*
MachineConfig
)
GetISOCacheFileURI
()
string
{
func
(
m
*
MachineConfig
)
GetISOFileURI
()
string
{
urlObj
,
err
:=
url
.
Parse
(
m
.
MinikubeISO
)
if
err
!=
nil
{
return
m
.
MinikubeISO
}
if
urlObj
.
Scheme
==
fileScheme
{
return
m
.
MinikubeISO
}
isoPath
:=
filepath
.
Join
(
constants
.
Minipath
,
"cache"
,
"iso"
,
filepath
.
Base
(
m
.
MinikubeISO
))
// As this is a file URL there should be no backslashes regardless of platform running on.
return
"file://"
+
filepath
.
ToSlash
(
isoPath
)
}
func
(
m
*
MachineConfig
)
IsMinikubeISOCached
()
bool
{
if
_
,
err
:=
os
.
Stat
(
m
.
GetISOCacheFilepath
());
os
.
IsNotExist
(
err
)
{
return
false
...
...
@@ -396,8 +421,8 @@ func (m *MachineConfig) IsMinikubeISOCached() bool {
func
createHost
(
api
libmachine
.
API
,
config
MachineConfig
)
(
*
host
.
Host
,
error
)
{
var
driver
interface
{}
if
!
config
.
IsMinikubeISOCached
()
{
if
err
:=
config
.
CacheMinikubeISO
();
err
!=
nil
{
if
config
.
ShouldCacheMinikubeISO
()
{
if
err
:=
config
.
CacheMinikubeISO
FromURL
();
err
!=
nil
{
return
nil
,
err
}
}
...
...
pkg/minikube/cluster/cluster_darwin.go
浏览文件 @
f55fb58d
...
...
@@ -24,7 +24,7 @@ import (
func
createVMwareFusionHost
(
config
MachineConfig
)
drivers
.
Driver
{
d
:=
vmwarefusion
.
NewDriver
(
constants
.
MachineName
,
constants
.
Minipath
)
.
(
*
vmwarefusion
.
Driver
)
d
.
Boot2DockerURL
=
config
.
GetISO
Cache
FileURI
()
d
.
Boot2DockerURL
=
config
.
GetISOFileURI
()
d
.
Memory
=
config
.
Memory
d
.
CPU
=
config
.
CPUs
...
...
@@ -59,7 +59,7 @@ func createXhyveHost(config MachineConfig) *xhyveDriver {
},
Memory
:
config
.
Memory
,
CPU
:
config
.
CPUs
,
Boot2DockerURL
:
config
.
GetISO
Cache
FileURI
(),
Boot2DockerURL
:
config
.
GetISOFileURI
(),
BootCmd
:
"loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 base host=boot2docker"
,
DiskSize
:
int64
(
config
.
DiskSize
),
}
...
...
pkg/minikube/cluster/cluster_linux.go
浏览文件 @
f55fb58d
...
...
@@ -49,7 +49,7 @@ func createKVMHost(config MachineConfig) *kvmDriver {
CPU
:
config
.
CPUs
,
Network
:
"default"
,
PrivateNetwork
:
"docker-machines"
,
Boot2DockerURL
:
config
.
GetISO
Cache
FileURI
(),
Boot2DockerURL
:
config
.
GetISOFileURI
(),
DiskSize
:
config
.
DiskSize
,
DiskPath
:
filepath
.
Join
(
constants
.
Minipath
,
"machines"
,
constants
.
MachineName
,
fmt
.
Sprintf
(
"%s.img"
,
constants
.
MachineName
)),
ISO
:
filepath
.
Join
(
constants
.
Minipath
,
"machines"
,
constants
.
MachineName
,
"boot2docker.iso"
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录