-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Rebuild of the ConflictResolver #3640
Conversation
The conflict resolver is totally new
Welcome @mabels! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mabels 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 |
I am not sure if we are able to make this change. It's too huge and hard to review. Thanks for trying to make the project better. |
Hi, thx for the quick response. I'm not sure how i should split up a complete new implementation. I need almost every RecordType thats why i digged into it. So there are: alot of small changes in: medium but simple -- naming and removing and new impl and new tests --- these should be treated as new files On my opinion it is a big change but a split is not possible. thx meno
Hi, thx for the quick response. I'm not sure how i should split up a complete new implementation. I need almost every RecordType thats why i digged into it. So there are: alot of small changes in: medium but simple -- naming and removing and new impl and new tests --- these should be treated as new files On my opinion it is a big change but a split is not possible. thx meno |
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.
It is not clear what you are trying to do.
Added test cases are IPv4-only, which makes me suspicious.
There should be smaller commits, with separate refactors in separate commits. Additions to the tests to cover existing behavior should be separate from refactors and behavioral changes. Each behavioral change should be in a separate commit. For example, the change to the resolver to pick at most one target for a CNAME should be its own commit. (Though PTR and CNAME can be in the same commit.)
@@ -97,17 +105,17 @@ func newPlanTable() planTable { // TODO: make resolver configurable | |||
// current corresponds to the record currently occupying dns name on the dns provider |
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 comment should be updated to reflect the change.
recordType := strings.ToUpper(strings.TrimSpace(e.RecordType)) | ||
setIdentifier := strings.TrimSpace(e.SetIdentifier) |
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.
Why this normalization? These values should already be normalized before creating the endpoint.Endpoint
.
// func (p *Plan) Calculate() *Plan { | ||
// p, err := p.CalculateWithError() | ||
// if err != nil { | ||
// panic(fmt.Sprintf("CalculateWithError should not return an error:%v", err)) | ||
// } | ||
// return p | ||
// } |
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.
Don't leave in commented-out code.
// return p | ||
// } | ||
|
||
func (p *Plan) CalculateWithError() (*Plan, 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.
I don't think we should change the name. Just change the signature if need be.
@@ -186,32 +223,32 @@ func (p *Plan) Calculate() *Plan { | |||
Current: p.Current, | |||
Desired: p.Desired, | |||
Changes: changes, | |||
ManagedRecords: []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME}, |
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.
Why are you removing AAAA support?
// return p | ||
// } | ||
|
||
func (p *Plan) CalculateWithError() (*Plan, 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.
Why is it necessary for the planner to be able to return an error?
foundCandidate = true | ||
continue | ||
} | ||
changes.UpdateOld = append(changes.UpdateOld, oldEp) |
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.
Previously, len(changes.UpdateOld) == len(changes.UpdateNew)
was an invariant. This is breaking that invariant. For what purpose?
}, | ||
}, | ||
UpdateNew: []*endpoint.Endpoint{ | ||
{ | ||
DNSName: "some-record.used.tld", | ||
RecordType: endpoint.RecordTypeA, | ||
Targets: endpoint.Targets{"1.1.1.1"}, | ||
// this ne new resolver will transfer existing labels |
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 existing code copies only the owner
label. If adding an assertion for that, then the test case should also include a second label and assert that the code does not (or does) copy that.
@@ -97,17 +105,17 @@ func newPlanTable() planTable { // TODO: make resolver configurable | |||
// current corresponds to the record currently occupying dns name on the dns provider | |||
// candidates corresponds to the list of records which would like to have this dnsName | |||
type planTableRow struct { | |||
current *endpoint.Endpoint | |||
currents []*endpoint.Endpoint |
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.
Why is it necessary to have more than one current? When would that happen?
t := newPlanTable() | ||
|
||
if p.DomainFilter == nil { | ||
p.DomainFilter = endpoint.MatchAllDomainFilters(nil) | ||
} | ||
|
||
// dnsname and recordtype, setIdentifier is used to group records together |
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 cannot parse this comment. What does it mean?
Hi, super thx for your comments -- i will intergrate them. My goal for this is not to enable any particual record types. It's about to enable all record types. And i skipped to rebuild the hole test suite to check all support record types. But i focus on get the existing tests working with the new logic. I currently test my changes on my real-live application and discovered and improved alot on this journey(not commited yet). Mainly it about the generated heritage TXT records which causes some problems when records bound directly to the zone. This leads to some nasty situation due to the update of these records so i changed them to be planned as all other records. And this brokes alot of tests and required some new. I'm currently in the middle of something to get that done. thx again meno |
I think it would help to spend more time in the requirements and design phase. What are the specific behaviors you want to change and how do you want to change them? It is an invariant of the provider/registry interface that there is at most one Endpoint per <DNSName, RecordType, SetIdentifier> tuple. Currently the resolver chooses a single Endpoint from the candidates proposed from sources. Perhaps you want some sort of merging behavior? Can you propose a good rule for when the resolver should merge versus choose a winner? |
PR needs rebase. 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. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. 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. |
Description
After discovering that the conflictresolver and plan only working with a few recordtypes. I decided to build i complete new.
I know it's a bigger change but I tried to fix the existing one and it failed --- mainly the merging and sorting had not been there. And the lack of that prevents the merging of targets and labels. To create a defined or for merging a internal switch to a wrapEndpoint which only have one Target instead of a list of targets.
I had to change the api(plan.Calculate) due to that there are some cases where the conflict resolver is not able to resolve. These are mainly if the input data are not valid like having multiple targets on CNAME's or
PTR's recordtypes. The change of the api and the behavior causes that i had to change the tests in plan and cloudflare_test.go.
Checklist