-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(service): listen to endpoint changes #5085
feat(service): listen to endpoint changes #5085
Conversation
Hi @dmarkhas. 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. |
# Conflicts: # docs/sources/service.md
Thanks for working on a fix. Worth to consider 3 options
|
Thanks for the feedback, the guiding principle for me was that this is a breaking change so it must be enabled explicitly. Adding a new annotation to Service objects would make the implementation less straight-forward, as we would need to track the ownership of Endpoints back to their Service, and there's no fool-proof way of doing that I believe (there's no ownerReferences for Endpoints). All in all I think the new flag achieves the desired result with minimum changes and aligns well with the current design and implementation of the controller. |
Got it. I'll add this functionality to be supported by an annotation to my list of TODO, agree quite a significant change. I leave a decision where we need a specific flag for that for @mloiseleur, sounds like a safer thing to do, is just this is exactly the reason for |
Could you please also provide a way to test this manually with manifests and kubectl commands? Was this change tested on a cluster? |
It has, we're running this code on one of our clusters currently. Would manual steps with Route 53 CLI commands showing the records are updated as soon as endpoints are added/removed be OK? |
Yes, that should work for sure |
Great, let me know if this works (I redacted some identifiers like our hosted zone name and ID).
aws route53 list-resource-record-sets \
--hosted-zone-id ABCDEFG12345 \
--query "ResourceRecordSets[?Name=='external-dns-test.euw1.stgv2.domain.' && Type=='A']" \
--output text
external-dns-test.euw1.stgv2.domain. 300 A
RESOURCERECORDS 10.244.136.249
kubectl scale deployment mydemo-deployment --replicas=5 -n external-dns-demo
aws route53 list-resource-record-sets \
--hosted-zone-id ABCDEFG12345 \
--query "ResourceRecordSets[?Name=='external-dns-test.euw1.stgv2.domain.' && Type=='A']" \
--output text
external-dns-test.euw1.stgv2.domain. 300 A
RESOURCERECORDS 10.242.222.129
RESOURCERECORDS 10.242.58.6
RESOURCERECORDS 10.242.85.128
RESOURCERECORDS 10.244.136.249
RESOURCERECORDS 10.244.20.70
kubectl scale deployment mydemo-deployment --replicas=5 -n external-dns-demo
aws route53 list-resource-record-sets \
--hosted-zone-id ABCDEFG12345 \
--query "ResourceRecordSets[?Name=='external-dns-test.euw1.stgv2.domain.' && Type=='A']" \
--output text
external-dns-test.euw1.stgv2.domain. 300 A
RESOURCERECORDS 10.242.222.129
RESOURCERECORDS 10.242.58.6 |
/ok-to-test |
For some reason I keep getting this FATA[0000] flag parsing error: unknown long flag '--listen-endpoint-events' ^ resolved. was incorrect branch I cloned repo, and this is my arguments. go run main.go \
--provider=aws \
--registry=txt \
--listen-endpoint-events \
--source=service \
--aws-zone-type=private \
--log-level=info |
@dmarkhas you need to fix tests and make linter happy. Dev guide https://github.com/kubernetes-sigs/external-dns/blob/master/docs/contributing/dev-guide.md I'll review the code when green |
The tests are good now. I also updated the linter configuration which was invalid. |
On edge with new flag vs /lgtm |
As a user, I don't think A more elegant approach could be to add However, if we switched to EndpointSlices the ownership issue would be solved, and then we can extract the relevant annotations from the owner Service, but I think that would be a far-reaching change in the controller. |
Co-authored-by: Michel Loiseleur <97035654+mloiseleur@users.noreply.github.com>
Co-authored-by: Michel Loiseleur <97035654+mloiseleur@users.noreply.github.com>
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
/assign @mloiseleur
/retitle feat(service): listen to endpoint changes |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ivankatliarchuk, mloiseleur The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Currently, using the
Service
source, ExternalDNS reconciles the endpoints only when the service definition itself changes.However, in many cases the desired behavior is to trigger the reconcile when the endpoints themselves change, even if there was no change to the
Service
object itself.Please see #4907 for a more elaborate description of the issue this PR aims to solve.
While the same behavior can be effectively achieved today by setting
interval=1s
, that would cause too many unnecessary reconciliations; the proposed solution ensures a reconcile happens only when endpoints change, and as soon as they change.Fixes #4907
Checklist