Improve error detection and logging on DNS updates for federated services.
This commit is contained in:
		@@ -707,18 +707,23 @@ func (s *ServiceController) updateDNSRecords(services []*cachedService, clusters
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// lockedUpdateDNSRecords Updates the DNS records of a service, assuming we hold the mutex
 | 
					// lockedUpdateDNSRecords Updates the DNS records of a service, assuming we hold the mutex
 | 
				
			||||||
// associated with the service.
 | 
					// associated with the service.
 | 
				
			||||||
// TODO: quinton: Still screwed up in the same way as above.  Fix.
 | 
					 | 
				
			||||||
func (s *ServiceController) lockedUpdateDNSRecords(service *cachedService, clusterNames []string) error {
 | 
					func (s *ServiceController) lockedUpdateDNSRecords(service *cachedService, clusterNames []string) error {
 | 
				
			||||||
	if !wantsDNSRecords(service.appliedState) {
 | 
						if !wantsDNSRecords(service.appliedState) {
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						ensuredCount := 0
 | 
				
			||||||
	for key := range s.clusterCache.clientMap {
 | 
						for key := range s.clusterCache.clientMap {
 | 
				
			||||||
		for _, clusterName := range clusterNames {
 | 
							for _, clusterName := range clusterNames {
 | 
				
			||||||
			if key == clusterName {
 | 
								if key == clusterName {
 | 
				
			||||||
				s.ensureDnsRecords(clusterName, service)
 | 
									s.ensureDnsRecords(clusterName, service)
 | 
				
			||||||
 | 
									ensuredCount += 1
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if ensuredCount < len(clusterNames) {
 | 
				
			||||||
 | 
							return fmt.Errorf("Failed to update DNS records for %d of %d clusters for service %v due to missing clients for those clusters",
 | 
				
			||||||
 | 
								len(clusterNames)-ensuredCount, len(clusterNames), service)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user