source/compatibility.go
func legacyEndpointsFromMoleculeService(svc *v1.Service) []*endpoint.Endpoint {
	var endpoints []*endpoint.Endpoint

	// Check that the Service opted-in to being processed.
	if svc.Labels["dns"] != "route53" {
		return nil
	}

	// Get the desired hostname of the service from the annotation.
	hostnameAnnotation, exists := svc.Annotations[moleculeAnnotationKey]
	if !exists {
		return nil
	}

	hostnameList := strings.Split(strings.Replace(hostnameAnnotation, " ", "", -1), ",")

	for _, hostname := range hostnameList {
		// Create a corresponding endpoint for each configured external entrypoint.
		for _, lb := range svc.Status.LoadBalancer.Ingress {
			if lb.IP != "" {
				endpoints = append(endpoints, endpoint.NewEndpoint(hostname, endpoint.RecordTypeA, lb.IP))
			}
			if lb.Hostname != "" {
				endpoints = append(endpoints, endpoint.NewEndpoint(hostname, endpoint.RecordTypeCNAME, lb.Hostname))
			}
		}
	}

	return endpoints
}
func legacyEndpointsFromMoleculeService(svc *v1.Service) []*endpoint.Endpoint {
	var endpoints []*endpoint.Endpoint

	// Check that the Service opted-in to being processed.
	if svc.Labels["dns"] != "route53" {
		return nil
	}

	// Get the desired hostname of the service from the annotation.
	hostnameAnnotation, exists := svc.Annotations[moleculeAnnotationKey]
	if !exists {
		return nil
	}

	hostnameList := strings.Split(strings.Replace(hostnameAnnotation, " ", "", -1), ",")

	for _, hostname := range hostnameList {
		// Create a corresponding endpoint for each configured external entrypoint.
		for _, lb := range svc.Status.LoadBalancer.Ingress {
			if lb.IP != "" {
				endpoints = append(endpoints, endpoint.NewEndpoint(hostname, endpoint.RecordTypeA, lb.IP))
			}
			if lb.Hostname != "" {
				endpoints = append(endpoints, endpoint.NewEndpoint(hostname, endpoint.RecordTypeCNAME, lb.Hostname))
			}
		}
	}

	return endpoints
}
func legacyEndpointsFromMoleculeService ( svc * v1 . Service ) [ ] * endpoint . Endpoint { var endpoints [ ] * endpoint . Endpoint // Check that the Service opted-in to being processed. if svc . Labels [ " " ] != " " { return nil } // Get the desired hostname of the service from the annotation. hostnameAnnotation , exists := svc . Annotations [ moleculeAnnotationKey ] if ! exists { return nil } hostnameList := strings . Split ( strings . Replace ( hostnameAnnotation , " " , " " , - 1 ) , " " ) for _ , hostname := range hostnameList { // Create a corresponding endpoint for each configured external entrypoint. for _ , lb := range svc . Status . LoadBalancer . Ingress { if lb . IP != " " { endpoints = append ( endpoints , endpoint . NewEndpoint ( hostname , endpoint . RecordTypeA , lb . IP ) ) } if lb . Hostname != " " { endpoints = append ( endpoints , endpoint . NewEndpoint ( hostname , endpoint . RecordTypeCNAME , lb . Hostname ) ) } } } return endpoints }
// legacyEndpointsFromMoleculeService tries to retrieve Endpoints from Services
// annotated with Molecule Software's annotation semantics.
legacyEndpointsFromMoleculeService tries to retrieve Endpoints from Services annotated with Molecule Software s annotation semantics .