Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
7a7439c0
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,发现更多精彩内容 >>
提交
7a7439c0
编写于
2月 10, 2021
作者:
B
BLasan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add image repository respected for calico
上级
47da1ffe
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
5 deletion
+50
-5
pkg/minikube/bootstrapper/images/images.go
pkg/minikube/bootstrapper/images/images.go
+16
-0
pkg/minikube/cni/calico.go
pkg/minikube/cni/calico.go
+34
-5
未找到文件。
pkg/minikube/bootstrapper/images/images.go
浏览文件 @
7a7439c0
...
@@ -147,3 +147,19 @@ func KindNet(repo string) string {
...
@@ -147,3 +147,19 @@ func KindNet(repo string) string {
}
}
return
path
.
Join
(
repo
,
"kindnetd:0.5.4"
)
return
path
.
Join
(
repo
,
"kindnetd:0.5.4"
)
}
}
// CalicoDaemonSet returns the image used for calicoDaemonSet
func
CalicoDaemonSet
(
repo
string
)
string
{
if
repo
==
""
{
repo
=
"calico"
}
return
path
.
Join
(
repo
,
"node:v3.14.1"
)
}
// CalicoDeployment returns the image used for calicoDeployment
func
CalicoDeployment
(
repo
string
)
string
{
if
repo
==
""
{
repo
=
"calico"
}
return
path
.
Join
(
repo
,
"kube-controllers:v3.14.1"
)
}
pkg/minikube/cni/calico.go
浏览文件 @
7a7439c0
...
@@ -17,11 +17,17 @@ limitations under the License.
...
@@ -17,11 +17,17 @@ limitations under the License.
package
cni
package
cni
import
(
import
(
"bytes"
"text/template"
"github.com/pkg/errors"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/bootstrapper/images"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/config"
)
)
// calicoTmpl is from https://docs.projectcalico.org/manifests/calico.yaml
// calicoTmpl is from https://docs.projectcalico.org/manifests/calico.yaml
var
calicoTmpl
=
`---
var
calicoTmpl
=
template
.
Must
(
template
.
New
(
"calico"
)
.
Parse
(
`---
# Source: calico/templates/calico-config.yaml
# Source: calico/templates/calico-config.yaml
# This ConfigMap is used to configure a self-hosted Calico installation.
# This ConfigMap is used to configure a self-hosted Calico installation.
kind: ConfigMap
kind: ConfigMap
...
@@ -649,7 +655,7 @@ spec:
...
@@ -649,7 +655,7 @@ spec:
# container programs network policy and routes on each
# container programs network policy and routes on each
# host.
# host.
- name: calico-node
- name: calico-node
image:
calico/node:v3.14.1
image:
{{ .DaemonSetImageName }}
env:
env:
# Use Kubernetes API as the backing datastore.
# Use Kubernetes API as the backing datastore.
- name: DATASTORE_TYPE
- name: DATASTORE_TYPE
...
@@ -834,7 +840,7 @@ spec:
...
@@ -834,7 +840,7 @@ spec:
priorityClassName: system-cluster-critical
priorityClassName: system-cluster-critical
containers:
containers:
- name: calico-kube-controllers
- name: calico-kube-controllers
image:
calico/kube-controllers:v3.14.1
image:
{{ .DeploymentImageName }}
env:
env:
# Choose which controllers to run.
# Choose which controllers to run.
- name: ENABLED_CONTROLLERS
- name: ENABLED_CONTROLLERS
...
@@ -864,21 +870,44 @@ metadata:
...
@@ -864,21 +870,44 @@ metadata:
---
---
# Source: calico/templates/configure-canal.yaml
# Source: calico/templates/configure-canal.yaml
`
`
))
// Calico is the Calico CNI manager
// Calico is the Calico CNI manager
type
Calico
struct
{
type
Calico
struct
{
cc
config
.
ClusterConfig
cc
config
.
ClusterConfig
}
}
type
calicoTmplStruct
struct
{
DeploymentImageName
string
DaemonSetImageName
string
}
// String returns a string representation of this CNI
// String returns a string representation of this CNI
func
(
c
Calico
)
String
()
string
{
func
(
c
Calico
)
String
()
string
{
return
"Calico"
return
"Calico"
}
}
// manifest returns a Kubernetes manifest for a CNI
func
(
c
Calico
)
manifest
()
(
assets
.
CopyableFile
,
error
)
{
input
:=
&
calicoTmplStruct
{
DeploymentImageName
:
images
.
CalicoDeployment
(
c
.
cc
.
KubernetesConfig
.
ImageRepository
),
DaemonSetImageName
:
images
.
CalicoDaemonSet
(
c
.
cc
.
KubernetesConfig
.
ImageRepository
),
}
b
:=
bytes
.
Buffer
{}
if
err
:=
calicoTmpl
.
Execute
(
&
b
,
input
);
err
!=
nil
{
return
nil
,
err
}
return
manifestAsset
(
b
.
Bytes
()),
nil
}
// Apply enables the CNI
// Apply enables the CNI
func
(
c
Calico
)
Apply
(
r
Runner
)
error
{
func
(
c
Calico
)
Apply
(
r
Runner
)
error
{
return
applyManifest
(
c
.
cc
,
r
,
manifestAsset
([]
byte
(
calicoTmpl
)))
m
,
err
:=
c
.
manifest
()
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"manifest"
)
}
return
applyManifest
(
c
.
cc
,
r
,
m
)
}
}
// CIDR returns the default CIDR used by this CNI
// CIDR returns the default CIDR used by this CNI
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录