-
Notifications
You must be signed in to change notification settings - Fork 9
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
Gh49 distributed dns plan #79
Conversation
if len(row.current) > 0 && len(row.candidates) == 0 { | ||
changes.Delete = append(changes.Delete, row.current...) |
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.
took me a while to get this in my head. Might be worth a bit more of a comment? So basically I see this controller removing itself as an owner of this endpoint and if no other owners deleting otherwise updating the record
33908bc
to
0add671
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.
Ok made a first pass. I have some understanding of what this is doing now. But can't say I know enough at this point to say it right or wrong I guess. I wil give it another pass later today
1c80038
to
244f858
Compare
Initial work to modify the external-dns plan to work in the proposed way for distubuted dns. Updates the plan to treat all endpoints passed to it (current/desired) as part of a single shared set of records. The calculation logic now takes into account other endpoints added to the plan when calculating the desired changes for any other endpoint also added. The plan calculation logic is broken into two steps: 1. Calculate what endpoints will be created/updated and deleted based on the current and desired records passed to the plan. For each endpoint that will still exist if these changes were to be applied(create/update), a map of dnsNames and their owners is calculated. 2. Create the external-dns Changes for the endpoints calculated in step one. For all endpoints calculated to be an update the target values are re-calculated using the information gathered in step one about ownership of dnsNames. If we detect that a CNAME has a "managed" target value (it's in our owner map) we use the information known about who owns it to manipulate the desired targets values.
Prevent the switch of CNAME records to Alias A records for CNAMES with an aws ec2 loadbalancer as the target. Prevent evaluate target health automatically being applied to alias targets (Not strictly required since we don't create any now but turning it off anyway)
244f858
to
0dd544b
Compare
Update the plan to keep track of conflicts it can't resolve. It stores each conflict as an error in an array that can be queried later before applying changes. The plan will currently create a conflict error if the record type of an endpoint is going to change, or an attempt to update a record that is owned or unowned by one that is unowned or owned (The opposite).
@@ -365,6 +366,10 @@ func (r *DNSRecordReconciler) applyChanges(ctx context.Context, dnsRecord *v1alp | |||
|
|||
plan = plan.Calculate() | |||
|
|||
if err = plan.ConflictError(); err != nil { |
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.
nice so conflicts in this pr now also
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.
Yes, when i was writing the issue for it (#85), i was looking into the best way to do it and pretty much just did it, so carried on. Kept it fairly simple anyway, just collect errors and expose them from the plan to query later.
Was thinking this morning i might make it more generic so we can just add all types of possible errors to it. We can use it for the missing managed record errors we want for the likes of default geo etc..
@@ -159,4 +165,75 @@ var _ = Describe("DNSRecordReconciler", func() { | |||
}, TestTimeoutLong, time.Second).Should(Succeed()) | |||
}) | |||
|
|||
It("should not allow second record to change the type", func() { |
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.
👍
closes #49 #85
Initial work to modify the external-dns plan to work in the proposed way for distubuted dns.
Updates the plan to treat all endpoints passed to it (current/desired) as part of a single shared set of records. The calculation logic now takes into account other endpoints added to the plan when calculating the desired changes for any other endpoint also added.
The plan calculation logic is broken into two steps:
Calculate what endpoints will be created/updated and deleted based on the current and desired records passed to the plan. For each endpoint that will still exist if these changes were to be applied(create/update), a map of dnsNames and their owners is calculated.
Create the external-dns Changes for the endpoints calculated in step one. For all endpoints calculated to be an update the target values are re-calculated using the information gathered in step one about ownership of dnsNames. If we detect that a CNAME has a "managed" target value (it's in our owner map) we use the information known about who owns it to manipulate the desired targets values.