-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(aws): add support for geoproximity routing #5347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi @prasadkatti. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
For this to review
|
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.
pls share code coverage for new code as well
providerSpecificGeolocationContinentCode = "aws/geolocation-continent-code" | ||
providerSpecificGeolocationCountryCode = "aws/geolocation-country-code" | ||
providerSpecificGeolocationSubdivisionCode = "aws/geolocation-subdivision-code" | ||
providerSpecificGeoProximityLocationAWSRegion = "aws/geoproximitylocation-aws-region" |
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.
aws-region
not required, just region
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.
I have tried to match it with the field names in the GeoProximityLocation type
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.
aws/geoproximitylocation-aws-region
does not looks right
provider/aws/aws.go
Outdated
@@ -926,6 +961,39 @@ func (p *AWSProvider) newChange(action route53types.ChangeAction, ep *endpoint.E | |||
if useGeolocation { | |||
change.ResourceRecordSet.GeoLocation = geolocation | |||
} | |||
|
|||
geoproximity := &route53types.GeoProximityLocation{} |
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.
what if geoproximity not enabled? why we even have it here?
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.
Honestly, I looked at how Geolocation works and tried to follow suit.
If there are no annotations corresponding to GeoProximity, then the GeoProximityLocation
field of the ResourceRecordSet
just stays nil
. The field is populated iff any of the geoproximity annotations are seen.
Also, I wish there was a separate annotation for specifying routing policy. But since that isn't present, I have to check for the presence of all possible geoproximity annotations before I can definitively say that the record is not using geoproximity.
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.
This way it could be a breaking change, so unsure
@ivankatliarchuk - First of all, thanks for the taking the time to review. I have pushed another commit to address some of your review comments. I have also updated the PR description to include the manifests used for testing this. Let me know if you need anything else. I am still trying to figure out how to get code coverage for just the files I touched. I ran |
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.
would be nice to add docs with example setup and links to AWS docs.
https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/aws.md
provider/aws/aws.go
Outdated
} | ||
useGeoproximity = true | ||
} else { | ||
log.Errorf("Invalid coordinates format for %s: %s; expected format 'latitude,longitude'", providerSpecificGeoProximityLocationCoordinates, prop) |
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.
This is debatable, but most likely should be log.Warn, to warn user so they need to change configuraiton
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.
I feel an Errorf
here is okay, because the user is going to expect e-dns to create those records but it won't. That object with the invalid coordinates is just going to fail to reconcile.
We are also using an Errorf
here even when the record will get created.
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.
Warning please, we will correct this in follow up if needed
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.
I'm not sure if I agree with the coding style, where methods with same prefix with*
have different return types bool,none
and have side effects with logging errors.
If there is an error, so we most likely do need to return an error, as we have concepts of soft erorrs as well, and we capture them in metrics
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Any chance you share here a result of a smoke test? With geoproximity and without geoproximity settings, share relevant kube manifests as well pls. Does it require AWS IAM specific actions? Docs needs updating as well https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/aws.md |
/label tide/merge-method-squash |
New changes -
No. It doesn't. It's just the same actions except the routing policy will be different.
I have shared a manifest that I have been using for testing in the PR description. Let me know if that doesn't work for some reason. Here is a screenshot of the records that get added for those services in that manifest. Let me know if you need anything else from me at this point. Thanks so much for all your help so far @ivankatliarchuk ! |
Nice one. Any chance you fix linter before we do a review? |
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.
provider/aws/aws.go
Outdated
} | ||
useGeoproximity = true | ||
} else { | ||
log.Errorf("Invalid coordinates format for %s: %s; expected format 'latitude,longitude'", providerSpecificGeoProximityLocationCoordinates, prop) |
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.
Warning please, we will correct this in follow up if needed
provider/aws/aws.go
Outdated
return nil | ||
} | ||
|
||
func withGeoProximityCoordinates(ep *endpoint.Endpoint, geoproximity *route53types.GeoProximityLocation) bool { |
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.
This and similar methods contains too much of the side effects, return boolean, update endpoint and etc, etc.
Can we do it in more object oriented way, something like
type geoProximity {
loc *route53types.GeoProximityLocation
ep. *endpoint.Endpoint
isSet bool
}
func (gp *geoproximity) withX()
func (gp *geoproximity) withY()
func (gp *geoproximity) withZ()
and in the method
func withGeoProximityCoordinates ...
....
change.ResourceRecordSet.GeoProximityLocation = geoProximity.build()
And add tests per each method for the private type geoProximity
This should simply operational support for us
provider/aws/aws.go
Outdated
} | ||
useGeoproximity = true | ||
} else { | ||
log.Errorf("Invalid coordinates format for %s: %s; expected format 'latitude,longitude'", providerSpecificGeoProximityLocationCoordinates, prop) |
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.
I'm not sure if I agree with the coding style, where methods with same prefix with*
have different return types bool,none
and have side effects with logging errors.
If there is an error, so we most likely do need to return an error, as we have concepts of soft erorrs as well, and we capture them in metrics
This commit addresses the review feedback by making the following changes: - use a more object-oriented approach for geoProximity handling - change log levels to warnings instead of errors - add more test cases for geoProximity
126148b
to
1519d8c
Compare
New changes since last review:
This is ready for another review. Thanks! |
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.
/lgtm
cc: @mloiseleur
Description
This PR adds support for Geoproximity routing in route53 to the AWS provider.
It adds four new annotations to enable this support.
Testing done
example.test
Also did some more testing along these lines to ensure there are no unnecessary Upserts when the service isn't changed.
I used these service manifests for testing -
Fixes #4927
Checklist