Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
ce55e44e
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看板
未验证
提交
ce55e44e
编写于
6月 12, 2020
作者:
K
KubeSphere CI Bot
提交者:
GitHub
6月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2197 from zheng1/cluster_network
Add option to enable network policy or not
上级
df36ae5c
e1e2b6b5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
13 deletion
+7
-13
pkg/apiserver/apiserver.go
pkg/apiserver/apiserver.go
+0
-2
pkg/apiserver/config/config.go
pkg/apiserver/config/config.go
+1
-1
pkg/apiserver/config/config_test.go
pkg/apiserver/config/config_test.go
+1
-1
pkg/simple/client/network/options.go
pkg/simple/client/network/options.go
+5
-9
未找到文件。
pkg/apiserver/apiserver.go
浏览文件 @
ce55e44e
...
...
@@ -50,7 +50,6 @@ import (
devopsv1alpha3
"kubesphere.io/kubesphere/pkg/kapis/devops/v1alpha3"
iamapi
"kubesphere.io/kubesphere/pkg/kapis/iam/v1alpha2"
monitoringv1alpha3
"kubesphere.io/kubesphere/pkg/kapis/monitoring/v1alpha3"
networkv1alpha2
"kubesphere.io/kubesphere/pkg/kapis/network/v1alpha2"
notificationv1
"kubesphere.io/kubesphere/pkg/kapis/notification/v1"
"kubesphere.io/kubesphere/pkg/kapis/oauth"
openpitrixv1
"kubesphere.io/kubesphere/pkg/kapis/openpitrix/v1"
...
...
@@ -170,7 +169,6 @@ func (s *APIServer) installKubeSphereAPIs() {
urlruntime
.
Must
(
resourcev1alpha3
.
AddToContainer
(
s
.
container
,
s
.
InformerFactory
))
urlruntime
.
Must
(
monitoringv1alpha3
.
AddToContainer
(
s
.
container
,
s
.
KubernetesClient
.
Kubernetes
(),
s
.
MonitoringClient
,
s
.
InformerFactory
,
s
.
OpenpitrixClient
))
urlruntime
.
Must
(
openpitrixv1
.
AddToContainer
(
s
.
container
,
s
.
InformerFactory
,
s
.
OpenpitrixClient
))
urlruntime
.
Must
(
networkv1alpha2
.
AddToContainer
(
s
.
container
,
s
.
Config
.
NetworkOptions
.
WeaveScopeHost
))
urlruntime
.
Must
(
operationsv1alpha2
.
AddToContainer
(
s
.
container
,
s
.
KubernetesClient
.
Kubernetes
()))
urlruntime
.
Must
(
resourcesv1alpha2
.
AddToContainer
(
s
.
container
,
s
.
KubernetesClient
.
Kubernetes
(),
s
.
InformerFactory
,
s
.
KubernetesClient
.
Master
()))
...
...
pkg/apiserver/config/config.go
浏览文件 @
ce55e44e
...
...
@@ -203,7 +203,7 @@ func (conf *Config) stripEmptyOptions() {
conf
.
OpenPitrixOptions
=
nil
}
if
conf
.
NetworkOptions
!=
nil
&&
conf
.
NetworkOptions
.
WeaveScopeHost
==
""
{
if
conf
.
NetworkOptions
!=
nil
&&
conf
.
NetworkOptions
.
EnableNetworkPolicy
==
false
{
conf
.
NetworkOptions
=
nil
}
...
...
pkg/apiserver/config/config_test.go
浏览文件 @
ce55e44e
...
...
@@ -101,7 +101,7 @@ func newTestConfig() (*Config, error) {
AttachmentManagerEndpoint
:
"openpitrix-hyperpitrix.openpitrix-system.svc:9122"
,
},
NetworkOptions
:
&
network
.
Options
{
WeaveScopeHost
:
"weave-scope-app.weave.svc"
,
EnableNetworkPolicy
:
true
,
},
MonitoringOptions
:
&
prometheus
.
Options
{
Endpoint
:
"http://prometheus.kubesphere-monitoring-system.svc"
,
...
...
pkg/simple/client/network/options.go
浏览文件 @
ce55e44e
...
...
@@ -3,15 +3,13 @@ package network
import
"github.com/spf13/pflag"
type
Options
struct
{
// weave scope service host
WeaveScopeHost
string
`json:"weaveScopeHost,omitempty" yaml:"weaveScopeHost"`
EnableNetworkPolicy
bool
`json:"enableNetworkPolicy,omitempty" yaml:"enableNetworkPolicy"`
}
// NewNetworkOptions returns a `zero` instance
func
NewNetworkOptions
()
*
Options
{
return
&
Options
{
WeaveScopeHost
:
"weave-scope-app.weave.svc"
,
EnableNetworkPolicy
:
false
,
}
}
...
...
@@ -21,12 +19,10 @@ func (s *Options) Validate() []error {
}
func
(
s
*
Options
)
ApplyTo
(
options
*
Options
)
{
if
s
.
WeaveScopeHost
!=
""
{
options
.
WeaveScopeHost
=
s
.
WeaveScopeHost
}
options
.
EnableNetworkPolicy
=
s
.
EnableNetworkPolicy
}
func
(
s
*
Options
)
AddFlags
(
fs
*
pflag
.
FlagSet
,
c
*
Options
)
{
fs
.
StringVar
(
&
s
.
WeaveScopeHost
,
"weave-scope-host"
,
c
.
WeaveScopeHost
,
""
+
"
weave scope service host
"
)
fs
.
BoolVar
(
&
s
.
EnableNetworkPolicy
,
"enable-network-policy"
,
c
.
EnableNetworkPolicy
,
"
This field instructs KubeSphere to enable network policy or not.
"
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录