mirror of https://github.com/status-im/consul.git
ca: Only initialize clusterID in the primary
The secondary must get the clusterID from the primary
This commit is contained in:
parent
01bd3d118d
commit
d9110136f2
|
@ -213,7 +213,8 @@ func (c *CAManager) initializeCAConfig() (*structs.CAConfiguration, error) {
|
|||
}
|
||||
if config == nil {
|
||||
config = c.serverConf.CAConfig
|
||||
if config.ClusterID == "" {
|
||||
|
||||
if c.serverConf.Datacenter == c.serverConf.PrimaryDatacenter && config.ClusterID == "" {
|
||||
id, err := uuid.GenerateUUID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -180,8 +180,6 @@ func (s *Store) caSetConfigTxn(idx uint64, tx WriteTxn, config *structs.CAConfig
|
|||
if prev != nil {
|
||||
existing := prev.(*structs.CAConfiguration)
|
||||
config.CreateIndex = existing.CreateIndex
|
||||
// Allow the ClusterID to change if it's provided by an internal operation, such
|
||||
// as a primary datacenter being switched to secondary mode.
|
||||
if config.ClusterID == "" {
|
||||
config.ClusterID = existing.ClusterID
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue