-
Notifications
You must be signed in to change notification settings - Fork 2
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
CFE-851: Add OCP DNSNameResolver external plugin functionality #1
CFE-851: Add OCP DNSNameResolver external plugin functionality #1
Conversation
@arkadeepsen: This pull request references CFE-851 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but no target version was set. 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. |
/jira refresh |
@arkadeepsen: This pull request references CFE-851 which is a valid jira issue. 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. |
1c91e30
to
b1f95c0
Compare
b1f95c0
to
db3ae91
Compare
/assign @Miciah |
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.
Part 1: dockerfile, makefile, hack scripts and readme. To be continued...
…mt. Updated Dockerfile to use make build-coredns. Updated Makefile to add defaults for some env vars and to add verify rule. Updated isWildcard function to use HasPrefix rather than TrimPrefix and use "*." as the prefix.
…then it should match with the current one.
/retest |
…. Update ocp version from 4.15 to 4.16 in Dockerfile.
@@ -0,0 +1,34 @@ | |||
reviewers: |
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 would say from the SDN team side, you could add myself to reviewers and danwinship to reviewers and approvers, since no one else from the team is involved in this effort for now. And we can add more people later if needed.
22982d0
to
906f195
Compare
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.
Part 2. First look at the go code. The handler and the unit tests are not reviewed yet.
…temp dir. Removed the '-mod=vendor' flag from the coredns go build command as coredns already contains the vendor directory.
… in all files. Added description about maps in dnsnameresolve.go.
…dency on the send channel in the initInformer function by using "k8s.io/apimachinery/pkg/util/wait" package functions in the TestServeDNS test function. Refactored updateResolvedNamesSuccess and updateResolvedNamesFailure functions and simplified the code by breaking them down into multple functions.
…ng to kuberenetes plugin for starting server with unsynced informer.
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.
Reviewed the handler's unit test. The coverage looks good to me. Some remarks and questions though.
// Create the DNSNameResolver object. | ||
_, err := fakeNetworkClient.NetworkV1alpha1().DNSNameResolvers("dns").Create(context.TODO(), &dnsNameResolver, metav1.CreateOptions{}) | ||
if err != nil { | ||
t.Fatalf("error injecting dns name resolver: %v", err) |
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.
t.Fatalf("error injecting dns name resolver: %v", err) | |
t.Fatalf("error creating dns name resolver: %v", err) |
handler_test.go
Outdated
}, | ||
}, | ||
{ | ||
name: "Update wildcard dns name resolver object status with wildcard dns name, then don't add regular dns 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.
What's the difference from Update wildcard dns name resolver object status with only wildcard dns name
case?
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.
Good catch. It is a duplication of the same test. I'll remove this one.
Answer: []dns.RR{ | ||
test.A("*.example.com. 30 IN A 1.1.1.1"), | ||
test.A("*.example.com. 30 IN A 1.1.1.2"), | ||
}, | ||
}, | ||
{ | ||
Qname: "www.example.com.", | ||
Qtype: dns.TypeA, | ||
Rcode: dns.RcodeSuccess, | ||
Answer: []dns.RR{ | ||
test.A("www.example.com. 30 IN A 1.1.1.1"), | ||
test.A("www.example.com. 30 IN A 1.1.1.2"), |
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 think it's better to make the IP addresses different here to make sure they were not mixed up by the implementation.
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.
The IPs are made same to demonstrate that though the details of the regular DNS name is not added to the status of the DNSNameResolver corresponding to the wildcard DNS name, but added to the status of the DNSNameResolver corresponding to the regular DNS name.
This is in line with the previous comment (#1 (comment)) and tests the behavior for a DNSNameResolver object for a regular DNS 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.
For the sake of completeness of the behavior: can we have a test case where wildcard and regular name matching the wildcard would have different addresses?
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.
To sum up what's expected before we can approve and merge the PR:
|
…ddress and DNS name functionality of the plugin. Update handler.go file to take care of edge cases of status update. Update dnsnameresolver.go file to take care of the case of multiple namespaces. Update handle_test.go to use diff on the entire status rather than iterating over each resolved name. Add new test cases for multiple namespaces, and NS and CNAME record types. Add more comments wherever possible to better explain the flow.
…racting the time since last lookup from the current time for the unit tests.
@arkadeepsen: all tests passed! Full PR test history. Your PR dashboard. 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. |
@alebedev87 I have updated the code to take care of the review comments. The response is inline.
Added tests for multiple namespaces.
Refactored the comparison logic. Removed the polling as the informer is already synced via the Updated the name to Added the new field for getting the time since last lookup and that is subtracted from the current time when creating the objects. Updated the description section of the README file for adding more details about how the plugin takes care of a DNS lookup. Test cases for NS and CNAME are added, The duplicate test case is removed. The TTL of all IP address should have expired so that the plugin can remove the resolved name if the resolution failure becomes greater than or equal to 5 (#1 (comment)). The test already exists (#1 (comment)).
Added the comment to explain the sleep. Updated the comment stating the reason the why the polling is required. Added the comment to explain why the TTL of the IP addresses was changed to 5 seconds. |
Thanks @arkadeepsen for the updates! Let's move on with the implementation. /lgtm |
/hold In case @Miciah wants to review too. |
/unhold As discussed with Micah. |
/approve |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: alebedev87 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 |
/label docs-approved |
/label px-approved |
/label qe-approved |
@arkadeepsen: This pull request references CFE-851 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target either version "4.16." or "openshift-4.16.", but it targets "openshift-4.15" instead. 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 openshift-eng/jira-lifecycle-plugin repository. |
/jira refresh |
@arkadeepsen: This pull request references CFE-851 which is a valid jira issue. 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 openshift-eng/jira-lifecycle-plugin repository. |
This PR adds the new external plugin ocp_dnsnameresolver as per the enhancement proposal openshift/enhancements#1335