Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move autopilot initialization to prevent race #5322

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions agent/consul/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ func NewServerLogger(config *Config, logger *log.Logger, tokens *token.Store) (*
s.Shutdown()
return nil, err
}


// Initialize Autopilot. This must happen before starting leadership monitoring
// as establishing leadership could attempt to use autopilot and cause a panic.
s.initAutopilot(config)

// Start monitoring leadership. This must happen after Serf is set up
// since it can fire events when leadership is obtained.
Expand All @@ -477,9 +482,6 @@ func NewServerLogger(config *Config, logger *log.Logger, tokens *token.Store) (*
// Start the metrics handlers.
go s.sessionStats()

// Initialize Autopilot
s.initAutopilot(config)

return s, nil
}

Expand Down