func (c *Controller) RunOnce() error {
	records, err := c.Registry.Records()
	if err != nil {
		registryErrors.Inc()
		return err
	}
	registryEndpointsTotal.Set(float64(len(records)))

	endpoints, err := c.Source.Endpoints()
	if err != nil {
		sourceErrors.Inc()
		return err
	}
	sourceEndpointsTotal.Set(float64(len(endpoints)))

	plan := &plan.Plan{
		Policies: []plan.Policy{c.Policy},
		Current:  records,
		Desired:  endpoints,
	}

	plan = plan.Calculate()

	err = c.Registry.ApplyChanges(plan.Changes)
	if err != nil {
		registryErrors.Inc()
		return err
	}
	return nil
}
func (c *Controller) RunOnce() error {
	records, err := c.Registry.Records()
	if err != nil {
		registryErrors.Inc()
		return err
	}
	registryEndpointsTotal.Set(float64(len(records)))

	endpoints, err := c.Source.Endpoints()
	if err != nil {
		sourceErrors.Inc()
		return err
	}
	sourceEndpointsTotal.Set(float64(len(endpoints)))

	plan := &plan.Plan{
		Policies: []plan.Policy{c.Policy},
		Current:  records,
		Desired:  endpoints,
	}

	plan = plan.Calculate()

	err = c.Registry.ApplyChanges(plan.Changes)
	if err != nil {
		registryErrors.Inc()
		return err
	}
	return nil
}
// RunOnce runs a single iteration of a reconciliation loop.