fix(targetfiltersource): skip network address filtering for non-address records#6366
fix(targetfiltersource): skip network address filtering for non-address records#6366castorw wants to merge 4 commits intokubernetes-sigs:masterfrom
Conversation
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @castorw. 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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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 |
Coverage Report for CI Build 24407478739Coverage increased (+0.003%) to 80.527%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
Not sure about this proposal. Worth to search git history, to get a better idea why it was implemented that way #2693 What is stopping in future to filter targets like cnames, txt records, SRV, MX, NS, PTR and etc etc. There is scope concern. The proposal most likely silently breaks future wrapper target filter implementations. And non-IP targets are outside the scope of network filtering, not wrapper target filtering. To be specific, the fix should live in TargetNetFilter.Match() itself rather than the wrapper. The filter knows it only speaks IP - the wrapper shouldn't need to know that. func (tf TargetNetFilter) Match(target string) bool {
ip := net.ParseIP(target)
if ip == nil {
return true // non-IP targets are outside the scope of network filtering
}
return matchTargetNetFilter(tf.filterNets, ip, true) &&
!matchTargetNetFilter(tf.excludeNets, ip, false)
}This way:
The wrapper test case in the PR is still valid as an integration test (net filter + mixed record types), but the record-type bypass in wrapper is most likely a no go |
^ This is not a messy workaround, the PR assumes that sharing one instance across record types with conflicting filter semantics is the desired end state, but that assumption ins't correct. The controller per configuration is an architectural stance and is the model that is actually cleaner and safer operationally - each instance has a single, coherent responsibility with no ambiguous interactions between flags. A CNAME target and an A record target serve different purposes and may legitimately need different filtering rules - forcing them through one filter pipeline is the actual networking topology design smell. |
|
You are right about the semantics, the placement of filtering exclusion wasn't too good in the source wrapper. I have moved this to The solution you proposed to check whether
Cannot say I would completely disagree with this statement, however when I see that a network address filter ( |
|
You most likely correct, and initial implementation was lot more simpler. Current |
|
Well I thought about passing only record type over to What would you suggest then? Pass only record type to |
What does it do ?
This PR update target filter source to skip target network filtering via
--target-net-filterand/or--exclude-target-neton non-address records (A/AAAA) as there is no reason to apply IPv4/IPv6 filters to non-address records.Motivation
When controller is configured to manage address and non-address record types (eg.
A, AAAA, CNAME) it fails to manageCNAMErecords when--target-net-filterand/or--exclude-target-netis configured. Applying IP-based filtering to non-IP resources does not make sense and limits the usability of controller. A messy workaround is to launch multiple instances ofexternal-dns, however this does not seem like a proper solution.More