Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
14209a48
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,发现更多精彩内容 >>
提交
14209a48
编写于
5月 06, 2019
作者:
T
tstromberg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split NewBinDataAsset into NewBinAsset and MustBinAsset
上级
614afc82
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
83 addition
and
74 deletion
+83
-74
docs/contributors/adding_an_addon.md
docs/contributors/adding_an_addon.md
+4
-4
pkg/gvisor/enable.go
pkg/gvisor/enable.go
+1
-1
pkg/minikube/assets/addons.go
pkg/minikube/assets/addons.go
+56
-56
pkg/minikube/assets/vm_assets.go
pkg/minikube/assets/vm_assets.go
+22
-13
未找到文件。
docs/contributors/adding_an_addon.md
浏览文件 @
14209a48
...
...
@@ -32,18 +32,18 @@ To add a new addon to minikube the following steps are required:
var
Addons
=
map
[
string
]
*
Addon
{
...
,
// add other addon asset
"efk"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"efk"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/efk/efk-configmap.yaml"
,
constants
.
AddonsPath
,
"efk-configmap.yaml"
,
"0640"
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/efk/efk-rc.yaml"
,
constants
.
AddonsPath
,
"efk-rc.yaml"
,
"0640"
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/efk/efk-svc.yaml"
,
constants
.
AddonsPath
,
"efk-svc.yaml"
,
...
...
pkg/gvisor/enable.go
浏览文件 @
14209a48
...
...
@@ -171,7 +171,7 @@ func copyConfigFiles() error {
}
func
copyAssetToDest
(
targetName
,
dest
string
)
error
{
var
asset
*
assets
.
Bin
Data
Asset
var
asset
*
assets
.
BinAsset
for
_
,
a
:=
range
assets
.
Addons
[
"gvisor"
]
.
Assets
{
if
a
.
GetTargetName
()
==
targetName
{
asset
=
a
...
...
pkg/minikube/assets/addons.go
浏览文件 @
14209a48
...
...
@@ -31,13 +31,13 @@ import (
// Addon is a named list of assets, that can be enabled
type
Addon
struct
{
Assets
[]
*
Bin
Data
Asset
Assets
[]
*
BinAsset
enabled
bool
addonName
string
}
// NewAddon creates a new Addon
func
NewAddon
(
assets
[]
*
Bin
Data
Asset
,
enabled
bool
,
addonName
string
)
*
Addon
{
func
NewAddon
(
assets
[]
*
BinAsset
,
enabled
bool
,
addonName
string
)
*
Addon
{
a
:=
&
Addon
{
Assets
:
assets
,
enabled
:
enabled
,
...
...
@@ -61,260 +61,260 @@ func (a *Addon) IsEnabled() (bool, error) {
// Addons is the list of addons
var
Addons
=
map
[
string
]
*
Addon
{
"addon-manager"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"addon-manager"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/addon-manager.yaml"
,
"/etc/kubernetes/manifests/"
,
"addon-manager.yaml"
,
"0640"
,
true
),
},
true
,
"addon-manager"
),
"dashboard"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"dashboard"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/dashboard/dashboard-dp.yaml"
,
constants
.
AddonsPath
,
"dashboard-dp.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/dashboard/dashboard-svc.yaml"
,
constants
.
AddonsPath
,
"dashboard-svc.yaml"
,
"0640"
,
false
),
},
false
,
"dashboard"
),
"default-storageclass"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"default-storageclass"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/storageclass/storageclass.yaml"
,
constants
.
AddonsPath
,
"storageclass.yaml"
,
"0640"
,
false
),
},
true
,
"default-storageclass"
),
"storage-provisioner"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"storage-provisioner"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/storage-provisioner/storage-provisioner.yaml"
,
constants
.
AddonsPath
,
"storage-provisioner.yaml"
,
"0640"
,
true
),
},
true
,
"storage-provisioner"
),
"storage-provisioner-gluster"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"storage-provisioner-gluster"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/storage-provisioner-gluster/storage-gluster-ns.yaml"
,
constants
.
AddonsPath
,
"storage-gluster-ns.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml"
,
constants
.
AddonsPath
,
"glusterfs-daemonset.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml"
,
constants
.
AddonsPath
,
"heketi-deployment.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml"
,
constants
.
AddonsPath
,
"storage-privisioner-glusterfile.yaml"
,
"0640"
,
false
),
},
false
,
"storage-provisioner-gluster"
),
"heapster"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"heapster"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/heapster/influx-grafana-rc.yaml"
,
constants
.
AddonsPath
,
"influxGrafana-rc.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/heapster/grafana-svc.yaml"
,
constants
.
AddonsPath
,
"grafana-svc.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/heapster/influxdb-svc.yaml"
,
constants
.
AddonsPath
,
"influxdb-svc.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/heapster/heapster-rc.yaml"
,
constants
.
AddonsPath
,
"heapster-rc.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/heapster/heapster-svc.yaml"
,
constants
.
AddonsPath
,
"heapster-svc.yaml"
,
"0640"
,
false
),
},
false
,
"heapster"
),
"efk"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"efk"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/efk/elasticsearch-rc.yaml"
,
constants
.
AddonsPath
,
"elasticsearch-rc.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/efk/elasticsearch-svc.yaml"
,
constants
.
AddonsPath
,
"elasticsearch-svc.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/efk/fluentd-es-rc.yaml"
,
constants
.
AddonsPath
,
"fluentd-es-rc.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/efk/fluentd-es-configmap.yaml"
,
constants
.
AddonsPath
,
"fluentd-es-configmap.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/efk/kibana-rc.yaml"
,
constants
.
AddonsPath
,
"kibana-rc.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/efk/kibana-svc.yaml"
,
constants
.
AddonsPath
,
"kibana-svc.yaml"
,
"0640"
,
false
),
},
false
,
"efk"
),
"ingress"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"ingress"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/ingress/ingress-configmap.yaml"
,
constants
.
AddonsPath
,
"ingress-configmap.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/ingress/ingress-rbac.yaml"
,
constants
.
AddonsPath
,
"ingress-rbac.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/ingress/ingress-dp.yaml"
,
constants
.
AddonsPath
,
"ingress-dp.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/ingress/ingress-svc.yaml"
,
constants
.
AddonsPath
,
"ingress-svc.yaml"
,
"0640"
,
false
),
},
false
,
"ingress"
),
"metrics-server"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"metrics-server"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/metrics-server/metrics-apiservice.yaml"
,
constants
.
AddonsPath
,
"metrics-apiservice.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/metrics-server/metrics-server-deployment.yaml"
,
constants
.
AddonsPath
,
"metrics-server-deployment.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/metrics-server/metrics-server-service.yaml"
,
constants
.
AddonsPath
,
"metrics-server-service.yaml"
,
"0640"
,
false
),
},
false
,
"metrics-server"
),
"registry"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"registry"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/registry/registry-rc.yaml"
,
constants
.
AddonsPath
,
"registry-rc.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/registry/registry-svc.yaml"
,
constants
.
AddonsPath
,
"registry-svc.yaml"
,
"0640"
,
false
),
},
false
,
"registry"
),
"registry-creds"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"registry-creds"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/registry-creds/registry-creds-rc.yaml"
,
constants
.
AddonsPath
,
"registry-creds-rc.yaml"
,
"0640"
,
false
),
},
false
,
"registry-creds"
),
"freshpod"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"freshpod"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/freshpod/freshpod-rc.yaml"
,
constants
.
AddonsPath
,
"freshpod-rc.yaml"
,
"0640"
,
true
),
},
false
,
"freshpod"
),
"nvidia-driver-installer"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"nvidia-driver-installer"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/gpu/nvidia-driver-installer.yaml"
,
constants
.
AddonsPath
,
"nvidia-driver-installer.yaml"
,
"0640"
,
true
),
},
false
,
"nvidia-driver-installer"
),
"nvidia-gpu-device-plugin"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"nvidia-gpu-device-plugin"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml"
,
constants
.
AddonsPath
,
"nvidia-gpu-device-plugin.yaml"
,
"0640"
,
true
),
},
false
,
"nvidia-gpu-device-plugin"
),
"logviewer"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"logviewer"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/logviewer/logviewer-dp-and-svc.yaml"
,
constants
.
AddonsPath
,
"logviewer-dp-and-svc.yaml"
,
"0640"
,
false
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/logviewer/logviewer-rbac.yaml"
,
constants
.
AddonsPath
,
"logviewer-rbac.yaml"
,
"0640"
,
false
),
},
false
,
"logviewer"
),
"gvisor"
:
NewAddon
([]
*
Bin
Data
Asset
{
NewBinData
Asset
(
"gvisor"
:
NewAddon
([]
*
BinAsset
{
MustBin
Asset
(
"deploy/addons/gvisor/gvisor-pod.yaml"
,
constants
.
AddonsPath
,
"gvisor-pod.yaml"
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/gvisor/gvisor-config.toml"
,
constants
.
GvisorFilesPath
,
constants
.
GvisorConfigTomlTargetName
,
"0640"
,
true
),
NewBinData
Asset
(
MustBin
Asset
(
"deploy/addons/gvisor/gvisor-containerd-shim.toml"
,
constants
.
GvisorFilesPath
,
constants
.
GvisorContainerdShimTargetName
,
...
...
pkg/minikube/assets/vm_assets.go
浏览文件 @
14209a48
...
...
@@ -149,25 +149,34 @@ func NewMemoryAsset(d []byte, targetDir, targetName, permissions string) *Memory
return
m
}
// Bin
Data
Asset is a bindata (binary data) asset
type
Bin
Data
Asset
struct
{
// BinAsset is a bindata (binary data) asset
type
BinAsset
struct
{
BaseAsset
template
*
template
.
Template
}
// NewBinDataAsset creates a new BinDataAsset
func
NewBinDataAsset
(
assetName
,
targetDir
,
targetName
,
permissions
string
,
isTemplate
bool
)
*
BinDataAsset
{
m
:=
&
BinDataAsset
{
// MustBinAsset creates a new BinAsset, or panics if invalid
func
MustBinAsset
(
name
,
targetDir
,
targetName
,
permissions
string
,
isTemplate
bool
)
*
BinAsset
{
asset
,
err
:=
NewBinAsset
(
name
,
targetDir
,
targetName
,
permissions
,
isTemplate
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"Failed to define asset %s: %v"
,
name
,
err
))
}
return
asset
}
// NewBinAsset creates a new BinAsset
func
NewBinAsset
(
name
,
targetDir
,
targetName
,
permissions
string
,
isTemplate
bool
)
(
*
BinAsset
,
error
)
{
m
:=
&
BinAsset
{
BaseAsset
:
BaseAsset
{
AssetName
:
assetN
ame
,
AssetName
:
n
ame
,
TargetDir
:
targetDir
,
TargetName
:
targetName
,
Permissions
:
permissions
,
},
template
:
nil
,
}
m
.
loadData
(
isTemplate
)
return
m
err
:=
m
.
loadData
(
isTemplate
)
return
m
,
err
}
func
defaultValue
(
defValue
string
,
val
interface
{})
string
{
...
...
@@ -181,7 +190,7 @@ func defaultValue(defValue string, val interface{}) string {
return
strVal
}
func
(
m
*
Bin
Data
Asset
)
loadData
(
isTemplate
bool
)
error
{
func
(
m
*
BinAsset
)
loadData
(
isTemplate
bool
)
error
{
contents
,
err
:=
Asset
(
m
.
AssetName
)
if
err
!=
nil
{
return
err
...
...
@@ -207,12 +216,12 @@ func (m *BinDataAsset) loadData(isTemplate bool) error {
}
// IsTemplate returns if the asset is a template
func
(
m
*
Bin
Data
Asset
)
IsTemplate
()
bool
{
func
(
m
*
BinAsset
)
IsTemplate
()
bool
{
return
m
.
template
!=
nil
}
// Evaluate evaluates the template to a new asset
func
(
m
*
Bin
Data
Asset
)
Evaluate
(
data
interface
{})
(
*
MemoryAsset
,
error
)
{
func
(
m
*
BinAsset
)
Evaluate
(
data
interface
{})
(
*
MemoryAsset
,
error
)
{
if
!
m
.
IsTemplate
()
{
return
nil
,
errors
.
Errorf
(
"the asset %s is not a template"
,
m
.
AssetName
)
...
...
@@ -227,12 +236,12 @@ func (m *BinDataAsset) Evaluate(data interface{}) (*MemoryAsset, error) {
}
// GetLength returns length
func
(
m
*
Bin
Data
Asset
)
GetLength
()
int
{
func
(
m
*
BinAsset
)
GetLength
()
int
{
return
m
.
Length
}
// Read reads the asset
func
(
m
*
Bin
Data
Asset
)
Read
(
p
[]
byte
)
(
int
,
error
)
{
func
(
m
*
BinAsset
)
Read
(
p
[]
byte
)
(
int
,
error
)
{
if
m
.
Length
==
0
{
return
0
,
fmt
.
Errorf
(
"attempted read from a 0 length asset"
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录