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-template: Add fault tolerant defaults #13041

Merged
merged 9 commits into from
Jun 8, 2022

Conversation

DerekStrickland
Copy link
Contributor

@DerekStrickland DerekStrickland commented May 17, 2022

closes #13020

This PR adds fault-tolerant defaults to the default agent config.

  • BlockQueryWaitTime: defaults to 5 min, matching the default value Consul uses
  • MaxStale: defaults to 10 years matching the default value Consul uses
  • Wait.Min: defaults to 5 seconds overriding the default of 0 that Consul Template uses
  • Wait.Max: defaults to 4 minutes matching the default Consul Template uses
  • ConsulRetry.Attempts: defaults to 0 which is the unlimited value - overrides the Consul Template default of 12
  • ConsulRetry.Backoff: defaults to 250ms matching the default that Consul Template uses
  • ConsulRetry.MaxBackoff: defaults to 1 minute matching default that Consul Template uses
  • VaultRetry.Attempts: defaults to 0 which is the unlimited value - overrides the Consul Template default of 12
  • VaultRetry.Backoff: defaults to 250ms matching the default that Consul Template uses
  • VaultRetry.MaxBackoff: defaults to 1 minute matching default that Consul Template uses

@mikenomitch
Copy link
Contributor

Since this will probably involve some docs changes, can we sneak in an explanation of the unit of "max_stale" here https://www.nomadproject.io/docs/configuration/client#max_stale (maybe the default value being there will make this obvious?)

A user had mentioned that this was a bit confusing, and they didnt know if it was a time value or index diff or something like that.

@DerekStrickland
Copy link
Contributor Author

Since this will probably involve some docs changes, can we sneak in an explanation of the unit of "max_stale" here https://www.nomadproject.io/docs/configuration/client#max_stale (maybe the default value being there will make this obvious?)

A user had mentioned that this was a bit confusing, and they didn't know if it was a time value or index diff or something like that.

I've updated the default value in that last commit, but IIRC this text is lifted directly from the Consul docs. Any specific feedback about what is unclear?

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

The code change here LGTM.

I've left some suggestions on cleaning up the documentation while we're in here, but maybe that should be in a separate PR for backporting concerns. We'll also need a changelog entry and a section of the version-specific upgrade guide detailing the changes we're making here.

website/content/docs/configuration/client.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/client.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/client.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/client.mdx Outdated Show resolved Hide resolved
client/config/config.go Show resolved Hide resolved
client/config/config.go Outdated Show resolved Hide resolved
Co-authored-by: Tim Gross <tgross@hashicorp.com>
@DerekStrickland DerekStrickland changed the title [WIP] consul-template: Add fault tolerant defaults consul-template: Add fault tolerant defaults Jun 6, 2022
@DerekStrickland DerekStrickland marked this pull request as ready for review June 6, 2022 20:43
Comment on lines +228 to +229
of time to wait before attempting to re-render a template. By default, Consul Template
will loop continually and re-render. If this value is set, Nomad will configure Consul
Copy link
Member

Choose a reason for hiding this comment

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

By default, Consul Template

Aren't 5s/4m the defaults?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are. I thought our convention was to put the defaults in these code snippet sections. Is that not the case?

Copy link
Member

Choose a reason for hiding this comment

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

Oh hm, maybe I just misread this sentence. I think when I see:

By default X. If this value is set, Y.

I assume that the value in question is not set by default. The phrasing definitely isn't explicitly saying that, so maybe it's just my poor reading comprehension at work. 😅

The preceding and following sentences clear it all up, but maybe these 2 could be rephrased a bit:

Consul Template re-renders templates whenever rendered variables from Consul, Nomad, or Vault change. However in order to minimize how often tasks are restarted or reloaded, Nomad will configure .

My main point being is that I think the By default... in the first sentence makes users think this parameter changes that behavior when it doesn't. Re-rendering in a loop is just how Consul Template works and these parameters just tweak some timings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok. That makes sense. I'll stage a new PR with these doc changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't 5s/4m the defaults?

They are not. Default max in consul-template 4 times of Minimum value not 4 Minutes

@lgfa29 lgfa29 added the backport/1.3.x backport to 1.3.x release line label Jun 9, 2022
@DerekStrickland DerekStrickland modified the milestones: 1.3.x, 1.3.2 Jun 27, 2022
tbehling pushed a commit that referenced this pull request Jun 29, 2022
consul-template: Add fault tolerant defaults

Co-authored-by: Tim Gross <tgross@hashicorp.com>
@valodzka
Copy link
Contributor

@DerekStrickland I noticed that you incorrectly read consul-template code. c.Max = TimeDuration(4 * *c.Min) mean 4 times of Minimum value, not 4 Minutes.

@DerekStrickland
Copy link
Contributor Author

@valodzka Thanks for catching this!

@github-actions
Copy link

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 Nov 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set longer default retry, backoff and attempt count for Consul Template
7 participants