Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

support plain A record if ingress is using IP #86

Merged
merged 5 commits into from
Feb 23, 2017

Conversation

ideahitme
Copy link
Contributor

consumers/aws.go Outdated
//endpointsToAlias converts pkg Endpoint to route53 Alias Records
func (a *awsConsumer) endpointsToAlias(endpoints []*pkg.Endpoint) ([]*route53.ResourceRecordSet, error) {
lbDNS := make([]string, len(endpoints))
//endpointsToRecords converts pkg Endpoint to route53 Alias Records
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Alias" here in the description should then also go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ankon yes this WIP ;)

consumers/aws.go Outdated
rset = append(rset, a.endpointToAlias(ep, aws.String(loadBalancerZoneID)))
rset = append(rset, a.endpointToRecord(ep, aws.String(loadBalancerZoneID)))
} else if ep.IP != "" {
rset = append(rset, a.endpointToRecord(ep, aws.String("")))
} else {
log.Errorf("Canonical Zone ID for endpoint: %s is not found", ep.Hostname)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wording: "xy was not found"

@ideahitme ideahitme removed the wip label Feb 23, 2017
consumers/aws.go Outdated
lbDNS := make([]string, len(endpoints))
//endpointsToRecords converts pkg Endpoint to route53 A [Alias] Records depending whether IP/LB Hostname is used
func (a *awsConsumer) endpointsToRecords(endpoints []*pkg.Endpoint) ([]*route53.ResourceRecordSet, error) {
lbDNS := make([]string, 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you don't filter you can set the capacity here.

@linki
Copy link
Owner

linki commented Feb 23, 2017

LGTM

consumers/aws.go Outdated
for i := range endpoints {
lbDNS[i] = endpoints[i].Hostname
lbDNS = append(lbDNS, endpoints[i].Hostname)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you use the index (i) an not the value?

for _, endpoint := range endpoints {
    lbDNS = append(lbDNS, endpoint.Hostname)
}

Copy link
Contributor Author

@ideahitme ideahitme Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, left over from previous loop impl where index was a better option :)

@@ -103,11 +104,11 @@ func (a *awsConsumer) syncPerHostedZone(kubeRecords []*route53.ResourceRecordSet
upsertedMap := make(map[string]bool) // keep track of records to be upserted
targetMap := map[string][]*string{} // map dnsname -> list of targets
for _, kr := range kubeRecords {
targetMap[aws.StringValue(kr.Name)] = append(targetMap[aws.StringValue(kr.Name)], kr.AliasTarget.DNSName)
targetMap[aws.StringValue(kr.Name)] = append(targetMap[aws.StringValue(kr.Name)], aws.String(a.getRecordTarget(kr)))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you use aws.StringValue(kr.Name) instead of *kr.Name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safeguard if kr.Name is nil

ep := &pkg.Endpoint{
DNSName: "example.com",
IP: "10.202.10.123",
Hostname: "amazon.elb.com",
}
rsA := client.endpointToAlias(ep, &zoneID)
rsA := client.endpointToRecord(ep, &zoneID)
Copy link
Collaborator

@szuecs szuecs Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then the TestName should be fixed, too :)

@ideahitme
Copy link
Contributor Author

if all is good, this can be merged IMO

@tuxlife
Copy link

tuxlife commented Feb 23, 2017

👍

@ideahitme ideahitme merged commit c1eda17 into master Feb 23, 2017
@ideahitme ideahitme deleted the feat/support-a-record branch February 23, 2017 14:08
@linki linki restored the feat/support-a-record branch February 23, 2017 14:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants