Use ClusterID to check for readiness

The TrustDomain is populated from the Host() method which includes the
hard-coded "consul" domain. This means that despite having an empty
cluster ID, the TrustDomain won't be empty.
This commit is contained in:
freddygv 2021-11-10 10:45:22 -07:00
parent aca0576cd1
commit da5bcc574e
1 changed files with 3 additions and 3 deletions

View File

@ -29,12 +29,12 @@ func (s *Server) getCARoots(ws memdb.WatchSet, state *state.Store) (*structs.Ind
// defensive. // defensive.
return nil, fmt.Errorf("no cluster trust domain setup") return nil, fmt.Errorf("no cluster trust domain setup")
} }
if signingID.ClusterID == "" {
indexedRoots.TrustDomain = signingID.Host()
if indexedRoots.TrustDomain == "" {
return nil, fmt.Errorf("CA has not finished initializing") return nil, fmt.Errorf("CA has not finished initializing")
} }
indexedRoots.TrustDomain = signingID.Host()
indexedRoots.Index, indexedRoots.Roots = index, roots indexedRoots.Index, indexedRoots.Roots = index, roots
if indexedRoots.Roots == nil { if indexedRoots.Roots == nil {
indexedRoots.Roots = make(structs.CARoots, 0) indexedRoots.Roots = make(structs.CARoots, 0)