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

consul: periodically reconcile services/checks #4170

Merged
merged 1 commit into from
Apr 19, 2018

Conversation

schmichael
Copy link
Member

Periodically sync services and checks from Nomad to Consul. This is
mostly useful when testing with the Consul dev agent which does not
persist state across restarts. However, this is a reasonable safety
measure to prevent skew between Consul's state and Nomad's
services+checks.

Also modernized the test suite a bit.

@schmichael schmichael requested a review from dadgar April 17, 2018 19:42
@schmichael schmichael force-pushed the f-consul-periodic-sync branch from 887291d to 4c01d3f Compare April 18, 2018 21:41
@@ -36,6 +36,9 @@ const (
// defaultMaxRetryInterval is the default max retry interval.
defaultMaxRetryInterval = 30 * time.Second

// defaultPeriodicInterval is the default periodic sync interval.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a bit more to this comment. "The periodic sync reconciles state between the desired services and checks and the actual registered checks. This is done at an interval, rather than being purely edge triggered, to handle the case that the Consul agent's state may change underneath us".


// Reset timer to periodic interval to periodically
// reconile with Consul
retryTimer.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use if !retryTimer.Stop() {

@@ -345,6 +345,15 @@ INIT:
c.logger.Printf("[INFO] consul.sync: successfully updated services in Consul")
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 be a DEBUG?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, github's default hiding makes it appear noisier than it really is. It only logs when failures > 0 which means it logs as an indication that Consul has recovered.

In a steady state it will not log. I kind of like it because otherwise you would only see Consul syncing failures in the logs and not a clear success message.

Periodically sync services and checks from Nomad to Consul. This is
mostly useful when testing with the Consul dev agent which does not
persist state across restarts. However, this is a reasonable safety
measure to prevent skew between Consul's state and Nomad's
services+checks.

Also modernized the test suite a bit.
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants