func endpointsFromIngress(ing *v1beta1.Ingress, ignoreHostnameAnnotation bool) []*endpoint.Endpoint {
	var endpoints []*endpoint.Endpoint

	ttl, err := getTTLFromAnnotations(ing.Annotations)
	if err != nil {
		log.Warn(err)
	}

	targets := getTargetsFromTargetAnnotation(ing.Annotations)

	if len(targets) == 0 {
		targets = targetsFromIngressStatus(ing.Status)
	}

	providerSpecific := getProviderSpecificAnnotations(ing.Annotations)

	for _, rule := range ing.Spec.Rules {
		if rule.Host == "" {
			continue
		}
		endpoints = append(endpoints, endpointsForHostname(rule.Host, targets, ttl, providerSpecific)...)
	}

	for _, tls := range ing.Spec.TLS {
		for _, host := range tls.Hosts {
			if host == "" {
				continue
			}
			endpoints = append(endpoints, endpointsForHostname(host, targets, ttl, providerSpecific)...)
		}
	}

	// Skip endpoints if we do not want entries from annotations
	if !ignoreHostnameAnnotation {
		hostnameList := getHostnamesFromAnnotations(ing.Annotations)
		for _, hostname := range hostnameList {
			endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific)...)
		}
	}
	return endpoints
}
func endpointsFromIngress(ing *v1beta1.Ingress, ignoreHostnameAnnotation bool) []*endpoint.Endpoint {
	var endpoints []*endpoint.Endpoint

	ttl, err := getTTLFromAnnotations(ing.Annotations)
	if err != nil {
		log.Warn(err)
	}

	targets := getTargetsFromTargetAnnotation(ing.Annotations)

	if len(targets) == 0 {
		targets = targetsFromIngressStatus(ing.Status)
	}

	providerSpecific := getProviderSpecificAnnotations(ing.Annotations)

	for _, rule := range ing.Spec.Rules {
		if rule.Host == "" {
			continue
		}
		endpoints = append(endpoints, endpointsForHostname(rule.Host, targets, ttl, providerSpecific)...)
	}

	for _, tls := range ing.Spec.TLS {
		for _, host := range tls.Hosts {
			if host == "" {
				continue
			}
			endpoints = append(endpoints, endpointsForHostname(host, targets, ttl, providerSpecific)...)
		}
	}

	// Skip endpoints if we do not want entries from annotations
	if !ignoreHostnameAnnotation {
		hostnameList := getHostnamesFromAnnotations(ing.Annotations)
		for _, hostname := range hostnameList {
			endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific)...)
		}
	}
	return endpoints
}
// endpointsFromIngress extracts the endpoints from ingress object