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

feat(agent): add retry configuration for vault agent #10644

Merged
merged 18 commits into from
Jan 25, 2021

Conversation

RXC001
Copy link
Contributor

@RXC001 RXC001 commented Jan 4, 2021

Adds retry configuration for Vault Agent. Structure is similar to the retry blocks found in consul-template

@hashicorp-cla
Copy link

hashicorp-cla commented Jan 4, 2021

CLA assistant check
All committers have signed the CLA.

@RXC001 RXC001 marked this pull request as ready for review January 4, 2021 23:48
Copy link
Contributor

@HridoyRoy HridoyRoy left a comment

Choose a reason for hiding this comment

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

👍 LGTM, but I'd like another pair of eyes on this in case I missed something. @calvn could you take a look?

@HridoyRoy HridoyRoy requested a review from calvn January 12, 2021 18:47
@@ -40,6 +40,7 @@ type Vault struct {
ClientCert string `hcl:"client_cert"`
ClientKey string `hcl:"client_key"`
TLSServerName string `hcl:"tls_server_name"`
Retry *Retry `hcl:"retry"`
Copy link
Contributor

Choose a reason for hiding this comment

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

The retry behavior in here is specifically for the template server (at least for now) so I'm not entirely convinced that it should live in the vault stanza since this doesn't control retry logic when agent communicates with the server for auto-auth and/or caching.

@HridoyRoy thoughts on making this be a top-level template_retry stanza instead?

Copy link

Choose a reason for hiding this comment

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

We did think about that, but the existing retry context is under ctv.Vault.Retry = &ctconfig.RetryConfig{Attempts: &ts.testingLimitRetry} and consul-template puts it under the vault section so we kept the same structure location.

As for the auto-auth retry that is a feature we would like to add as well as our use case of vault needs to be fault tolerant of network disconnects both for getting new tokens and template rendering, this MR was the first step.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I do agree that "Retry" in the Vault section shouldn't be a configuration parameter that is limited to the consul template use-case. Let me dig into this a bit -- I'll circle back soon.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @ibspoof @RXC001 , sorry for the delay in circling back!

We'd like to move the Retry stanza into as a top level config named template_retry. ctv is the consul template, so ctv.Vault.Retry can be set to values that exist in a structurally different location in the Vault config. Since this retry functionality is currently limited in scope to the consul-template, we'd want to make that clear with the name and location of the stanza, instead of keeping structural similarity between the consul-template config and the vault config.

Thanks so much!

Copy link

Choose a reason for hiding this comment

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

Makes sense we had the same discussion in our team. Will get that changed and pushed.

@@ -40,6 +40,7 @@ type Vault struct {
ClientCert string `hcl:"client_cert"`
ClientKey string `hcl:"client_key"`
TLSServerName string `hcl:"tls_server_name"`
Retry *Retry `hcl:"retry"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @ibspoof @RXC001 , sorry for the delay in circling back!

We'd like to move the Retry stanza into as a top level config named template_retry. ctv is the consul template, so ctv.Vault.Retry can be set to values that exist in a structurally different location in the Vault config. Since this retry functionality is currently limited in scope to the consul-template, we'd want to make that clear with the name and location of the stanza, instead of keeping structural similarity between the consul-template config and the vault config.

Thanks so much!

@RXC001
Copy link
Contributor Author

RXC001 commented Jan 15, 2021

Moving the Retry stanza to the top level makes sense. I can make that happen.

@RXC001 RXC001 force-pushed the feat/agent/add-retry-configuration branch from 6edb667 to f46580e Compare January 16, 2021 01:59
Copy link
Contributor

@HridoyRoy HridoyRoy left a comment

Choose a reason for hiding this comment

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

lgtm!

hashicorp#10750)

* Move the declaration to a OSS build tag file to not have it collide with ent declarations

* Add comment

* Remove comment to trigger ci
@HridoyRoy
Copy link
Contributor

HridoyRoy commented Jan 25, 2021

Hi @RXC001 , I think this needs to merge from HashiCorp/master for the tests to pass (seems to be missing #10749 ).
Thanks, and thank you for your patience.

@vercel
Copy link

vercel bot commented Jan 25, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

vault-storybook – ./ui

🔍 Inspect: https://vercel.com/hashicorp/vault-storybook/ot1pw5ox3
✅ Preview: Canceled

@vercel vercel bot temporarily deployed to Preview – vault-storybook January 25, 2021 18:40 Inactive
@vercel vercel bot temporarily deployed to Preview – vault January 25, 2021 18:40 Inactive
@HridoyRoy HridoyRoy merged commit 8c304ed into hashicorp:master Jan 25, 2021
@HridoyRoy HridoyRoy added this to the 1.7 milestone Jan 25, 2021
ncabatoff added a commit that referenced this pull request Feb 12, 2021
…those from consul-template configuration. Also fix some existing config docs that weren't adhering to our conventions.
HridoyRoy pushed a commit that referenced this pull request Feb 18, 2021
…those from consul-template configuration. Also fix some existing config docs that weren't adhering to our conventions. (#10911)
github-actions bot pushed a commit that referenced this pull request Feb 18, 2021
…those from consul-template configuration. Also fix some existing config docs that weren't adhering to our conventions. (#10911)
catsby added a commit that referenced this pull request Feb 19, 2021
* master:
  Adds API docs for max_age role parameter of JWT/OIDC auth method (#10916)
  UI/Database Secrets Engine cleanup (#10949)
  helper/metricsutil: Prevent potential Ticker leak (#10913)
  core/expiration: Add backoff jitter to the expiration retries (#10937)
  Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939)
  Vault Dependency Upgrades [VAULT-871] (#10903)
  Add docs for Agent's template_retry option added in #10644, based on those from consul-template configuration.  Also fix some existing config docs that weren't adhering to our conventions. (#10911)
  UI Database Secrets Engine (MongoDB) (#10655)
  OpenAPI - Don't panic if field isn't found (#10929)
  Vault-1403 Switch Expiration Manager to use Fairsharing Backpressure (#1709) (#10932)
  Update KV Secrets Engine index (#10933)
@other-ryan
Copy link

Thanks for this feature. This is awesome!

It appears this didn't make it into the 1.6.2 release. Any timeframe of when we can expect this to be part of the GA build?

@ncabatoff
Copy link
Collaborator

Thanks for this feature. This is awesome!

It appears this didn't make it into the 1.6.2 release. Any timeframe of when we can expect this to be part of the GA build?

It should be included in the upcoming 1.7 release. We don't have an official timeframe that I know of, but if you look at the past cadence of Vault major releases you'll see that we're pretty regular and that 1.7 is likely not far off.

@other-ryan
Copy link

@ncabatoff thanks for the info. Just a heads up that the documentation for these configs are live at https://www.vaultproject.io/docs/agent/template and may cause some confusion for folks trying to figure out why the configs aren't working.

@ncabatoff
Copy link
Collaborator

Unfortunately this has been an issue for the longest time. Our docs reflect not the latest available version, but what's in the master branch. There is work ongoing to provide a versioned view of documentation which should fix this, but I don't know when that will be released. Sorry about the confusion in the meantime.

@kalafut
Copy link
Contributor

kalafut commented Feb 26, 2021

@ncabatoff The docs for this are showing up because the docs-cherrypick label was added in #10911. As far as I can tell we're rendering stable-website as expected. I reverted the docs commit there.

kalafut pushed a commit that referenced this pull request Feb 26, 2021
…ased on those from consul-template configuration. Also fix some existing config docs that weren't adhering to our conventions. (#10911)"

8e0c00c
@ncabatoff
Copy link
Collaborator

Hi folks,

I'm afraid I have some potentially bad news: I'm reverting this change. In its place, #11113 is adding similar functionality that will apply not just to templating, but also to requests that go through the proxy/cache. I say this is potentially bad news because the new configuration only allows you to specify the number of retries, there's no provision like in template_retry for specifying backoff or max_backoff.

Some context for this decision:

  • we needed the ability to configure retries for proxy requests for another 1.7 feature
  • yet another 1.7 feature allows template requests to go through the cache, and having independent configuration for proxy requests and template requests would be problematic in that scenario
  • templating uses a different backoff algorithm than proxy requests, so providing backoff configuration that has very different meanings for the two systems would've created confusion
  • we're not persuaded that being able to configure backoff intervals is strictly necessary

In the future we plan to do further work to better unify templating with the rest of Agent, such that we won't have multiple backoff algorithms in use, and we can revisit the decision as to whether to have configuration for backoff intervals.

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.

10 participants