Merge pull request #27511 from quinton-hoole/2016-06-15-improve-logging-in-federation-service-controller
Automatic merge from submit-queue Improve error logging on DNS updates for federated services This makes debugging easier. Prior to this, the logs would e.g. contain "Successfully updated 4 out of 4 DNS records", when in fact zero DNS records had been successfully updated. It's difficult to debug what's happening with such confusing log messages.
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
	 k8s-merge-robot
					k8s-merge-robot