Clean up CA shutdown logic and error

This commit is contained in:
Kyle Havlovitz 2020-09-15 12:28:58 -07:00
parent 49056fe70f
commit 7ffef62ed7
2 changed files with 7 additions and 8 deletions

View File

@ -126,7 +126,7 @@ func (v *VaultProvider) renewToken(ctx context.Context, renewer *vaultapi.Renewe
case err := <-renewer.DoneCh(): case err := <-renewer.DoneCh():
if err != nil { if err != nil {
v.logger.Error(fmt.Sprintf("Error renewing token for Vault provider: %v", err)) v.logger.Error("Error renewing token for Vault provider", "error", err)
} }
// Renewer routine has finished, so start it again. // Renewer routine has finished, so start it again.

View File

@ -567,21 +567,20 @@ func (s *Server) startConnectLeader() {
// stopConnectLeader stops connect specific leader functions. // stopConnectLeader stops connect specific leader functions.
func (s *Server) stopConnectLeader() { func (s *Server) stopConnectLeader() {
s.caProviderReconfigurationLock.Lock() s.leaderRoutineManager.Stop(secondaryCARootWatchRoutineName)
defer s.caProviderReconfigurationLock.Unlock() s.leaderRoutineManager.Stop(intentionReplicationRoutineName)
s.leaderRoutineManager.Stop(caRootPruningRoutineName)
s.stopConnectLeaderEnterprise()
// If the provider implements NeedsStop, we call Stop to perform any shutdown actions. // If the provider implements NeedsStop, we call Stop to perform any shutdown actions.
s.caProviderReconfigurationLock.Lock()
defer s.caProviderReconfigurationLock.Unlock()
provider, _ := s.getCAProvider() provider, _ := s.getCAProvider()
if provider != nil { if provider != nil {
if needsStop, ok := provider.(ca.NeedsStop); ok { if needsStop, ok := provider.(ca.NeedsStop); ok {
needsStop.Stop() needsStop.Stop()
} }
} }
s.leaderRoutineManager.Stop(secondaryCARootWatchRoutineName)
s.leaderRoutineManager.Stop(intentionReplicationRoutineName)
s.leaderRoutineManager.Stop(caRootPruningRoutineName)
s.stopConnectLeaderEnterprise()
} }
func (s *Server) runCARootPruning(ctx context.Context) error { func (s *Server) runCARootPruning(ctx context.Context) error {