Skip to content
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

GH-84 refactor DNSRecord conflict detection #100

Merged
merged 1 commit into from
May 28, 2024
Merged

GH-84 refactor DNSRecord conflict detection #100

merged 1 commit into from
May 28, 2024

Conversation

maksymvavilov
Copy link
Contributor

@maksymvavilov maksymvavilov commented Apr 29, 2024

Currently contains only the logic to change behaviour on conflict detection and conflict resolution.
Also moves all the logic for updating the status of the DNS Record to the updateStatus() func.
Finally, allows you to override default validation timeout using a flag (defaults to the 5 sec)

@maksymvavilov maksymvavilov linked an issue Apr 29, 2024 that may be closed by this pull request
@maksymvavilov
Copy link
Contributor Author

It has as a base Mike's PR #103 I guess it is a merge race! (that is there will be changes on that PR) If that looks good we can have one PR to rule 'em all

@maksymvavilov maksymvavilov marked this pull request as ready for review May 1, 2024 13:31
@maksymvavilov maksymvavilov changed the title [WIP] GH-84 refactor DNSRecord conflict detection GH-84 refactor DNSRecord conflict detection May 1, 2024
@maksymvavilov maksymvavilov force-pushed the GH-84 branch 2 times, most recently from 49571b0 to b2ff34f Compare May 2, 2024 14:12
@maksymvavilov maksymvavilov force-pushed the GH-84 branch 3 times, most recently from 235ea03 to 84a885e Compare May 13, 2024 16:47
@maksymvavilov
Copy link
Contributor Author

Also added an option to override validation timeout for the DNS controller. With the "default" 5 seconds some tests could be flaky and would timeout after 15 secs. In this repo the integration suite doesn't take ages to run, but I'd rather make tests faster if I can rather than increasing timeouts

cmd/main.go Outdated Show resolved Hide resolved
@maksymvavilov maksymvavilov force-pushed the GH-84 branch 5 times, most recently from a419303 to 0986c42 Compare May 23, 2024 10:12
Clock clock.Clock = clock.RealClock{}
defaultRequeueTime time.Duration
defaultValidationRequeue time.Duration
validationRequeueTime time.Duration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This var is always the randomized requeue, right? I think the name makes this confusing, it would be better with something like: randomizedRequeueTime. Though I'm not convinced that it's required at this scope... why not just calculate it at the point it is required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used a few times across the code and if we will calculate it every time we need that we will end up with different values in one instance (right now will not cause any troubles, but might in future) and it seems cleaner to me to randomize once and then just use the var. But I do have a problem with naming 😆

// implies that they were overridden - bump write counter
if !generationChanged(current) {
current.Status.WriteCounter++
writeCounter.WithLabelValues(current.Name, current.Namespace).Inc()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this involve the generation as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could 🤔 but not sure that we should. Considering that we should have a record per listener there will be a lot happening in the metrics. I'm concerned about the dimensions of this metric. Would generation be useful considering that we reset it anyway on a generation change? I reason that whatever tool will be consuming this metric (Grafana most likely) will maintain the history to see write counts of the past gens.

@philbrookes
Copy link
Contributor

This looks basically fine, other than a few small comments

@maksymvavilov maksymvavilov added this pull request to the merge queue May 28, 2024
Merged via the queue into main with commit c174376 May 28, 2024
11 checks passed
@maksymvavilov maksymvavilov deleted the GH-84 branch June 7, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance DNS Record conflict detection
3 participants