-
Notifications
You must be signed in to change notification settings - Fork 77
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
Provide DNSOverride for targets #707
Conversation
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.
Hey Rahul,
Thanks for sending this. I think being able to override DNS resolver makes a lot of sense. I was wondering if you've considered adding the new option to TargetsDef proto instead:
cloudprober/targets/proto/targets.proto
Line 100 in 24587fb
message TargetsDef { |
I think that's a better place for it and it will simplify the implementation quite a bit as we'll not have to pass this option around.
Agreed. Updated the PR with the new changes. Tested them locally and in k8s. When you get a chance, could you take another look? Thank you. |
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.
Hi Rahul,
Few more comments. I am out of office until end of the week, so take your time.
Thanks,
Manu
I also have a question regarding the unit test. The unit test checks whether the correct DNSIP is present in the targets struct. Ideally, I would like to put this field in the resolver struct. However, I run into the issue that the resolver struct does not implement the Resolver interface since the resolve method signatures are different, preventing me from casting targets.resolver into the resolver struct. Is there a way to fix this, or am I missing something? Thank you. |
Ha, that's surprising. You're right.. adding a DNS IP field to resolver makes more sense, then you should be able to access it from target's resolver by type-casting. Does the following not work?
|
Unfortunately, it does not work. During runtime, I receive the following error |
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.
Looks good. Just last couple of minor comments if they make sense to you. Otherwise we can go with this too.
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. Thanks!
The default behavior of cloudprober is to use the local DNS resolver for all targets. While this covers most use cases, some times we want to resolve a target using a DNS resolver that we provide such as Cloudflare's DNS resolver (1.1.1.1). This PR allows the user to specify the dns resolver for a probe and for static targets, it will use the specified dns resolver.
This change includes a unit test and was tested in a k8s environment where the cloudprober config included probes that used the dns resolver override and the default dns resolver.