func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.TikvCluster, svc *corev1.Service) error {
	defer ssc.createServiceTracker.Inc()
	if ssc.createServiceTracker.ErrorReady() {
		defer ssc.createServiceTracker.Reset()
		return ssc.createServiceTracker.GetError()
	}

	err := ssc.SvcIndexer.Add(svc)
	if err != nil {
		return err
	}
	// add a new endpoint to indexer if svc has selector
	if svc.Spec.Selector != nil {
		eps := &corev1.Endpoints{
			ObjectMeta: metav1.ObjectMeta{
				Name:      svc.Name,
				Namespace: svc.Namespace,
			},
		}
		return ssc.EpsIndexer.Add(eps)
	}
	return nil
}
// CreateService adds the service to SvcIndexer
CreateService adds the service to SvcIndexer
// CreateService adds the service to SvcIndexer
func (ssc *FakeServiceControl) CreateService(_ *v1alpha1.TikvCluster, svc *corev1.Service) error {
	defer ssc.createServiceTracker.Inc()
	if ssc.createServiceTracker.ErrorReady() {
		defer ssc.createServiceTracker.Reset()
		return ssc.createServiceTracker.GetError()
	}
	err := ssc.SvcIndexer.Add(svc)
	if err != nil {
		return err
	}
	if svc.Spec.Selector != nil {
		eps := &corev1.Endpoints{
			ObjectMeta: metav1.ObjectMeta{
				Name:      svc.Name,
				Namespace: svc.Namespace,
			},
		}
		return ssc.EpsIndexer.Add(eps)
	}
	return nil
}
func ( ssc * FakeServiceControl ) CreateService ( _ * v1alpha1 . TikvCluster , svc * corev1 . Service ) error { defer ssc . createServiceTracker . Inc ( ) if ssc . createServiceTracker . ErrorReady ( ) { defer ssc . createServiceTracker . Reset ( ) return ssc . createServiceTracker . GetError ( ) } err := ssc . SvcIndexer . Add ( svc ) if err != nil { return err } if svc . Spec . Selector != nil { eps := & corev1 . Endpoints { ObjectMeta : metav1 . ObjectMeta { Name : svc . Name , Namespace : svc . Namespace , } , } return ssc . EpsIndexer . Add ( eps ) } return nil }
CreateService adds the service to SvcIndexer
CreateService adds the service to SvcIndexer
// add a new endpoint to indexer if svc has selector