-
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
Inititial support for multiple targets per record #493
Inititial support for multiple targets per record #493
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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/test-infra repository. I understand the commands that are listed here. |
a1c734b
to
1cef71e
Compare
@linki: GitHub didn't allow me to request PR reviews from the following users: multi-io, dereulenspiegel, sethpollack, jrnt30. Note that only kubernetes-incubator members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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/test-infra repository. |
@grimmy would you mind splitting the PR into two with the positional arg switch isolated in its own? It would be easier to see the diff that's relevant to the multi-target functionality. |
They're literally one in the same.. the Only difference is that |
If I were to split this into two pull requests... The first one would be 19 files changed by changing The second pr would also change 19 files as the signature of If you really want to review double the work, sure I can split them. But you're saying you want smaller PRs. The current PR is the smallest this change can be. |
👍 |
@linki please merge |
provider/aws_test.go
Outdated
endpoint.NewEndpoint("create-test.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "8.8.4.4"), | ||
endpoint.NewEndpoint("create-test-cname.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeCNAME, "foo.elb.amazonaws.com"), | ||
endpoint.NewEndpoint("create-test-cname-alias.zone-1.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeCNAME, "foo.elb.amazonaws.com"), | ||
endpoint.NewEndpoint("create-test-multiple.zone-2.ext-dns-test-2.teapot.zalan.do", endpoint.RecordTypeA, "8.8.8.8", "8.8.4.4"), | ||
} | ||
|
||
currentRecords := []*endpoint.Endpoint{ | ||
endpoint.NewEndpoint("update-test.zone-1.ext-dns-test-2.teapot.zalan.do", "8.8.8.8", endpoint.RecordTypeA), |
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 looks wrong: the target IPs aren't variadic at the end of the function. I guess this compiles because they are all strings and variadic at the end?
Sad that the tests don't fail 😒 I just dicussed with @szuecs that we could check in NewEndpoint
that the recordType
value is a valid endpoint.RecordType*
or don't use string
but a specific type. Then the tests would fail 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.
What do you mean aren't variadic at the end of the function
? Any number of parameters at that point is valid, whether it's 0, 1, 2, 10, 1024, etc.. Perhaps I'm not understanding what you're saying?
Just to be clear, if you're saying that the first record in currentRecords
should be a failure according to the endpoint.NewEndpoint
's that are visible, they're unrelated (check the record name). Or perhaps github isn't showing the context you expected?
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.
Whoops, it was just pointed out to me that the error you're talking about is line 406. Sorry about that, totally glossed over it... It must have compile errored for the test and it just got lost in the mess of test output from all the providers being in the same test sweet/package.
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 fixing the tests now.
While not the best idea, record type could become an enum
implementing the Stringer
interface and that should catch all of these. That should be relatively low impact too as everything is already using the const
.
07d9684
to
5c54d71
Compare
Updated. I used the following to verify correctness for a line with just
And then manually verified those that had
|
The test passing was bugging me so I wrote some tests for |
@grimmy yes, feel free to add your tests 👍 Switching the parameters around in the aforementioned line still doesn't made the tests fail, unfortunately. I tested locally that it doesn't enter the func NewEndpointWithTTL(dnsName, recordType string, ttl TTL, targets ...string) *Endpoint {
switch recordType {
case "", RecordTypeA, RecordTypeTXT, RecordTypeCNAME:
default:
panic(recordType)
}
... When I switch the parameters around in one of the tests this indeed paniced, so I guess the current implementation is correct. However, to avoid similar issues in the future I would either prefer a cleaner version of the above so tests somehow break or make it not compile by either making the Let me know what you think and if you want to tackle one of the options. Since this PR is now correct I'm also fine with taking it as is. |
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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/test-infra repository. I understand the commands that are listed here. |
Just pushed the tests for Endpoint.Same. Should be good to go from here. Actually committed with the wrong username, fixing. Clearly this went very bad, trying to fix it up now :-/ |
7a0164b
to
88f8b54
Compare
88f8b54
to
7a0164b
Compare
7a0164b
to
a84aa76
Compare
@grimmy fixed it, I believe. |
02b8d3d
to
2532013
Compare
2532013
to
0e83547
Compare
Alright, everything should be good to go now and I've learned my lesson and will never use |
LGTM, thanks @grimmy |
* Improve github action * whitespace (trim) * better step naming * Apply comments
This PR is to add support for multiple targets per #239 . I changed the signature of
endpoint.NewEndpoint
andendpoint.NewEndpointWithTTL
movingtarget
to the end of as a variadic parameter. This caused the size of the PR to balloon, but I figured making is variadic was better than littering the code with[]string{"1.2.3.4"}
everywhere by changing thetarget
parameter to a string slice.I only added tests for AWS right now, but it should be relatively straight forward to add the tests to other providers.