Add metrics-server client to monitoring
Signed-off-by: root <danma@yunify.com>
This commit is contained in:
@@ -35,8 +35,8 @@ type handler struct {
|
||||
mo model.MonitoringOperator
|
||||
}
|
||||
|
||||
func newHandler(k kubernetes.Interface, m monitoring.Interface, f informers.InformerFactory, o openpitrix.Client) *handler {
|
||||
return &handler{k, model.NewMonitoringOperator(m, k, f, o)}
|
||||
func newHandler(k kubernetes.Interface, prometheusClient monitoring.Interface, metricsClient monitoring.Interface, f informers.InformerFactory, o openpitrix.Client) *handler {
|
||||
return &handler{k, model.NewMonitoringOperator(prometheusClient, metricsClient, k, f, o)}
|
||||
}
|
||||
|
||||
func (h handler) handleKubeSphereMetricsQuery(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
@@ -217,7 +217,7 @@ func TestParseRequestParams(t *testing.T) {
|
||||
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||
client := fake.NewSimpleClientset(&tt.namespace)
|
||||
fakeInformerFactory := informers.NewInformerFactories(client, nil, nil, nil, nil, nil)
|
||||
handler := newHandler(client, nil, fakeInformerFactory, nil)
|
||||
handler := newHandler(client, nil, nil, fakeInformerFactory, nil)
|
||||
|
||||
result, err := handler.makeQueryOptions(tt.params, tt.lvl)
|
||||
if err != nil {
|
||||
|
||||
@@ -39,10 +39,10 @@ const (
|
||||
|
||||
var GroupVersion = schema.GroupVersion{Group: groupName, Version: "v1alpha3"}
|
||||
|
||||
func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monitoringClient monitoring.Interface, factory informers.InformerFactory, opClient openpitrix.Client) error {
|
||||
func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, prometheusClient monitoring.Interface, metricsClient monitoring.Interface, factory informers.InformerFactory, opClient openpitrix.Client) error {
|
||||
ws := runtime.NewWebService(GroupVersion)
|
||||
|
||||
h := newHandler(k8sClient, monitoringClient, factory, opClient)
|
||||
h := newHandler(k8sClient, prometheusClient, metricsClient, factory, opClient)
|
||||
|
||||
ws.Route(ws.GET("/kubesphere").
|
||||
To(h.handleKubeSphereMetricsQuery).
|
||||
|
||||
Reference in New Issue
Block a user