Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
ad1471a4
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看板
未验证
提交
ad1471a4
编写于
6月 23, 2020
作者:
Z
zryfish
提交者:
GitHub
6月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
only run virtualservice and destinationrule controller when servicemesh is enabled (#2243)
上级
a5d77abd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
23 deletion
+26
-23
cmd/controller-manager/app/controllers.go
cmd/controller-manager/app/controllers.go
+18
-14
cmd/controller-manager/app/options/options.go
cmd/controller-manager/app/options/options.go
+4
-8
cmd/controller-manager/app/server.go
cmd/controller-manager/app/server.go
+4
-1
未找到文件。
cmd/controller-manager/app/controllers.go
浏览文件 @
ad1471a4
...
...
@@ -63,6 +63,7 @@ func addControllers(
openpitrixClient
openpitrix
.
Client
,
multiClusterEnabled
bool
,
networkPolicyEnabled
bool
,
serviceMeshEnabled
bool
,
stopCh
<-
chan
struct
{})
error
{
kubernetesInformer
:=
informerFactory
.
KubernetesSharedInformerFactory
()
...
...
@@ -70,21 +71,24 @@ func addControllers(
kubesphereInformer
:=
informerFactory
.
KubeSphereSharedInformerFactory
()
applicationInformer
:=
informerFactory
.
ApplicationSharedInformerFactory
()
vsController
:=
virtualservice
.
NewVirtualServiceController
(
kubernetesInformer
.
Core
()
.
V1
()
.
Services
(),
istioInformer
.
Networking
()
.
V1alpha3
()
.
VirtualServices
(),
istioInformer
.
Networking
()
.
V1alpha3
()
.
DestinationRules
(),
kubesphereInformer
.
Servicemesh
()
.
V1alpha2
()
.
Strategies
(),
client
.
Kubernetes
(),
client
.
Istio
(),
client
.
KubeSphere
())
var
vsController
,
drController
manager
.
Runnable
if
serviceMeshEnabled
{
vsController
=
virtualservice
.
NewVirtualServiceController
(
kubernetesInformer
.
Core
()
.
V1
()
.
Services
(),
istioInformer
.
Networking
()
.
V1alpha3
()
.
VirtualServices
(),
istioInformer
.
Networking
()
.
V1alpha3
()
.
DestinationRules
(),
kubesphereInformer
.
Servicemesh
()
.
V1alpha2
()
.
Strategies
(),
client
.
Kubernetes
(),
client
.
Istio
(),
client
.
KubeSphere
())
drController
:=
destinationrule
.
NewDestinationRuleController
(
kubernetesInformer
.
Apps
()
.
V1
()
.
Deployments
(),
istioInformer
.
Networking
()
.
V1alpha3
()
.
DestinationRules
(),
kubernetesInformer
.
Core
()
.
V1
()
.
Services
(),
kubesphereInformer
.
Servicemesh
()
.
V1alpha2
()
.
ServicePolicies
(),
client
.
Kubernetes
(),
client
.
Istio
(),
client
.
KubeSphere
())
drController
=
destinationrule
.
NewDestinationRuleController
(
kubernetesInformer
.
Apps
()
.
V1
()
.
Deployments
(),
istioInformer
.
Networking
()
.
V1alpha3
()
.
DestinationRules
(),
kubernetesInformer
.
Core
()
.
V1
()
.
Services
(),
kubesphereInformer
.
Servicemesh
()
.
V1alpha2
()
.
ServicePolicies
(),
client
.
Kubernetes
(),
client
.
Istio
(),
client
.
KubeSphere
())
}
apController
:=
application
.
NewApplicationController
(
kubernetesInformer
.
Core
()
.
V1
()
.
Services
(),
kubernetesInformer
.
Apps
()
.
V1
()
.
Deployments
(),
...
...
cmd/controller-manager/app/options/options.go
浏览文件 @
ad1471a4
...
...
@@ -6,13 +6,13 @@ import (
"k8s.io/client-go/tools/leaderelection"
cliflag
"k8s.io/component-base/cli/flag"
"k8s.io/klog"
kubesphereconfig
"kubesphere.io/kubesphere/pkg/apiserver/config"
"kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
"kubesphere.io/kubesphere/pkg/simple/client/multicluster"
"kubesphere.io/kubesphere/pkg/simple/client/network"
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
"kubesphere.io/kubesphere/pkg/simple/client/servicemesh"
"strings"
"time"
)
...
...
@@ -24,6 +24,7 @@ type KubeSphereControllerManagerOptions struct {
OpenPitrixOptions
*
openpitrix
.
Options
NetworkOptions
*
network
.
Options
MultiClusterOptions
*
multicluster
.
Options
ServiceMeshOptions
*
servicemesh
.
Options
LeaderElect
bool
LeaderElection
*
leaderelection
.
LeaderElectionConfig
WebhookCertDir
string
...
...
@@ -37,6 +38,7 @@ func NewKubeSphereControllerManagerOptions() *KubeSphereControllerManagerOptions
OpenPitrixOptions
:
openpitrix
.
NewOptions
(),
NetworkOptions
:
network
.
NewNetworkOptions
(),
MultiClusterOptions
:
multicluster
.
NewOptions
(),
ServiceMeshOptions
:
servicemesh
.
NewServiceMeshOptions
(),
LeaderElection
:
&
leaderelection
.
LeaderElectionConfig
{
LeaseDuration
:
30
*
time
.
Second
,
RenewDeadline
:
15
*
time
.
Second
,
...
...
@@ -49,13 +51,6 @@ func NewKubeSphereControllerManagerOptions() *KubeSphereControllerManagerOptions
return
s
}
func
(
s
*
KubeSphereControllerManagerOptions
)
ApplyTo
(
conf
*
kubesphereconfig
.
Config
)
{
s
.
S3Options
.
ApplyTo
(
conf
.
S3Options
)
s
.
KubernetesOptions
.
ApplyTo
(
conf
.
KubernetesOptions
)
s
.
DevopsOptions
.
ApplyTo
(
conf
.
DevopsOptions
)
s
.
OpenPitrixOptions
.
ApplyTo
(
conf
.
OpenPitrixOptions
)
}
func
(
s
*
KubeSphereControllerManagerOptions
)
Flags
()
cliflag
.
NamedFlagSets
{
fss
:=
cliflag
.
NamedFlagSets
{}
...
...
@@ -65,6 +60,7 @@ func (s *KubeSphereControllerManagerOptions) Flags() cliflag.NamedFlagSets {
s
.
OpenPitrixOptions
.
AddFlags
(
fss
.
FlagSet
(
"openpitrix"
),
s
.
OpenPitrixOptions
)
s
.
NetworkOptions
.
AddFlags
(
fss
.
FlagSet
(
"network"
),
s
.
NetworkOptions
)
s
.
MultiClusterOptions
.
AddFlags
(
fss
.
FlagSet
(
"multicluster"
),
s
.
MultiClusterOptions
)
s
.
ServiceMeshOptions
.
AddFlags
(
fss
.
FlagSet
(
"servicemesh"
),
s
.
ServiceMeshOptions
)
fs
:=
fss
.
FlagSet
(
"leaderelection"
)
s
.
bindLeaderElectionFlags
(
s
.
LeaderElection
,
fs
)
...
...
cmd/controller-manager/app/server.go
浏览文件 @
ad1471a4
...
...
@@ -61,6 +61,7 @@ func NewControllerManagerCommand() *cobra.Command {
OpenPitrixOptions
:
conf
.
OpenPitrixOptions
,
NetworkOptions
:
conf
.
NetworkOptions
,
MultiClusterOptions
:
conf
.
MultiClusterOptions
,
ServiceMeshOptions
:
conf
.
ServiceMeshOptions
,
LeaderElection
:
s
.
LeaderElection
,
LeaderElect
:
s
.
LeaderElect
,
}
...
...
@@ -157,7 +158,9 @@ func Run(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{})
klog
.
Fatal
(
"Unable to create namespace controller"
)
}
if
err
:=
addControllers
(
mgr
,
kubernetesClient
,
informerFactory
,
devopsClient
,
s3Client
,
openpitrixClient
,
s
.
MultiClusterOptions
.
Enable
,
s
.
NetworkOptions
.
EnableNetworkPolicy
,
stopCh
);
err
!=
nil
{
// TODO(jeff): refactor config with CRD
servicemeshEnabled
:=
s
.
ServiceMeshOptions
!=
nil
&&
len
(
s
.
ServiceMeshOptions
.
IstioPilotHost
)
!=
0
if
err
=
addControllers
(
mgr
,
kubernetesClient
,
informerFactory
,
devopsClient
,
s3Client
,
openpitrixClient
,
s
.
MultiClusterOptions
.
Enable
,
s
.
NetworkOptions
.
EnableNetworkPolicy
,
servicemeshEnabled
,
stopCh
);
err
!=
nil
{
klog
.
Fatalf
(
"unable to register controllers to the manager: %v"
,
err
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录