🚒 add error message in controller
This commit is contained in:
2
Makefile
2
Makefile
@@ -7,7 +7,7 @@ BIN ?= ks-apiserver
|
||||
|
||||
IMG ?= kubespheredev/ks-apiserver
|
||||
OUTPUT_DIR=bin
|
||||
|
||||
GOFLAGS=-mod=vendor
|
||||
define ALL_HELP_INFO
|
||||
# Build code.
|
||||
#
|
||||
|
||||
@@ -2,6 +2,8 @@ package application
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
applicationclient "github.com/kubernetes-sigs/application/pkg/client/clientset/versioned"
|
||||
applicationinformers "github.com/kubernetes-sigs/application/pkg/client/informers/externalversions/app/v1beta1"
|
||||
applicationlister "github.com/kubernetes-sigs/application/pkg/client/listers/app/v1beta1"
|
||||
@@ -25,7 +27,6 @@ import (
|
||||
servicemeshlisters "kubesphere.io/kubesphere/pkg/client/listers/servicemesh/v1alpha2"
|
||||
"kubesphere.io/kubesphere/pkg/controller/virtualservice/util"
|
||||
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -148,11 +149,10 @@ func NewApplicationController(serviceInformer coreinformers.ServiceInformer,
|
||||
}
|
||||
|
||||
func (v *ApplicationController) Start(stopCh <-chan struct{}) error {
|
||||
v.Run(2, stopCh)
|
||||
return nil
|
||||
return v.Run(2, stopCh)
|
||||
}
|
||||
|
||||
func (v *ApplicationController) Run(workers int, stopCh <-chan struct{}) {
|
||||
func (v *ApplicationController) Run(workers int, stopCh <-chan struct{}) error {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer v.queue.ShutDown()
|
||||
|
||||
@@ -160,14 +160,14 @@ func (v *ApplicationController) Run(workers int, stopCh <-chan struct{}) {
|
||||
defer log.Info("shutting down application controller")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, v.deploymentSynced, v.statefulSetSynced, v.serviceSynced, v.strategySynced, v.servicePolicySynced, v.applicationSynced) {
|
||||
return
|
||||
return fmt.Errorf("failed to wait for caches to sync")
|
||||
}
|
||||
|
||||
for i := 0; i < workers; i++ {
|
||||
go wait.Until(v.worker, v.workerLoopPeriod, stopCh)
|
||||
}
|
||||
|
||||
<-stopCh
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *ApplicationController) worker() {
|
||||
|
||||
@@ -148,12 +148,10 @@ func NewDestinationRuleController(deploymentInformer informersv1.DeploymentInfor
|
||||
}
|
||||
|
||||
func (v *DestinationRuleController) Start(stopCh <-chan struct{}) error {
|
||||
v.Run(5, stopCh)
|
||||
|
||||
return nil
|
||||
return v.Run(5, stopCh)
|
||||
}
|
||||
|
||||
func (v *DestinationRuleController) Run(workers int, stopCh <-chan struct{}) {
|
||||
func (v *DestinationRuleController) Run(workers int, stopCh <-chan struct{}) error {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer v.queue.ShutDown()
|
||||
|
||||
@@ -161,7 +159,7 @@ func (v *DestinationRuleController) Run(workers int, stopCh <-chan struct{}) {
|
||||
defer log.Info("shutting down destinationrule controller")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, v.serviceSynced, v.destinationRuleSynced, v.deploymentSynced, v.servicePolicySynced) {
|
||||
return
|
||||
return fmt.Errorf("failed to wait for caches to sync")
|
||||
}
|
||||
|
||||
for i := 0; i < workers; i++ {
|
||||
@@ -169,6 +167,7 @@ func (v *DestinationRuleController) Run(workers int, stopCh <-chan struct{}) {
|
||||
}
|
||||
|
||||
<-stopCh
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *DestinationRuleController) enqueueService(obj interface{}) {
|
||||
|
||||
@@ -95,12 +95,10 @@ func NewJobController(jobInformer batchv1informers.JobInformer, client clientset
|
||||
}
|
||||
|
||||
func (v *JobController) Start(stopCh <-chan struct{}) error {
|
||||
v.Run(5, stopCh)
|
||||
|
||||
return nil
|
||||
return v.Run(5, stopCh)
|
||||
}
|
||||
|
||||
func (v *JobController) Run(workers int, stopCh <-chan struct{}) {
|
||||
func (v *JobController) Run(workers int, stopCh <-chan struct{}) error {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer v.queue.ShutDown()
|
||||
|
||||
@@ -108,7 +106,7 @@ func (v *JobController) Run(workers int, stopCh <-chan struct{}) {
|
||||
defer log.Info("shutting down job controller")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, v.jobSynced) {
|
||||
return
|
||||
return fmt.Errorf("failed to wait for caches to sync")
|
||||
}
|
||||
|
||||
for i := 0; i < workers; i++ {
|
||||
@@ -116,6 +114,7 @@ func (v *JobController) Run(workers int, stopCh <-chan struct{}) {
|
||||
}
|
||||
|
||||
<-stopCh
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *JobController) enqueueJob(obj interface{}) {
|
||||
|
||||
@@ -145,11 +145,10 @@ func NewVirtualServiceController(serviceInformer coreinformers.ServiceInformer,
|
||||
}
|
||||
|
||||
func (v *VirtualServiceController) Start(stopCh <-chan struct{}) error {
|
||||
v.Run(5, stopCh)
|
||||
return nil
|
||||
return v.Run(5, stopCh)
|
||||
}
|
||||
|
||||
func (v *VirtualServiceController) Run(workers int, stopCh <-chan struct{}) {
|
||||
func (v *VirtualServiceController) Run(workers int, stopCh <-chan struct{}) error {
|
||||
defer utilruntime.HandleCrash()
|
||||
defer v.queue.ShutDown()
|
||||
|
||||
@@ -157,7 +156,7 @@ func (v *VirtualServiceController) Run(workers int, stopCh <-chan struct{}) {
|
||||
defer log.Info("shutting down virtualservice controller")
|
||||
|
||||
if !cache.WaitForCacheSync(stopCh, v.serviceSynced, v.virtualServiceSynced, v.destinationRuleSynced, v.strategySynced) {
|
||||
return
|
||||
return fmt.Errorf("failed to wait for caches to sync")
|
||||
}
|
||||
|
||||
for i := 0; i < workers; i++ {
|
||||
@@ -165,6 +164,7 @@ func (v *VirtualServiceController) Run(workers int, stopCh <-chan struct{}) {
|
||||
}
|
||||
|
||||
<-stopCh
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *VirtualServiceController) enqueueService(obj interface{}) {
|
||||
|
||||
Reference in New Issue
Block a user