From 1ae932c1bcd25e3c4f44f21eb075e7d7dd37519e Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Tue, 17 Mar 2020 16:40:18 +0800 Subject: [PATCH 1/8] remain nodeport and fix env --- charts/tidb-operator/values.yaml | 2 +- pkg/monitor/monitor/monitor_manager.go | 9 +++- pkg/monitor/monitor/util.go | 63 +++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/charts/tidb-operator/values.yaml b/charts/tidb-operator/values.yaml index dd54254ecd..6c026a5d1d 100644 --- a/charts/tidb-operator/values.yaml +++ b/charts/tidb-operator/values.yaml @@ -12,7 +12,7 @@ rbac: timezone: UTC # operatorImage is TiDB Operator image -operatorImage: pingcap/tidb-operator:v1.1.0-beta.2 +operatorImage: yisa/operator:latest imagePullPolicy: IfNotPresent # tidbBackupManagerImage is tidb backup manager image diff --git a/pkg/monitor/monitor/monitor_manager.go b/pkg/monitor/monitor/monitor_manager.go index 2e58ea47fa..c29f38a17d 100644 --- a/pkg/monitor/monitor/monitor_manager.go +++ b/pkg/monitor/monitor/monitor_manager.go @@ -32,6 +32,7 @@ import ( type MonitorManager struct { typedControl controller.TypedControlInterface deploymentLister appslisters.DeploymentLister + svcLister corelisters.ServiceLister tcLister v1alpha1listers.TidbClusterLister pvLister corelisters.PersistentVolumeLister pvControl controller.PVControlInterface @@ -54,6 +55,7 @@ func NewMonitorManager( return &MonitorManager{ typedControl: typedControl, deploymentLister: kubeInformerFactory.Apps().V1().Deployments().Lister(), + svcLister: kubeInformerFactory.Core().V1().Services().Lister(), tcLister: informerFactory.Pingcap().V1alpha1().TidbClusters().Lister(), pvControl: controller.NewRealPVControl(kubeCli, pvcLister, pvLister, recorder), pvLister: pvLister, @@ -105,8 +107,11 @@ func (mm *MonitorManager) Sync(monitor *v1alpha1.TidbMonitor) error { } func (mm *MonitorManager) syncTidbMonitorService(monitor *v1alpha1.TidbMonitor) error { - service := getMonitorService(monitor) - for _, svc := range service { + services := getMonitorService(monitor) + for _, svc := range services { + if err := mm.remainNodePort(svc); err != nil { + return err + } _, err := mm.typedControl.CreateOrUpdateService(monitor, svc) if err != nil { klog.Errorf("tm[%s/%s]'s service[%s] failed to sync,err: %v", monitor.Namespace, monitor.Name, svc.Name, err) diff --git a/pkg/monitor/monitor/util.go b/pkg/monitor/monitor/util.go index 7aa15cd3b3..3702ac3e2e 100644 --- a/pkg/monitor/monitor/util.go +++ b/pkg/monitor/monitor/util.go @@ -17,6 +17,8 @@ import ( "encoding/json" "fmt" "github.com/pingcap/tidb-operator/pkg/util" + "k8s.io/apimachinery/pkg/api/errors" + "sort" "strconv" "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" @@ -513,6 +515,7 @@ func getMonitorGrafanaContainer(secret *core.Secret, monitor *v1alpha1.TidbMonit if monitor.Spec.Grafana.ImagePullPolicy != nil { c.ImagePullPolicy = *monitor.Spec.Grafana.ImagePullPolicy } + c.Env = sortEnvByName(c.Env) return c } @@ -668,9 +671,10 @@ func getMonitorService(monitor *v1alpha1.TidbMonitor) []*core.Service { grafanaPortName = *monitor.BaseGrafanaSpec().PortName() } + promethuesName := fmt.Sprintf("%s-prometheus", monitor.Name) prometheusService := &core.Service{ ObjectMeta: meta.ObjectMeta{ - Name: fmt.Sprintf("%s-prometheus", monitor.Name), + Name: promethuesName, Namespace: monitor.Namespace, Labels: monitorLabel, OwnerReferences: []meta.OwnerReference{controller.GetTiDBMonitorOwnerRef(monitor)}, @@ -692,7 +696,7 @@ func getMonitorService(monitor *v1alpha1.TidbMonitor) []*core.Service { reloaderService := &core.Service{ ObjectMeta: meta.ObjectMeta{ - Name: fmt.Sprintf("%s-reloader", monitor.Name), + Name: fmt.Sprintf("%s-monitor-reloader", monitor.Name), Namespace: monitor.Namespace, Labels: monitorLabel, OwnerReferences: []meta.OwnerReference{controller.GetTiDBMonitorOwnerRef(monitor)}, @@ -770,3 +774,58 @@ func getMonitorPVC(monitor *v1alpha1.TidbMonitor) *core.PersistentVolumeClaim { }, } } + +// during syncing Service, If there existed TidbMonitor Service, we should remain the NodePort configure. +func (mm *MonitorManager) remainNodePort(desired *core.Service) error { + if desired.Spec.Type != core.ServiceTypeNodePort { + return nil + } + name := desired.Name + namespace := desired.Namespace + existed, err := mm.svcLister.Services(namespace).Get(name) + if err != nil { + if errors.IsNotFound(err) { + return nil + } + return err + } + if existed.Spec.Type != core.ServiceTypeNodePort { + return nil + } + for i, dport := range desired.Spec.Ports { + for _, eport := range existed.Spec.Ports { + // Because the portName could be edited, + // we use Port number to link the desired Service Port and the existed Service Port in the nested loop + if dport.Port == eport.Port { + dport.NodePort = eport.NodePort + desired.Spec.Ports[i] = dport + break + } + } + } + return nil +} + +// sortEnvByName in order to avoid syncing same template into different results +func sortEnvByName(envlist []core.EnvVar) []core.EnvVar { + if envlist == nil || len(envlist) < 1 { + return envlist + } + var wrappers EnvListWrapper + wrappers = envlist + sort.Sort(wrappers) + return wrappers +} + +type EnvListWrapper []core.EnvVar + +func (e EnvListWrapper) Len() int { + return len(e) +} +func (e EnvListWrapper) Swap(i, j int) { + e[i], e[j] = e[j], e[i] +} + +func (e EnvListWrapper) Less(i, j int) bool { + return e[i].Name < e[j].Name +} From 2b2aa77e5497683a409b29f8a9979b81d200311f Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Tue, 17 Mar 2020 17:13:36 +0800 Subject: [PATCH 2/8] fix remain Nodeport --- pkg/controller/generic_control.go | 18 +++++++++++++++ pkg/monitor/monitor/monitor_manager.go | 3 --- pkg/monitor/monitor/util.go | 32 -------------------------- 3 files changed, 18 insertions(+), 35 deletions(-) diff --git a/pkg/controller/generic_control.go b/pkg/controller/generic_control.go index 01820e9eff..afb190652b 100644 --- a/pkg/controller/generic_control.go +++ b/pkg/controller/generic_control.go @@ -271,8 +271,26 @@ func (w *typedWrapper) CreateOrUpdateService(controller runtime.Object, svc *cor } existingSvc.Annotations[LastAppliedConfigAnnotation] = string(b) clusterIp := existingSvc.Spec.ClusterIP + ports := existingSvc.Spec.Ports + serviceType := existingSvc.Spec.Type + existingSvc.Spec = desiredSvc.Spec existingSvc.Spec.ClusterIP = clusterIp + + // If the existed service and the desired service is both NodePort, we shall guaranteed the nodePort unchanged + if serviceType == corev1.ServiceTypeNodePort && desiredSvc.Spec.Type == corev1.ServiceTypeNodePort { + for i, dport := range existingSvc.Spec.Ports { + for _, eport := range ports { + // Because the portName could be edited, + // we use Port number to link the desired Service Port and the existed Service Port in the nested loop + if dport.Port == eport.Port { + dport.NodePort = eport.NodePort + existingSvc.Spec.Ports[i] = dport + break + } + } + } + } } return nil }) diff --git a/pkg/monitor/monitor/monitor_manager.go b/pkg/monitor/monitor/monitor_manager.go index c29f38a17d..b977439de4 100644 --- a/pkg/monitor/monitor/monitor_manager.go +++ b/pkg/monitor/monitor/monitor_manager.go @@ -109,9 +109,6 @@ func (mm *MonitorManager) Sync(monitor *v1alpha1.TidbMonitor) error { func (mm *MonitorManager) syncTidbMonitorService(monitor *v1alpha1.TidbMonitor) error { services := getMonitorService(monitor) for _, svc := range services { - if err := mm.remainNodePort(svc); err != nil { - return err - } _, err := mm.typedControl.CreateOrUpdateService(monitor, svc) if err != nil { klog.Errorf("tm[%s/%s]'s service[%s] failed to sync,err: %v", monitor.Namespace, monitor.Name, svc.Name, err) diff --git a/pkg/monitor/monitor/util.go b/pkg/monitor/monitor/util.go index 3702ac3e2e..c19cfa1d6e 100644 --- a/pkg/monitor/monitor/util.go +++ b/pkg/monitor/monitor/util.go @@ -17,7 +17,6 @@ import ( "encoding/json" "fmt" "github.com/pingcap/tidb-operator/pkg/util" - "k8s.io/apimachinery/pkg/api/errors" "sort" "strconv" @@ -775,37 +774,6 @@ func getMonitorPVC(monitor *v1alpha1.TidbMonitor) *core.PersistentVolumeClaim { } } -// during syncing Service, If there existed TidbMonitor Service, we should remain the NodePort configure. -func (mm *MonitorManager) remainNodePort(desired *core.Service) error { - if desired.Spec.Type != core.ServiceTypeNodePort { - return nil - } - name := desired.Name - namespace := desired.Namespace - existed, err := mm.svcLister.Services(namespace).Get(name) - if err != nil { - if errors.IsNotFound(err) { - return nil - } - return err - } - if existed.Spec.Type != core.ServiceTypeNodePort { - return nil - } - for i, dport := range desired.Spec.Ports { - for _, eport := range existed.Spec.Ports { - // Because the portName could be edited, - // we use Port number to link the desired Service Port and the existed Service Port in the nested loop - if dport.Port == eport.Port { - dport.NodePort = eport.NodePort - desired.Spec.Ports[i] = dport - break - } - } - } - return nil -} - // sortEnvByName in order to avoid syncing same template into different results func sortEnvByName(envlist []core.EnvVar) []core.EnvVar { if envlist == nil || len(envlist) < 1 { From 9091d2901df91e7c29199d58f892ccd2a1fc01fd Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Tue, 17 Mar 2020 17:19:06 +0800 Subject: [PATCH 3/8] add lb config --- pkg/monitor/monitor/util.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/monitor/monitor/util.go b/pkg/monitor/monitor/util.go index c19cfa1d6e..55851b5e7d 100644 --- a/pkg/monitor/monitor/util.go +++ b/pkg/monitor/monitor/util.go @@ -692,6 +692,11 @@ func getMonitorService(monitor *v1alpha1.TidbMonitor) []*core.Service { Selector: labels, }, } + if monitor.BasePrometheusSpec().ServiceType() == core.ServiceTypeLoadBalancer { + if monitor.Spec.Prometheus.Service.LoadBalancerIP != nil { + prometheusService.Spec.LoadBalancerIP = *monitor.Spec.Prometheus.Service.LoadBalancerIP + } + } reloaderService := &core.Service{ ObjectMeta: meta.ObjectMeta{ @@ -718,6 +723,12 @@ func getMonitorService(monitor *v1alpha1.TidbMonitor) []*core.Service { }, } + if monitor.BaseReloaderSpec().ServiceType() == core.ServiceTypeLoadBalancer { + if monitor.Spec.Reloader.Service.LoadBalancerIP != nil { + reloaderService.Spec.LoadBalancerIP = *monitor.Spec.Reloader.Service.LoadBalancerIP + } + } + services = append(services, prometheusService, reloaderService) if monitor.Spec.Grafana != nil { grafanaService := &core.Service{ @@ -744,6 +755,13 @@ func getMonitorService(monitor *v1alpha1.TidbMonitor) []*core.Service { }, }, } + + if monitor.BaseGrafanaSpec().ServiceType() == core.ServiceTypeLoadBalancer { + if monitor.Spec.Grafana.Service.LoadBalancerIP != nil { + grafanaService.Spec.LoadBalancerIP = *monitor.Spec.Grafana.Service.LoadBalancerIP + } + } + services = append(services, grafanaService) } return services From 4c4ecebbd3f5b4839a843697be6ac2dc725bf82e Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Tue, 17 Mar 2020 17:28:24 +0800 Subject: [PATCH 4/8] revert chart change --- charts/tidb-operator/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tidb-operator/values.yaml b/charts/tidb-operator/values.yaml index 6c026a5d1d..dd54254ecd 100644 --- a/charts/tidb-operator/values.yaml +++ b/charts/tidb-operator/values.yaml @@ -12,7 +12,7 @@ rbac: timezone: UTC # operatorImage is TiDB Operator image -operatorImage: yisa/operator:latest +operatorImage: pingcap/tidb-operator:v1.1.0-beta.2 imagePullPolicy: IfNotPresent # tidbBackupManagerImage is tidb backup manager image From 9850aaefbe07167a7dfc49fe197fa5834ed9ccc7 Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Tue, 17 Mar 2020 20:35:21 +0800 Subject: [PATCH 5/8] add e2e case --- pkg/controller/generic_control.go | 5 +++-- tests/e2e/tidbcluster/tidbcluster.go | 24 ++++++++++++++++++++++++ tests/pkg/fixture/fixture.go | 6 ++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/pkg/controller/generic_control.go b/pkg/controller/generic_control.go index afb190652b..60bfb8a13d 100644 --- a/pkg/controller/generic_control.go +++ b/pkg/controller/generic_control.go @@ -277,8 +277,9 @@ func (w *typedWrapper) CreateOrUpdateService(controller runtime.Object, svc *cor existingSvc.Spec = desiredSvc.Spec existingSvc.Spec.ClusterIP = clusterIp - // If the existed service and the desired service is both NodePort, we shall guaranteed the nodePort unchanged - if serviceType == corev1.ServiceTypeNodePort && desiredSvc.Spec.Type == corev1.ServiceTypeNodePort { + // If the existed service and the desired service is NodePort or LoadBalancerType, we should keep the nodePort unchanged. + if (serviceType == corev1.ServiceTypeNodePort || serviceType == corev1.ServiceTypeLoadBalancer) && + (desiredSvc.Spec.Type == corev1.ServiceTypeNodePort || desiredSvc.Spec.Type == corev1.ServiceTypeLoadBalancer) { for i, dport := range existingSvc.Spec.Ports { for _, eport := range ports { // Because the portName could be edited, diff --git a/tests/e2e/tidbcluster/tidbcluster.go b/tests/e2e/tidbcluster/tidbcluster.go index b53e99cd38..4adf3f597a 100644 --- a/tests/e2e/tidbcluster/tidbcluster.go +++ b/tests/e2e/tidbcluster/tidbcluster.go @@ -765,6 +765,30 @@ var _ = ginkgo.Describe("[tidb-operator] TiDBCluster", func() { value, existed = pv.Labels[label.ManagedByLabelKey] framework.ExpectEqual(existed, true) framework.ExpectEqual(value, label.TiDBOperator) + + // update TidbMonitor and check whether portName is updated and the nodePort is unchanged + tm, err = cli.PingcapV1alpha1().TidbMonitors(ns).Get(tm.Name, metav1.GetOptions{}) + framework.ExpectNoError(err, "fetch latest tidbmonitor error") + tm.Spec.Prometheus.Service.Type = corev1.ServiceTypeNodePort + tm, err = cli.PingcapV1alpha1().TidbMonitors(ns).Update(tm) + framework.ExpectNoError(err, "update tidbmonitor service type error") + + prometheuSvc, err := c.CoreV1().Services(ns).Get(fmt.Sprintf("%s-prometheus", tm.Name), metav1.GetOptions{}) + framework.ExpectNoError(err, "tidbmonitor get prometheus service err") + framework.ExpectEqual(len(prometheuSvc.Spec.Ports), 1) + framework.ExpectEqual(string(prometheuSvc.Spec.Type), string(corev1.ServiceTypeNodePort)) + targetPort := prometheuSvc.Spec.Ports[0].NodePort + + newPortName := "any-other-word" + tm.Spec.Prometheus.Service.PortName = &newPortName + tm, err = cli.PingcapV1alpha1().TidbMonitors(ns).Update(tm) + framework.ExpectNoError(err, "update tidbmonitor service portName error") + prometheuSvc, err = c.CoreV1().Services(ns).Get(fmt.Sprintf("%s-prometheus", tm.Name), metav1.GetOptions{}) + framework.ExpectNoError(err, "tidbmonitor get prometheus service again err") + framework.ExpectEqual(len(prometheuSvc.Spec.Ports), 1) + framework.ExpectEqual(string(prometheuSvc.Spec.Type), string(corev1.ServiceTypeNodePort)) + framework.ExpectEqual(targetPort, prometheuSvc.Spec.Ports[0].NodePort) + }) ginkgo.It("[Feature: AdvancedStatefulSet] Upgrading tidb cluster while pods are not consecutive", func() { diff --git a/tests/pkg/fixture/fixture.go b/tests/pkg/fixture/fixture.go index 85f37707cf..2e78d03c30 100644 --- a/tests/pkg/fixture/fixture.go +++ b/tests/pkg/fixture/fixture.go @@ -182,6 +182,12 @@ func NewTidbMonitor(name, namespace string, tc *v1alpha1.TidbCluster, grafanaEna Type: corev1.ServiceTypeClusterIP, Annotations: map[string]string{}, }, + Envs: map[string]string{ + "A": "B", + "foo": "hello", + "bar": "query", + "some": "any", + }, } } if persist { From 998b95daaa1229d0e088f7ab3a77ef9cb0e12c32 Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Tue, 17 Mar 2020 20:56:58 +0800 Subject: [PATCH 6/8] revise tidbmonitor e2e case --- tests/e2e/tidbcluster/tidbcluster.go | 47 ++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/tests/e2e/tidbcluster/tidbcluster.go b/tests/e2e/tidbcluster/tidbcluster.go index 4adf3f597a..474d83f0ed 100644 --- a/tests/e2e/tidbcluster/tidbcluster.go +++ b/tests/e2e/tidbcluster/tidbcluster.go @@ -773,22 +773,49 @@ var _ = ginkgo.Describe("[tidb-operator] TiDBCluster", func() { tm, err = cli.PingcapV1alpha1().TidbMonitors(ns).Update(tm) framework.ExpectNoError(err, "update tidbmonitor service type error") - prometheuSvc, err := c.CoreV1().Services(ns).Get(fmt.Sprintf("%s-prometheus", tm.Name), metav1.GetOptions{}) - framework.ExpectNoError(err, "tidbmonitor get prometheus service err") - framework.ExpectEqual(len(prometheuSvc.Spec.Ports), 1) - framework.ExpectEqual(string(prometheuSvc.Spec.Type), string(corev1.ServiceTypeNodePort)) - targetPort := prometheuSvc.Spec.Ports[0].NodePort + var targetPort int32 + err = wait.Poll(5*time.Second, 5*time.Minute, func() (done bool, err error) { + prometheusSvc, err := c.CoreV1().Services(ns).Get(fmt.Sprintf("%s-prometheus", tm.Name), metav1.GetOptions{}) + if err != nil { + return false, nil + } + if len(prometheusSvc.Spec.Ports) != 1 { + return false, nil + } + if prometheusSvc.Spec.Type != corev1.ServiceTypeNodePort { + return false, nil + } + targetPort = prometheusSvc.Spec.Ports[0].NodePort + return true, nil + }) + framework.ExpectNoError(err, "first update tidbmonitor service error") + tm, err = cli.PingcapV1alpha1().TidbMonitors(ns).Get(tm.Name, metav1.GetOptions{}) + framework.ExpectNoError(err, "fetch latest tidbmonitor again error") newPortName := "any-other-word" tm.Spec.Prometheus.Service.PortName = &newPortName tm, err = cli.PingcapV1alpha1().TidbMonitors(ns).Update(tm) framework.ExpectNoError(err, "update tidbmonitor service portName error") - prometheuSvc, err = c.CoreV1().Services(ns).Get(fmt.Sprintf("%s-prometheus", tm.Name), metav1.GetOptions{}) - framework.ExpectNoError(err, "tidbmonitor get prometheus service again err") - framework.ExpectEqual(len(prometheuSvc.Spec.Ports), 1) - framework.ExpectEqual(string(prometheuSvc.Spec.Type), string(corev1.ServiceTypeNodePort)) - framework.ExpectEqual(targetPort, prometheuSvc.Spec.Ports[0].NodePort) + err = wait.Poll(5*time.Second, 5*time.Minute, func() (done bool, err error) { + prometheusSvc, err := c.CoreV1().Services(ns).Get(fmt.Sprintf("%s-prometheus", tm.Name), metav1.GetOptions{}) + if err != nil { + return false, nil + } + if len(prometheusSvc.Spec.Ports) != 1 { + return false, nil + } + if prometheusSvc.Spec.Type != corev1.ServiceTypeNodePort { + return false, nil + } + if prometheusSvc.Spec.Ports[0].Name != "any-other-word" { + return false, nil + } + if prometheusSvc.Spec.Ports[0].NodePort != targetPort { + return false, nil + } + return true, nil + }) }) ginkgo.It("[Feature: AdvancedStatefulSet] Upgrading tidb cluster while pods are not consecutive", func() { From 253f48e2dc5b26d2e6f2d6fa6e6911d5d562cc12 Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Tue, 17 Mar 2020 21:06:47 +0800 Subject: [PATCH 7/8] Update tidbcluster.go --- tests/e2e/tidbcluster/tidbcluster.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e/tidbcluster/tidbcluster.go b/tests/e2e/tidbcluster/tidbcluster.go index 474d83f0ed..a5d1437ccd 100644 --- a/tests/e2e/tidbcluster/tidbcluster.go +++ b/tests/e2e/tidbcluster/tidbcluster.go @@ -816,6 +816,7 @@ var _ = ginkgo.Describe("[tidb-operator] TiDBCluster", func() { } return true, nil }) + framework.ExpectNoError(err, "second update tidbmonitor service error") }) ginkgo.It("[Feature: AdvancedStatefulSet] Upgrading tidb cluster while pods are not consecutive", func() { From 3d92acbfadc2bc4e2f76ad180e95b60d69a93424 Mon Sep 17 00:00:00 2001 From: Song Gao <2695690803@qq.com> Date: Thu, 19 Mar 2020 11:35:06 +0800 Subject: [PATCH 8/8] address the comment --- pkg/controller/generic_control.go | 2 +- pkg/monitor/monitor/monitor_manager.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/controller/generic_control.go b/pkg/controller/generic_control.go index 60bfb8a13d..efaa6648de 100644 --- a/pkg/controller/generic_control.go +++ b/pkg/controller/generic_control.go @@ -284,7 +284,7 @@ func (w *typedWrapper) CreateOrUpdateService(controller runtime.Object, svc *cor for _, eport := range ports { // Because the portName could be edited, // we use Port number to link the desired Service Port and the existed Service Port in the nested loop - if dport.Port == eport.Port { + if dport.Port == eport.Port && dport.Protocol == eport.Protocol { dport.NodePort = eport.NodePort existingSvc.Spec.Ports[i] = dport break diff --git a/pkg/monitor/monitor/monitor_manager.go b/pkg/monitor/monitor/monitor_manager.go index b977439de4..065d1c8d1c 100644 --- a/pkg/monitor/monitor/monitor_manager.go +++ b/pkg/monitor/monitor/monitor_manager.go @@ -32,7 +32,6 @@ import ( type MonitorManager struct { typedControl controller.TypedControlInterface deploymentLister appslisters.DeploymentLister - svcLister corelisters.ServiceLister tcLister v1alpha1listers.TidbClusterLister pvLister corelisters.PersistentVolumeLister pvControl controller.PVControlInterface @@ -55,7 +54,6 @@ func NewMonitorManager( return &MonitorManager{ typedControl: typedControl, deploymentLister: kubeInformerFactory.Apps().V1().Deployments().Lister(), - svcLister: kubeInformerFactory.Core().V1().Services().Lister(), tcLister: informerFactory.Pingcap().V1alpha1().TidbClusters().Lister(), pvControl: controller.NewRealPVControl(kubeCli, pvcLister, pvLister, recorder), pvLister: pvLister,