Skip to content

Commit

Permalink
fix: stopCh can't work for start operator (#1857)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiuker authored Nov 14, 2023
1 parent 85ec4d2 commit e2b0094
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pkg/controller/main-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,19 +592,22 @@ func (c *Controller) Start(threadiness int, stopCh <-chan struct{}) error {
Err: nil,
}
}()

for oerr := range notificationChannel {
switch oerr.Type {
case STSServerNotification:
if !errors.Is(oerr.Err, http.ErrServerClosed) {
klog.Errorf("STS API Server stopped: %v, going to restart", oerr.Err)
go c.startSTSAPIServer(ctx, notificationChannel)
for {
select {
case oerr := <-notificationChannel:
switch oerr.Type {
case STSServerNotification:
if !errors.Is(oerr.Err, http.ErrServerClosed) {
klog.Errorf("STS API Server stopped: %v, going to restart", oerr.Err)
go c.startSTSAPIServer(ctx, notificationChannel)
}
case LeaderElection:
return nil
}
case LeaderElection:
case <-stopCh:
return nil
}
}
return nil
}

// Stop is called to shutdown the controller
Expand Down

0 comments on commit e2b0094

Please sign in to comment.