Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
1ecec783
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看板
提交
1ecec783
编写于
1月 04, 2021
作者:
L
LiHui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable metrics by default
Signed-off-by:
N
LiHui
<
andrewli@yunify.com
>
上级
611f1c69
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
10 addition
and
53 deletion
+10
-53
cmd/controller-manager/app/options/options.go
cmd/controller-manager/app/options/options.go
+0
-4
cmd/controller-manager/app/server.go
cmd/controller-manager/app/server.go
+3
-6
cmd/ks-apiserver/app/options/options.go
cmd/ks-apiserver/app/options/options.go
+0
-1
pkg/apiserver/apiserver.go
pkg/apiserver/apiserver.go
+5
-9
pkg/apiserver/config/config.go
pkg/apiserver/config/config.go
+0
-3
pkg/apiserver/config/config_test.go
pkg/apiserver/config/config_test.go
+0
-4
pkg/controller/workspace/workspace_controller.go
pkg/controller/workspace/workspace_controller.go
+2
-2
pkg/simple/client/metrics/metrics.go
pkg/simple/client/metrics/metrics.go
+0
-24
未找到文件。
cmd/controller-manager/app/options/options.go
浏览文件 @
1ecec783
...
...
@@ -29,7 +29,6 @@ import (
"kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
ldapclient
"kubesphere.io/kubesphere/pkg/simple/client/ldap"
"kubesphere.io/kubesphere/pkg/simple/client/metrics"
"kubesphere.io/kubesphere/pkg/simple/client/multicluster"
"kubesphere.io/kubesphere/pkg/simple/client/network"
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
...
...
@@ -46,7 +45,6 @@ type KubeSphereControllerManagerOptions struct {
OpenPitrixOptions
*
openpitrix
.
Options
NetworkOptions
*
network
.
Options
MultiClusterOptions
*
multicluster
.
Options
MetricsOptions
*
metrics
.
Options
ServiceMeshOptions
*
servicemesh
.
Options
LeaderElect
bool
LeaderElection
*
leaderelection
.
LeaderElectionConfig
...
...
@@ -62,7 +60,6 @@ func NewKubeSphereControllerManagerOptions() *KubeSphereControllerManagerOptions
OpenPitrixOptions
:
openpitrix
.
NewOptions
(),
NetworkOptions
:
network
.
NewNetworkOptions
(),
MultiClusterOptions
:
multicluster
.
NewOptions
(),
MetricsOptions
:
metrics
.
NewMetricsOptions
(),
ServiceMeshOptions
:
servicemesh
.
NewServiceMeshOptions
(),
AuthenticationOptions
:
authoptions
.
NewAuthenticateOptions
(),
LeaderElection
:
&
leaderelection
.
LeaderElectionConfig
{
...
...
@@ -89,7 +86,6 @@ func (s *KubeSphereControllerManagerOptions) Flags() cliflag.NamedFlagSets {
s
.
NetworkOptions
.
AddFlags
(
fss
.
FlagSet
(
"network"
),
s
.
NetworkOptions
)
s
.
MultiClusterOptions
.
AddFlags
(
fss
.
FlagSet
(
"multicluster"
),
s
.
MultiClusterOptions
)
s
.
ServiceMeshOptions
.
AddFlags
(
fss
.
FlagSet
(
"servicemesh"
),
s
.
ServiceMeshOptions
)
s
.
MetricsOptions
.
AddFlags
(
fss
.
FlagSet
(
"metrics"
),
s
.
MetricsOptions
)
fs
:=
fss
.
FlagSet
(
"leaderelection"
)
s
.
bindLeaderElectionFlags
(
s
.
LeaderElection
,
fs
)
...
...
cmd/controller-manager/app/server.go
浏览文件 @
1ecec783
...
...
@@ -18,7 +18,6 @@ package app
import
(
"fmt"
"kubesphere.io/kubesphere/pkg/utils/metrics"
"github.com/spf13/cobra"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
cliflag
"k8s.io/component-base/cli/flag"
...
...
@@ -42,6 +41,7 @@ import (
ldapclient
"kubesphere.io/kubesphere/pkg/simple/client/ldap"
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
"kubesphere.io/kubesphere/pkg/utils/metrics"
"kubesphere.io/kubesphere/pkg/utils/term"
"os"
application
"sigs.k8s.io/application/controllers"
...
...
@@ -65,7 +65,6 @@ func NewControllerManagerCommand() *cobra.Command {
OpenPitrixOptions
:
conf
.
OpenPitrixOptions
,
NetworkOptions
:
conf
.
NetworkOptions
,
MultiClusterOptions
:
conf
.
MultiClusterOptions
,
MetricsOptions
:
conf
.
MetricsOptions
,
ServiceMeshOptions
:
conf
.
ServiceMeshOptions
,
LeaderElection
:
s
.
LeaderElection
,
LeaderElect
:
s
.
LeaderElect
,
...
...
@@ -263,10 +262,8 @@ func run(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{})
hookServer
.
Register
(
"/validate-network-kubesphere-io-v1alpha1"
,
&
webhook
.
Admission
{
Handler
:
&
webhooks
.
ValidatingHandler
{
C
:
mgr
.
GetClient
()}})
hookServer
.
Register
(
"/mutate-network-kubesphere-io-v1alpha1"
,
&
webhook
.
Admission
{
Handler
:
&
webhooks
.
MutatingHandler
{
C
:
mgr
.
GetClient
()}})
if
s
.
MetricsOptions
!=
nil
&&
s
.
MetricsOptions
.
Enable
{
klog
.
V
(
2
)
.
Info
(
"registering metrics to then webhook server"
)
hookServer
.
Register
(
"/metrics"
,
metrics
.
Handler
())
}
klog
.
V
(
2
)
.
Info
(
"registering metrics to the webhook server"
)
hookServer
.
Register
(
"/metrics"
,
metrics
.
Handler
())
klog
.
V
(
0
)
.
Info
(
"Starting the controllers."
)
if
err
=
mgr
.
Start
(
stopCh
);
err
!=
nil
{
...
...
cmd/ks-apiserver/app/options/options.go
浏览文件 @
1ecec783
...
...
@@ -82,7 +82,6 @@ func (s *ServerRunOptions) Flags() (fss cliflag.NamedFlagSets) {
s
.
MultiClusterOptions
.
AddFlags
(
fss
.
FlagSet
(
"multicluster"
),
s
.
MultiClusterOptions
)
s
.
EventsOptions
.
AddFlags
(
fss
.
FlagSet
(
"events"
),
s
.
EventsOptions
)
s
.
AuditingOptions
.
AddFlags
(
fss
.
FlagSet
(
"auditing"
),
s
.
AuditingOptions
)
s
.
MetricsOptions
.
AddFlags
(
fss
.
FlagSet
(
"metric"
),
s
.
MetricsOptions
)
fs
=
fss
.
FlagSet
(
"klog"
)
local
:=
flag
.
NewFlagSet
(
"klog"
,
flag
.
ExitOnError
)
...
...
pkg/apiserver/apiserver.go
浏览文件 @
1ecec783
...
...
@@ -158,10 +158,8 @@ func (s *APIServer) PrepareRun(stopCh <-chan struct{}) error {
s
.
installKubeSphereAPIs
()
s
.
installAPI
()
if
s
.
Config
.
MetricsOptions
!=
nil
&&
s
.
Config
.
MetricsOptions
.
Enable
{
s
.
container
.
Filter
(
monitorRequest
)
}
s
.
installMetricsAPI
()
s
.
container
.
Filter
(
monitorRequest
)
for
_
,
ws
:=
range
s
.
container
.
RegisteredWebServices
()
{
klog
.
V
(
2
)
.
Infof
(
"%s"
,
ws
.
RootPath
())
...
...
@@ -185,11 +183,9 @@ func monitorRequest(r *restful.Request, response *restful.Response, chain *restf
}
}
func
(
s
*
APIServer
)
installAPI
()
{
if
s
.
Config
.
MetricsOptions
!=
nil
&&
s
.
Config
.
MetricsOptions
.
Enable
{
register
()
metrics
.
Defaults
.
Install
(
s
.
container
)
}
func
(
s
*
APIServer
)
installMetricsAPI
()
{
register
()
metrics
.
Defaults
.
Install
(
s
.
container
)
}
// Install all kubesphere api groups
...
...
pkg/apiserver/config/config.go
浏览文件 @
1ecec783
...
...
@@ -30,7 +30,6 @@ import (
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
"kubesphere.io/kubesphere/pkg/simple/client/ldap"
"kubesphere.io/kubesphere/pkg/simple/client/logging/elasticsearch"
"kubesphere.io/kubesphere/pkg/simple/client/metrics"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring/prometheus"
"kubesphere.io/kubesphere/pkg/simple/client/multicluster"
"kubesphere.io/kubesphere/pkg/simple/client/network"
...
...
@@ -98,7 +97,6 @@ type Config struct {
AuditingOptions
*
auditingclient
.
Options
`json:"auditing,omitempty" yaml:"auditing,omitempty" mapstructure:"auditing"`
AlertingOptions
*
alerting
.
Options
`json:"alerting,omitempty" yaml:"alerting,omitempty" mapstructure:"alerting"`
NotificationOptions
*
notification
.
Options
`json:"notification,omitempty" yaml:"notification,omitempty" mapstructure:"notification"`
MetricsOptions
*
metrics
.
Options
`json:"metrics,omitempty" yaml:"metrics,omitempty" mapstructure:"metrics"`
}
// newConfig creates a default non-empty Config
...
...
@@ -122,7 +120,6 @@ func New() *Config {
MultiClusterOptions
:
multicluster
.
NewOptions
(),
EventsOptions
:
eventsclient
.
NewElasticSearchOptions
(),
AuditingOptions
:
auditingclient
.
NewElasticSearchOptions
(),
MetricsOptions
:
metrics
.
NewMetricsOptions
(),
}
}
...
...
pkg/apiserver/config/config_test.go
浏览文件 @
1ecec783
...
...
@@ -33,7 +33,6 @@ import (
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
"kubesphere.io/kubesphere/pkg/simple/client/ldap"
"kubesphere.io/kubesphere/pkg/simple/client/logging/elasticsearch"
"kubesphere.io/kubesphere/pkg/simple/client/metrics"
"kubesphere.io/kubesphere/pkg/simple/client/monitoring/prometheus"
"kubesphere.io/kubesphere/pkg/simple/client/multicluster"
"kubesphere.io/kubesphere/pkg/simple/client/network"
...
...
@@ -157,9 +156,6 @@ func newTestConfig() (*Config, error) {
IndexPrefix
:
"ks-logstash-auditing"
,
Version
:
"6"
,
},
MetricsOptions
:
&
metrics
.
Options
{
Enable
:
false
,
},
}
return
conf
,
nil
}
...
...
pkg/controller/workspace/workspace_controller.go
浏览文件 @
1ecec783
...
...
@@ -98,7 +98,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
if
err
:=
r
.
Update
(
rootCtx
,
workspace
);
err
!=
nil
{
return
ctrl
.
Result
{},
err
}
workspaceOperation
.
WithLabelValues
(
"create"
,
instan
ce
.
Name
)
.
Inc
()
workspaceOperation
.
WithLabelValues
(
"create"
,
workspa
ce
.
Name
)
.
Inc
()
}
}
else
{
// The object is being deleted
...
...
@@ -112,7 +112,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
logger
.
Error
(
err
,
"update workspace failed"
)
return
ctrl
.
Result
{},
err
}
workspaceOperation
.
WithLabelValues
(
"delete"
,
instan
ce
.
Name
)
.
Inc
()
workspaceOperation
.
WithLabelValues
(
"delete"
,
workspa
ce
.
Name
)
.
Inc
()
}
// Our finalizer has finished, so the reconciler can do nothing.
return
ctrl
.
Result
{},
nil
...
...
pkg/simple/client/metrics/metrics.go
已删除
100644 → 0
浏览文件 @
611f1c69
package
metrics
import
"github.com/spf13/pflag"
type
Options
struct
{
Enable
bool
`json:"enable,omitempty" description:"enable metric"`
}
func
NewMetricsOptions
()
*
Options
{
return
&
Options
{
Enable
:
false
,
}
}
func
(
s
*
Options
)
ApplyTo
(
options
*
Options
)
{
if
options
==
nil
{
options
=
s
return
}
}
func
(
s
*
Options
)
AddFlags
(
fs
*
pflag
.
FlagSet
,
c
*
Options
)
{
fs
.
BoolVar
(
&
s
.
Enable
,
"enable-metrics"
,
c
.
Enable
,
"If true, allow metrics. [default=false]"
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录