ca: Only initialize clusterID in the primary
The secondary must get the clusterID from the primary
This commit is contained in:
parent
3173582b75
commit
69ad7c0544
|
@ -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