Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
746248ab
K
kubesphere
项目概览
水淹萌龙
/
kubesphere
与 Fork 源项目一致
Fork自
KubeSphere / kubesphere
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
未验证
提交
746248ab
编写于
9月 08, 2019
作者:
K
KubeSphere CI Bot
提交者:
GitHub
9月 08, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #692 from magicsong/nsnp
✨
support calico with k8s storage
上级
4e4664ef
d3e694c6
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
233 addition
and
15 deletion
+233
-15
Makefile
Makefile
+4
-0
cmd/ks-network/main.go
cmd/ks-network/main.go
+1
-0
kustomize/network/calico-etcd/kustomization.yaml
kustomize/network/calico-etcd/kustomization.yaml
+4
-3
kustomize/network/calico-etcd/network.yaml
kustomize/network/calico-etcd/network.yaml
+0
-0
kustomize/network/calico-etcd/patch_image_name.yaml
kustomize/network/calico-etcd/patch_image_name.yaml
+1
-1
kustomize/network/calico-etcd/patch_role_binding.yaml
kustomize/network/calico-etcd/patch_role_binding.yaml
+1
-1
kustomize/network/calico-etcd/role.yaml
kustomize/network/calico-etcd/role.yaml
+33
-0
kustomize/network/calico-etcd/role_binding.yaml
kustomize/network/calico-etcd/role_binding.yaml
+0
-0
kustomize/network/calico-k8s/kustomization.yaml
kustomize/network/calico-k8s/kustomization.yaml
+11
-0
kustomize/network/calico-k8s/network.yaml
kustomize/network/calico-k8s/network.yaml
+69
-0
kustomize/network/calico-k8s/patch_image_name.yaml
kustomize/network/calico-k8s/patch_image_name.yaml
+12
-0
kustomize/network/calico-k8s/patch_role_binding.yaml
kustomize/network/calico-k8s/patch_role_binding.yaml
+8
-0
kustomize/network/calico-k8s/role.yaml
kustomize/network/calico-k8s/role.yaml
+54
-0
kustomize/network/crds/kustomization.yaml
kustomize/network/crds/kustomization.yaml
+3
-0
pkg/controller/network/provider/calico_k8s.go
pkg/controller/network/provider/calico_k8s.go
+3
-0
pkg/controller/network/runoption/option.go
pkg/controller/network/runoption/option.go
+3
-5
pkg/test/testing.go
pkg/test/testing.go
+5
-1
test/network/test.sh
test/network/test.sh
+21
-4
未找到文件。
Makefile
浏览文件 @
746248ab
...
...
@@ -124,3 +124,7 @@ CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN
=
$(
shell
which controller-gen
)
endif
network-rbac
:
$(CONTROLLER_GEN)
paths
=
./pkg/controller/network/provider/
paths
=
./pkg/controller/network/ rbac:roleName
=
network-manager output:rbac:artifacts:config
=
kustomize/network/calico-k8s
$(CONTROLLER_GEN)
paths
=
./pkg/controller/network/ rbac:roleName
=
network-manager output:rbac:artifacts:config
=
kustomize/network/calico-etcd
cmd/ks-network/main.go
浏览文件 @
746248ab
...
...
@@ -12,6 +12,7 @@ var opt runoption.RunOption
func
init
()
{
flag
.
StringVar
(
&
opt
.
ProviderName
,
"np-provider"
,
"calico"
,
"specify the network policy provider, k8s or calico"
)
flag
.
BoolVar
(
&
opt
.
AllowInsecureEtcd
,
"allow-insecure-etcd"
,
false
,
"specify allow connect to etcd using insecure http"
)
flag
.
StringVar
(
&
opt
.
DataStoreType
,
"datastore-type"
,
"k8s"
,
"specify the datastore type of calico"
)
//TODO add more flags
}
...
...
kustomize/network/kustomization.yaml
→
kustomize/network/
calico-etcd/
kustomization.yaml
浏览文件 @
746248ab
bases
:
-
../crds
resources
:
-
network.yaml
-
crds/wsnp.yaml
-
crds/nsnp.yaml
-
rbac/role.yaml
-
rbac/role_binding.yaml
...
...
@@ -19,4 +20,4 @@ secretGenerator:
patchesStrategicMerge
:
-
patch_image_name.yaml
namespace
:
network-test-
90fa3885
namespace
:
network-test-
f22e8ea9
kustomize/network/network.yaml
→
kustomize/network/
calico-etcd/
network.yaml
浏览文件 @
746248ab
文件已移动
kustomize/network/patch_image_name.yaml
→
kustomize/network/
calico-etcd/
patch_image_name.yaml
浏览文件 @
746248ab
...
...
@@ -8,5 +8,5 @@ spec:
spec
:
containers
:
# Change the value of image field below to your controller image URL
-
image
:
magicsong/ks-network:
90fa3885
-
image
:
magicsong/ks-network:
f22e8ea9
name
:
manager
kustomize/network/patch_role_binding.yaml
→
kustomize/network/
calico-etcd/
patch_role_binding.yaml
浏览文件 @
746248ab
...
...
@@ -5,4 +5,4 @@ metadata:
subjects
:
-
kind
:
ServiceAccount
name
:
default
namespace
:
network-test-
90fa3885
namespace
:
network-test-
f22e8ea9
kustomize/network/calico-etcd/role.yaml
0 → 100644
浏览文件 @
746248ab
---
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
ClusterRole
metadata
:
creationTimestamp
:
null
name
:
network-manager
rules
:
-
apiGroups
:
-
network.kubesphere.io
resources
:
-
namespacenetworkpolicies
-
workspacenetworkpolicies
verbs
:
-
create
-
delete
-
get
-
list
-
patch
-
update
-
watch
-
apiGroups
:
-
tenant.kubesphere.io
resources
:
-
workspaces
verbs
:
-
create
-
delete
-
get
-
list
-
patch
-
update
-
watch
kustomize/network/
rbac
/role_binding.yaml
→
kustomize/network/
calico-etcd
/role_binding.yaml
浏览文件 @
746248ab
文件已移动
kustomize/network/calico-k8s/kustomization.yaml
0 → 100644
浏览文件 @
746248ab
bases
:
-
../crds
resources
:
-
network.yaml
-
role.yaml
patchesStrategicMerge
:
-
patch_image_name.yaml
namespace
:
network-test-f22e8ea9
kustomize/network/calico-k8s/network.yaml
0 → 100644
浏览文件 @
746248ab
apiVersion
:
v1
kind
:
Namespace
metadata
:
name
:
network-system
---
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
network-manager
namespace
:
network-system
labels
:
control-plane
:
network-manager
spec
:
selector
:
matchLabels
:
control-plane
:
network-manager
replicas
:
1
template
:
metadata
:
labels
:
control-plane
:
network-manager
spec
:
nodeSelector
:
node-role.kubernetes.io/master
:
"
"
tolerations
:
-
key
:
"
CriticalAddonsOnly"
operator
:
"
Exists"
-
key
:
"
node-role.kubernetes.io/master"
effect
:
NoSchedule
serviceAccountName
:
network-manager
containers
:
-
command
:
-
/ks-network
args
:
-
-v=4
-
np-provider=calico
-
datastore-type=k8s
image
:
network:latest
imagePullPolicy
:
Always
name
:
manager
resources
:
limits
:
cpu
:
100m
memory
:
30Mi
requests
:
cpu
:
100m
memory
:
20Mi
terminationGracePeriodSeconds
:
10
---
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
ClusterRoleBinding
metadata
:
name
:
net-role-binding
namespace
:
network-system
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
network-manager
subjects
:
-
kind
:
ServiceAccount
name
:
network-manager
---
apiVersion
:
v1
kind
:
ServiceAccount
metadata
:
name
:
network-manager
\ No newline at end of file
kustomize/network/calico-k8s/patch_image_name.yaml
0 → 100644
浏览文件 @
746248ab
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
network-manager
namespace
:
network-system
spec
:
template
:
spec
:
containers
:
# Change the value of image field below to your controller image URL
-
image
:
magicsong/ks-network:f22e8ea9
name
:
manager
kustomize/network/calico-k8s/patch_role_binding.yaml
0 → 100644
浏览文件 @
746248ab
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
ClusterRoleBinding
metadata
:
name
:
net-role-binding
subjects
:
-
kind
:
ServiceAccount
name
:
network-manager
namespace
:
network-test-f22e8ea9
kustomize/network/calico-k8s/role.yaml
0 → 100644
浏览文件 @
746248ab
---
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
ClusterRole
metadata
:
creationTimestamp
:
null
name
:
network-manager
rules
:
-
apiGroups
:
-
crd.projectcalico.org
resources
:
-
clusterinformations
-
felixconfigurations
-
globalfelixconfigs
-
globalnetworkpolicies
-
globalnetworksets
-
hostendpoints
-
ipamblocks
-
ippools
-
networkpolicies
-
networksets
verbs
:
-
create
-
delete
-
get
-
list
-
patch
-
update
-
watch
-
apiGroups
:
-
network.kubesphere.io
resources
:
-
namespacenetworkpolicies
-
workspacenetworkpolicies
verbs
:
-
create
-
delete
-
get
-
list
-
patch
-
update
-
watch
-
apiGroups
:
-
tenant.kubesphere.io
resources
:
-
workspaces
verbs
:
-
create
-
delete
-
get
-
list
-
patch
-
update
-
watch
kustomize/network/crds/kustomization.yaml
0 → 100644
浏览文件 @
746248ab
resources
:
-
wsnp.yaml
-
nsnp.yaml
\ No newline at end of file
pkg/controller/network/provider/calico_k8s.go
0 → 100644
浏览文件 @
746248ab
package
provider
// +kubebuilder:rbac:groups="crd.projectcalico.org",resources=globalfelixconfigs;felixconfigurations;ippools;ipamblocks;globalnetworkpolicies;globalnetworksets;networkpolicies;networksets;clusterinformations;hostendpoints,verbs=get;list;watch;create;patch;update;delete
pkg/controller/network/runoption/option.go
浏览文件 @
746248ab
...
...
@@ -14,18 +14,16 @@ import (
"kubesphere.io/kubesphere/pkg/controller/network/provider"
)
type
CalicoDataStoreType
string
const
(
certPath
=
"/calicocerts"
KubernetesDataStore
CalicoDataStoreType
=
"k8s"
EtcdDataStore
CalicoDataStoreType
=
"etcd"
KubernetesDataStore
=
"k8s"
EtcdDataStore
=
"etcd"
)
type
RunOption
struct
{
ProviderName
string
DataStoreType
CalicoDataStoreType
DataStoreType
string
EtcdEndpoints
string
AllowInsecureEtcd
bool
}
...
...
pkg/test/testing.go
浏览文件 @
746248ab
...
...
@@ -89,7 +89,11 @@ func (t *TestCtx) Setup(yamlPath string, crdPath string, schemes ...AddToSchemeF
return
err
}
for
_
,
f
:=
range
schemes
{
f
(
scheme
.
Scheme
)
err
=
f
(
scheme
.
Scheme
)
if
err
!=
nil
{
klog
.
Errorln
(
"Failed to add scheme"
)
return
err
}
}
extscheme
.
AddToScheme
(
scheme
.
Scheme
)
dynClient
,
err
:=
client
.
New
(
cfg
,
client
.
Options
{})
...
...
test/network/test.sh
浏览文件 @
746248ab
...
...
@@ -4,10 +4,12 @@ set -e
workspace
=
`
pwd
`
tag
=
`
git rev-parse
--short
HEAD
`
IMG
=
magicsong
/ks-network:
$tag
IMG
=
kubespheredev
/ks-network:
$tag
DEST
=
/tmp/manager.yaml
TEST_NS
=
network-test-
$tag
SKIP_BUILD
=
no
STORE_MODE
=
etcd
MODE
=
test
export
TEST_NAMESPACE
=
$TEST_NS
export
YAML_PATH
=
$DEST
...
...
@@ -33,6 +35,16 @@ case $key in
shift
# past argument
shift
# past value
;;
-S
|
--store-mode
)
STORE_MODE
=
"
$2
"
shift
# past argument
shift
# past value
;;
-m
|
--mode
)
MODE
=
"
$2
"
shift
# past argument
shift
# past value
;;
--default
)
DEFAULT
=
YES
shift
# past argument
...
...
@@ -51,7 +63,7 @@ if [ $SKIP_BUILD == "no" ]; then
docker push
$IMG
fi
kustomize_dir
=
"./kustomize/network"
kustomize_dir
=
"./kustomize/network
/calico-
${
STORE_MODE
}
"
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
sed
-i
''
-e
's/namespace: .*/namespace: '
"
${
TEST_NS
}
"
'/'
$kustomize_dir
/kustomization.yaml
sed
-i
''
-e
's/namespace: .*/namespace: '
"
${
TEST_NS
}
"
'/'
$kustomize_dir
/patch_role_binding.yaml
...
...
@@ -62,6 +74,11 @@ else
sed
-i
-e
's@image: .*@image: '
"
${
IMG
}
"
'@'
$kustomize_dir
/patch_image_name.yaml
fi
kustomize build
$kustomize_dir
-o
$DEST
ginkgo
-v
./test/e2e/...
kustomize build
$kustomize_dir
-o
$DEST
if
[
$MODE
==
"test"
]
;
then
ginkgo
-v
./test/e2e/...
elif
[
$MODE
==
"debug"
]
;
then
kubectl create ns
$TEST_NS
--dry-run
-o
yaml | kubectl apply
-f
-
kubectl apply
-f
$DEST
fi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录