plan/conflict.go
func (s PerResource) ResolveUpdate(current *endpoint.Endpoint, candidates []*endpoint.Endpoint) *endpoint.Endpoint {
	currentResource := current.Labels[endpoint.ResourceLabelKey] // resource which has already acquired the DNS
	// TODO: sort candidates only needed because we can still have two endpoints from same resource here. We sort for consistency
	// TODO: remove once single endpoint can have multiple targets
	sort.SliceStable(candidates, func(i, j int) bool {
		return s.less(candidates[i], candidates[j])
	})
	for _, ep := range candidates {
		if ep.Labels[endpoint.ResourceLabelKey] == currentResource {
			return ep
		}
	}
	return s.ResolveCreate(candidates)
}
func (s PerResource) ResolveUpdate(current *endpoint.Endpoint, candidates []*endpoint.Endpoint) *endpoint.Endpoint {
	currentResource := current.Labels[endpoint.ResourceLabelKey] // resource which has already acquired the DNS
	// TODO: sort candidates only needed because we can still have two endpoints from same resource here. We sort for consistency
	// TODO: remove once single endpoint can have multiple targets
	sort.SliceStable(candidates, func(i, j int) bool {
		return s.less(candidates[i], candidates[j])
	})
	for _, ep := range candidates {
		if ep.Labels[endpoint.ResourceLabelKey] == currentResource {
			return ep
		}
	}
	return s.ResolveCreate(candidates)
}
func ( s PerResource ) ResolveUpdate ( current * endpoint . Endpoint , candidates [ ] * endpoint . Endpoint ) * endpoint . Endpoint { currentResource := current . Labels [ endpoint . ResourceLabelKey ] // resource which has already acquired the DNS // TODO: sort candidates only needed because we can still have two endpoints from same resource here. We sort for consistency // TODO: remove once single endpoint can have multiple targets sort . SliceStable ( candidates , func ( i , j int ) bool { return s . less ( candidates [ i ] , candidates [ j ] ) } ) for _ , ep := range candidates { if ep . Labels [ endpoint . ResourceLabelKey ] == currentResource { return ep } } return s . ResolveCreate ( candidates ) }
// ResolveUpdate is invoked when dns name is already owned by "current" endpoint
// ResolveUpdate uses "current" record as base and updates it accordingly with new version of same resource
// if it doesn't exist then pick min
ResolveUpdate is invoked when dns name is already owned by current endpoint ResolveUpdate uses current record as base and updates it accordingly with new version of same resource if it doesn t exist then pick min