-
Notifications
You must be signed in to change notification settings - Fork 12
support plain A record if ingress is using IP #86
Conversation
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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"
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) |
There was a problem hiding this comment.
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.
LGTM |
consumers/aws.go
Outdated
for i := range endpoints { | ||
lbDNS[i] = endpoints[i].Hostname | ||
lbDNS = append(lbDNS, endpoints[i].Hostname) |
There was a problem hiding this comment.
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)
}
There was a problem hiding this comment.
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))) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 :)
if all is good, this can be merged IMO |
👍 |
/cc @linki @hjacobs @tuxlife