Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
468f7edd
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
468f7edd
编写于
9月 23, 2019
作者:
J
Jeff
提交者:
zryfish
9月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix config nil error
上级
3dca9feb
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
68 addition
and
23 deletion
+68
-23
cmd/ks-apiserver/app/options/options.go
cmd/ks-apiserver/app/options/options.go
+0
-8
cmd/ks-apiserver/app/options/validation.go
cmd/ks-apiserver/app/options/validation.go
+0
-2
cmd/ks-apiserver/app/server.go
cmd/ks-apiserver/app/server.go
+0
-5
pkg/simple/client/alerting/options.go
pkg/simple/client/alerting/options.go
+5
-0
pkg/simple/client/devops/options.go
pkg/simple/client/devops/options.go
+6
-1
pkg/simple/client/elasticsearch/options.go
pkg/simple/client/elasticsearch/options.go
+5
-0
pkg/simple/client/k8s/options.go
pkg/simple/client/k8s/options.go
+4
-0
pkg/simple/client/kubesphere/options.go
pkg/simple/client/kubesphere/options.go
+4
-0
pkg/simple/client/ldap/options.go
pkg/simple/client/ldap/options.go
+5
-0
pkg/simple/client/mysql/options.go
pkg/simple/client/mysql/options.go
+4
-0
pkg/simple/client/notification/options.go
pkg/simple/client/notification/options.go
+5
-0
pkg/simple/client/openpitrix/options.go
pkg/simple/client/openpitrix/options.go
+5
-0
pkg/simple/client/prometheus/options.go
pkg/simple/client/prometheus/options.go
+5
-0
pkg/simple/client/redis/options.go
pkg/simple/client/redis/options.go
+5
-0
pkg/simple/client/s2is3/options.go
pkg/simple/client/s2is3/options.go
+5
-0
pkg/simple/client/servicemesh/options.go
pkg/simple/client/servicemesh/options.go
+1
-0
pkg/simple/client/sonarqube/options.go
pkg/simple/client/sonarqube/options.go
+1
-0
pkg/utils/reflectutils/reflect.go
pkg/utils/reflectutils/reflect.go
+8
-7
未找到文件。
cmd/ks-apiserver/app/options/options.go
浏览文件 @
468f7edd
...
...
@@ -8,11 +8,9 @@ import (
"kubesphere.io/kubesphere/pkg/simple/client/devops"
esclient
"kubesphere.io/kubesphere/pkg/simple/client/elasticsearch"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
"kubesphere.io/kubesphere/pkg/simple/client/ldap"
"kubesphere.io/kubesphere/pkg/simple/client/mysql"
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
"kubesphere.io/kubesphere/pkg/simple/client/prometheus"
"kubesphere.io/kubesphere/pkg/simple/client/redis"
"kubesphere.io/kubesphere/pkg/simple/client/s2is3"
"kubesphere.io/kubesphere/pkg/simple/client/servicemesh"
"kubesphere.io/kubesphere/pkg/simple/client/sonarqube"
...
...
@@ -28,9 +26,7 @@ type ServerRunOptions struct {
ServiceMeshOptions
*
servicemesh
.
ServiceMeshOptions
MySQLOptions
*
mysql
.
MySQLOptions
MonitoringOptions
*
prometheus
.
PrometheusOptions
LdapOptions
*
ldap
.
LdapOptions
S3Options
*
s2is3
.
S3Options
RedisOptions
*
redis
.
RedisOptions
OpenPitrixOptions
*
openpitrix
.
OpenPitrixOptions
LoggingOptions
*
esclient
.
ElasticSearchOptions
}
...
...
@@ -45,9 +41,7 @@ func NewServerRunOptions() *ServerRunOptions {
ServiceMeshOptions
:
servicemesh
.
NewServiceMeshOptions
(),
MySQLOptions
:
mysql
.
NewMySQLOptions
(),
MonitoringOptions
:
prometheus
.
NewPrometheusOptions
(),
LdapOptions
:
ldap
.
NewLdapOptions
(),
S3Options
:
s2is3
.
NewS3Options
(),
RedisOptions
:
redis
.
NewRedisOptions
(),
OpenPitrixOptions
:
openpitrix
.
NewOpenPitrixOptions
(),
LoggingOptions
:
esclient
.
NewElasticSearchOptions
(),
}
...
...
@@ -59,12 +53,10 @@ func (s *ServerRunOptions) Flags() (fss cliflag.NamedFlagSets) {
s
.
GenericServerRunOptions
.
AddFlags
(
fss
.
FlagSet
(
"generic"
))
s
.
KubernetesOptions
.
AddFlags
(
fss
.
FlagSet
(
"kubernetes"
))
s
.
LdapOptions
.
AddFlags
(
fss
.
FlagSet
(
"ldap"
))
s
.
MySQLOptions
.
AddFlags
(
fss
.
FlagSet
(
"mysql"
))
s
.
DevopsOptions
.
AddFlags
(
fss
.
FlagSet
(
"devops"
))
s
.
SonarQubeOptions
.
AddFlags
(
fss
.
FlagSet
(
"sonarqube"
))
s
.
S3Options
.
AddFlags
(
fss
.
FlagSet
(
"s3"
))
s
.
RedisOptions
.
AddFlags
(
fss
.
FlagSet
(
"redis"
))
s
.
OpenPitrixOptions
.
AddFlags
(
fss
.
FlagSet
(
"openpitrix"
))
s
.
ServiceMeshOptions
.
AddFlags
(
fss
.
FlagSet
(
"servicemesh"
))
s
.
MonitoringOptions
.
AddFlags
(
fss
.
FlagSet
(
"monitoring"
))
...
...
cmd/ks-apiserver/app/options/validation.go
浏览文件 @
468f7edd
...
...
@@ -11,9 +11,7 @@ func (s *ServerRunOptions) Validate() []error {
errors
=
append
(
errors
,
s
.
ServiceMeshOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
s
.
MonitoringOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
s
.
SonarQubeOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
s
.
LdapOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
s
.
S3Options
.
Validate
()
...
)
errors
=
append
(
errors
,
s
.
RedisOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
s
.
OpenPitrixOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
s
.
LoggingOptions
.
Validate
()
...
)
...
...
cmd/ks-apiserver/app/server.go
浏览文件 @
468f7edd
...
...
@@ -162,7 +162,6 @@ func CreateClientSet(conf *apiserverconfig.Config, stopCh <-chan struct{}) error
SetS3Options
(
conf
.
S3Options
)
.
SetOpenPitrixOptions
(
conf
.
OpenPitrixOptions
)
.
SetPrometheusOptions
(
conf
.
MonitoringOptions
)
.
SetRedisOptions
(
conf
.
RedisOptions
)
.
SetKubeSphereOptions
(
conf
.
KubeSphereOptions
)
.
SetElasticSearchOptions
(
conf
.
LoggingOptions
)
...
...
@@ -276,8 +275,6 @@ func Complete(s *options.ServerRunOptions) error {
KubernetesOptions
:
s
.
KubernetesOptions
,
ServiceMeshOptions
:
s
.
ServiceMeshOptions
,
MonitoringOptions
:
s
.
MonitoringOptions
,
LdapOptions
:
s
.
LdapOptions
,
RedisOptions
:
s
.
RedisOptions
,
S3Options
:
s
.
S3Options
,
OpenPitrixOptions
:
s
.
OpenPitrixOptions
,
LoggingOptions
:
s
.
LoggingOptions
,
...
...
@@ -291,8 +288,6 @@ func Complete(s *options.ServerRunOptions) error {
ServiceMeshOptions
:
conf
.
ServiceMeshOptions
,
MySQLOptions
:
conf
.
MySQLOptions
,
MonitoringOptions
:
conf
.
MonitoringOptions
,
LdapOptions
:
conf
.
LdapOptions
,
RedisOptions
:
conf
.
RedisOptions
,
S3Options
:
conf
.
S3Options
,
OpenPitrixOptions
:
conf
.
OpenPitrixOptions
,
LoggingOptions
:
conf
.
LoggingOptions
,
...
...
pkg/simple/client/alerting/options.go
浏览文件 @
468f7edd
...
...
@@ -11,6 +11,11 @@ func NewAlertingOptions() *AlertingOptions {
}
func
(
s
*
AlertingOptions
)
ApplyTo
(
options
*
AlertingOptions
)
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
Endpoint
!=
""
{
options
.
Endpoint
=
s
.
Endpoint
}
...
...
pkg/simple/client/devops/options.go
浏览文件 @
468f7edd
...
...
@@ -25,7 +25,12 @@ func NewDevopsOptions() *DevopsOptions {
// ApplyTo apply configuration to another options
func
(
s
*
DevopsOptions
)
ApplyTo
(
options
*
DevopsOptions
)
{
if
s
.
Host
!=
""
&&
options
!=
nil
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
Host
!=
""
{
reflectutils
.
Override
(
options
,
s
)
}
}
...
...
pkg/simple/client/elasticsearch/options.go
浏览文件 @
468f7edd
...
...
@@ -26,6 +26,11 @@ func NewElasticSearchOptions() *ElasticSearchOptions {
}
func
(
s
*
ElasticSearchOptions
)
ApplyTo
(
options
*
ElasticSearchOptions
)
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
Host
!=
""
{
reflectutils
.
Override
(
options
,
s
)
}
...
...
pkg/simple/client/k8s/options.go
浏览文件 @
468f7edd
...
...
@@ -46,6 +46,10 @@ func (k *KubernetesOptions) Validate() []error {
}
func
(
k
*
KubernetesOptions
)
ApplyTo
(
options
*
KubernetesOptions
)
{
if
options
==
nil
{
options
=
k
return
}
reflectutils
.
Override
(
options
,
k
)
}
...
...
pkg/simple/client/kubesphere/options.go
浏览文件 @
468f7edd
...
...
@@ -16,6 +16,10 @@ func NewKubeSphereOptions() *KubeSphereOptions {
}
func
(
s
*
KubeSphereOptions
)
ApplyTo
(
options
*
KubeSphereOptions
)
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
AccountServer
!=
""
{
options
.
AccountServer
=
s
.
AccountServer
}
...
...
pkg/simple/client/ldap/options.go
浏览文件 @
468f7edd
...
...
@@ -31,6 +31,11 @@ func (l *LdapOptions) Validate() []error {
}
func
(
l
*
LdapOptions
)
ApplyTo
(
options
*
LdapOptions
)
{
if
options
==
nil
{
options
=
l
return
}
if
l
.
Host
!=
""
{
reflectutils
.
Override
(
options
,
l
)
}
...
...
pkg/simple/client/mysql/options.go
浏览文件 @
468f7edd
...
...
@@ -34,6 +34,10 @@ func (m *MySQLOptions) Validate() []error {
}
func
(
m
*
MySQLOptions
)
ApplyTo
(
options
*
MySQLOptions
)
{
if
options
==
nil
{
options
=
m
return
}
reflectutils
.
Override
(
options
,
m
)
}
...
...
pkg/simple/client/notification/options.go
浏览文件 @
468f7edd
...
...
@@ -11,6 +11,11 @@ func NewNotificationOptions() *NotificationOptions {
}
func
(
s
*
NotificationOptions
)
ApplyTo
(
options
*
NotificationOptions
)
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
Endpoint
!=
""
{
options
.
Endpoint
=
s
.
Endpoint
}
...
...
pkg/simple/client/openpitrix/options.go
浏览文件 @
468f7edd
...
...
@@ -19,6 +19,11 @@ func NewOpenPitrixOptions() *OpenPitrixOptions {
}
func
(
s
*
OpenPitrixOptions
)
ApplyTo
(
options
*
OpenPitrixOptions
)
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
APIServer
!=
""
{
reflectutils
.
Override
(
options
,
s
)
}
...
...
pkg/simple/client/prometheus/options.go
浏览文件 @
468f7edd
...
...
@@ -23,6 +23,11 @@ func (s *PrometheusOptions) Validate() []error {
}
func
(
s
*
PrometheusOptions
)
ApplyTo
(
options
*
PrometheusOptions
)
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
Endpoint
!=
""
{
options
.
Endpoint
=
s
.
Endpoint
}
...
...
pkg/simple/client/redis/options.go
浏览文件 @
468f7edd
...
...
@@ -44,6 +44,11 @@ func (r *RedisOptions) Validate() []error {
// ApplyTo apply to another options if it's a enabled option(non empty host)
func
(
r
*
RedisOptions
)
ApplyTo
(
options
*
RedisOptions
)
{
if
options
==
nil
{
options
=
r
return
}
if
r
.
Host
!=
""
{
reflectutils
.
Override
(
options
,
r
)
}
...
...
pkg/simple/client/s2is3/options.go
浏览文件 @
468f7edd
...
...
@@ -40,6 +40,11 @@ func (s *S3Options) Validate() []error {
// ApplyTo overrides options if it's valid, which endpoint is not empty
func
(
s
*
S3Options
)
ApplyTo
(
options
*
S3Options
)
{
if
options
==
nil
{
options
=
s
return
}
if
s
.
Endpoint
!=
""
{
reflectutils
.
Override
(
options
,
s
)
}
...
...
pkg/simple/client/servicemesh/options.go
浏览文件 @
468f7edd
...
...
@@ -31,6 +31,7 @@ func (s *ServiceMeshOptions) Validate() []error {
func
(
s
*
ServiceMeshOptions
)
ApplyTo
(
options
*
ServiceMeshOptions
)
{
if
options
==
nil
{
options
=
s
return
}
...
...
pkg/simple/client/sonarqube/options.go
浏览文件 @
468f7edd
...
...
@@ -28,6 +28,7 @@ func (s *SonarQubeOptions) Validate() []error {
func
(
s
*
SonarQubeOptions
)
ApplyTo
(
options
*
SonarQubeOptions
)
{
if
options
==
nil
{
options
=
s
return
}
...
...
pkg/utils/reflectutils/reflect.go
浏览文件 @
468f7edd
...
...
@@ -37,22 +37,23 @@ func In(value interface{}, container interface{}) bool {
}
func
Override
(
left
interface
{},
right
interface
{})
{
if
left
==
nil
||
right
==
nil
{
if
reflect
.
ValueOf
(
left
)
.
IsNil
()
||
reflect
.
ValueOf
(
right
)
.
IsNil
()
{
return
}
if
reflect
.
ValueOf
(
left
)
.
Type
()
.
Kind
()
!=
reflect
.
Ptr
||
reflect
.
ValueOf
(
right
)
.
Type
()
.
Kind
()
!=
reflect
.
Ptr
{
reflect
.
ValueOf
(
right
)
.
Type
()
.
Kind
()
!=
reflect
.
Ptr
||
reflect
.
ValueOf
(
left
)
.
Kind
()
!=
reflect
.
ValueOf
(
right
)
.
Kind
()
{
return
}
old
:=
reflect
.
ValueOf
(
left
)
.
Elem
()
new
:=
reflect
.
ValueOf
(
right
)
.
Elem
()
old
Val
:=
reflect
.
ValueOf
(
left
)
.
Elem
()
new
Val
:=
reflect
.
ValueOf
(
right
)
.
Elem
()
for
i
:=
0
;
i
<
old
.
NumField
();
i
++
{
val
:=
new
.
Field
(
i
)
.
Interface
()
for
i
:=
0
;
i
<
old
Val
.
NumField
();
i
++
{
val
:=
new
Val
.
Field
(
i
)
.
Interface
()
if
!
reflect
.
DeepEqual
(
val
,
reflect
.
Zero
(
reflect
.
TypeOf
(
val
))
.
Interface
())
{
old
.
Field
(
i
)
.
Set
(
reflect
.
ValueOf
(
val
))
old
Val
.
Field
(
i
)
.
Set
(
reflect
.
ValueOf
(
val
))
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录