Skip to content

Commit

Permalink
CO-2897 trigger controller restart instead of crashing the agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiberiu Gal committed Mar 1, 2024
1 parent 00559ef commit 6b00b06
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/services/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func New(

func (c *Controller) Run(ctx context.Context) error {
defer c.queue.ShutDown()

var controllerRuntimeError error
ctx, cancel := context.WithCancel(ctx)
defer cancel()

Expand Down Expand Up @@ -212,7 +212,8 @@ func (c *Controller) Run(ctx context.Context) error {
queueContent := c.debugQueueContent(maxItems)
log := c.log.WithField("queue_content", queueContent)
log.Errorf("error while collecting initial snapshot: %v", err)
c.log.Infof("restarting controller after failure to collect initial snapshot")
c.log.Infof("restarting agent after failure to collect initial snapshot")
controllerRuntimeError = err
c.triggerRestart()
return
}
Expand All @@ -239,7 +240,7 @@ func (c *Controller) Run(ctx context.Context) error {

c.pollQueueUntilShutdown()

return nil
return controllerRuntimeError
}

func (c *Controller) startConditionalInformersWithWatcher(ctx context.Context, conditionalInformers []conditionalInformer) {
Expand Down

0 comments on commit 6b00b06

Please sign in to comment.