Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
22b40e21
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,发现更多精彩内容 >>
提交
22b40e21
编写于
9月 02, 2020
作者:
P
Priya Wadhwa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revert static IP
上级
dd48dab0
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
2 addition
and
71 deletion
+2
-71
pkg/drivers/kic/kic.go
pkg/drivers/kic/kic.go
+0
-8
pkg/drivers/kic/oci/network.go
pkg/drivers/kic/oci/network.go
+0
-45
pkg/drivers/kic/oci/oci.go
pkg/drivers/kic/oci/oci.go
+2
-10
pkg/drivers/kic/oci/types.go
pkg/drivers/kic/oci/types.go
+0
-8
未找到文件。
pkg/drivers/kic/kic.go
浏览文件 @
22b40e21
...
...
@@ -81,14 +81,6 @@ func (d *Driver) Create() error {
APIServerPort
:
d
.
NodeConfig
.
APIServerPort
,
}
defaultNetwork
:=
d
.
MachineName
if
err
:=
oci
.
CreateNetwork
(
defaultNetwork
,
oci
.
DefaultIPRange
,
oci
.
DefaultGateway
);
err
!=
nil
{
glog
.
Warningf
(
"unable to create docker network; node ip may not be stable: %v"
,
err
)
}
else
{
params
.
Network
=
defaultNetwork
params
.
IP
=
oci
.
DefaultIP
}
// control plane specific options
params
.
PortMappings
=
append
(
params
.
PortMappings
,
oci
.
PortMapping
{
ListenAddress
:
oci
.
DefaultBindIPV4
,
...
...
pkg/drivers/kic/oci/network.go
浏览文件 @
22b40e21
...
...
@@ -72,11 +72,6 @@ func profileInContainers(profile string, containers []string) bool {
// gets the ip from user's host docker
func
dockerGatewayIP
(
profile
string
)
(
net
.
IP
,
error
)
{
var
bridgeID
string
// check if using custom network first
if
networkExists
(
profile
)
{
ip
:=
net
.
ParseIP
(
DefaultGateway
)
return
ip
,
nil
}
rr
,
err
:=
runCmd
(
exec
.
Command
(
Docker
,
"network"
,
"ls"
,
"--filter"
,
"name=bridge"
,
"--format"
,
"{{.ID}}"
))
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"get network bridge"
)
...
...
@@ -195,43 +190,3 @@ func dockerContainerIP(name string) (string, string, error) {
return
ips
[
0
],
ips
[
1
],
nil
}
// CreateNetwork creates a network
func
CreateNetwork
(
name
,
ipRange
,
gateway
string
)
error
{
// check if the network already exists
if
networkExists
(
name
)
{
return
nil
}
subnet
:=
fmt
.
Sprintf
(
"--subnet=%s"
,
ipRange
)
_
,
err
:=
runCmd
(
exec
.
Command
(
Docker
,
"network"
,
"create"
,
"--driver=bridge"
,
subnet
,
"--gateway"
,
gateway
,
name
))
if
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"error creating network"
)
}
return
nil
}
// removeNetwork removes a network
func
removeNetwork
(
name
string
)
error
{
if
!
networkExists
(
name
)
{
return
nil
}
_
,
err
:=
runCmd
(
exec
.
Command
(
Docker
,
"network"
,
"remove"
,
name
))
return
err
}
func
networkExists
(
name
string
)
bool
{
rr
,
err
:=
runCmd
(
exec
.
Command
(
Docker
,
"network"
,
"ls"
,
"--format"
,
"{{.Name}}"
))
if
err
!=
nil
{
glog
.
Warningf
(
"error listing networks: %v"
,
err
)
return
false
}
networks
:=
strings
.
Split
(
rr
.
Output
(),
"
\n
"
)
for
_
,
n
:=
range
networks
{
if
strings
.
Trim
(
n
,
"
\n
"
)
==
name
{
return
true
}
}
return
false
}
pkg/drivers/kic/oci/oci.go
浏览文件 @
22b40e21
...
...
@@ -66,8 +66,9 @@ func DeleteContainersByLabel(ociBin string, label string) []error {
}
if
_
,
err
:=
runCmd
(
exec
.
Command
(
ociBin
,
"rm"
,
"-f"
,
"-v"
,
c
));
err
!=
nil
{
deleteErrs
=
append
(
deleteErrs
,
errors
.
Wrapf
(
err
,
"delete container %s
"
,
c
))
deleteErrs
=
append
(
deleteErrs
,
errors
.
Wrapf
(
err
,
"delete container %s
: output %s"
,
c
,
err
))
}
}
return
deleteErrs
}
...
...
@@ -88,9 +89,6 @@ func DeleteContainer(ociBin string, name string) error {
if
_
,
err
:=
runCmd
(
exec
.
Command
(
ociBin
,
"rm"
,
"-f"
,
"-v"
,
name
));
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"delete %s"
,
name
)
}
if
err
:=
removeNetwork
(
name
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"removing network"
)
}
return
nil
}
...
...
@@ -153,12 +151,6 @@ func CreateContainerNode(p CreateParams) error {
runArgs
=
append
(
runArgs
,
"--volume"
,
fmt
.
Sprintf
(
"%s:/var:exec"
,
p
.
Name
))
}
if
p
.
OCIBinary
==
Docker
{
// on linux, we can provide a static IP for docker
if
runtime
.
GOOS
==
"linux"
&&
p
.
Network
!=
""
&&
p
.
IP
!=
""
{
runArgs
=
append
(
runArgs
,
"--network"
,
p
.
Network
)
runArgs
=
append
(
runArgs
,
"--ip"
,
p
.
IP
)
}
runArgs
=
append
(
runArgs
,
"--volume"
,
fmt
.
Sprintf
(
"%s:/var"
,
p
.
Name
))
// ignore apparmore github actions docker: https://github.com/kubernetes/minikube/issues/7624
runArgs
=
append
(
runArgs
,
"--security-opt"
,
"apparmor=unconfined"
)
...
...
pkg/drivers/kic/oci/types.go
浏览文件 @
22b40e21
...
...
@@ -38,12 +38,6 @@ const (
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
=
"created_by.minikube.sigs.k8s.io"
// DefaultGateway is the default gateway for the docker network created by the kic driver on linux
DefaultGateway
=
"192.168.39.1"
// DefaultIPRange is the default IP range for the docker network created by the kic driver on linux
DefaultIPRange
=
"192.168.39.0/24"
// DefaultIP is the default IP for the docker network created by the kic driver on linux
DefaultIP
=
"192.168.39.2"
)
// CreateParams are parameters needed to create a container
...
...
@@ -61,8 +55,6 @@ type CreateParams struct {
Envs
map
[
string
]
string
// environment variables to pass to the container
ExtraArgs
[]
string
// a list of any extra option to pass to oci binary during creation time, for example --expose 8080...
OCIBinary
string
// docker or podman
Network
string
// network used by the container
IP
string
// container ip address
}
// createOpt is an option for Create
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录