From f8e45c86e3215d2b36b7ae78c8ea2092a2a35298 Mon Sep 17 00:00:00 2001 From: Fredrik Hoem Grelland Date: Wed, 19 Feb 2020 20:51:29 +0100 Subject: [PATCH] Implementing suggested changes #7170 --- CHANGELOG.md | 1 + command/agent/job_endpoint.go | 1 + nomad/structs/structs.go | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86a6df057015..4ea7a8105329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ IMPROVEMENTS: * cli: Included namespace in output when querying job status [[GH-6912](https://github.com/hashicorp/nomad/issues/6912)] * cli: Added option to change the name of the file created by the `nomad init` command [[GH-6520]](https://github.com/hashicorp/nomad/pull/6520) * client: Supported AWS EC2 Instance Metadata Service Version 2 (IMDSv2) [[GH-6779](https://github.com/hashicorp/nomad/issues/6779)] + * client: Updated consul-template library to v0.24.1 - added support for working with consul connect. Deprecated vault_grace. [[GH-7170](https://github.com/hashicorp/nomad/pull/7170)] * consul: Add support for service `canary_meta` [[GH-6690](https://github.com/hashicorp/nomad/pull/6690)] * driver/docker: Added a `disable_log_collection` parameter to disable nomad log collection [[GH-6820](https://github.com/hashicorp/nomad/issues/6820)] * server: Introduced a `default_scheduler_config` config parameter to seed initial preemption configuration. [[GH-6935](https://github.com/hashicorp/nomad/issues/6935)] diff --git a/command/agent/job_endpoint.go b/command/agent/job_endpoint.go index d7b86c3badfb..9f5b4b1ed38a 100644 --- a/command/agent/job_endpoint.go +++ b/command/agent/job_endpoint.go @@ -914,6 +914,7 @@ func ApiTaskToStructsTask(apiTask *api.Task, structsTask *structs.Task) { LeftDelim: *template.LeftDelim, RightDelim: *template.RightDelim, Envvars: *template.Envvars, + VaultGrace: *template.VaultGrace, } } } diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index a6b7678c67b8..f5bef31fbd1d 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -5960,6 +5960,12 @@ type Template struct { // Empty lines and lines starting with # will be ignored, but to avoid // escaping issues #s within lines will not be treated as comments. Envvars bool + + // VaultGrace is the grace duration between lease renewal and reacquiring a + // secret. If the lease of a secret is less than the grace, a new secret is + // acquired. + // COMPAT(0.12) VaultGrace has been ignored by Vault since Vault v0.5. + VaultGrace time.Duration } // DefaultTemplate returns a default template. @@ -6033,6 +6039,10 @@ func (t *Template) Validate() error { } } + if t.VaultGrace > 0 { + multierror.Append(&mErr, fmt.Errorf("VaultGrace has been deprecated as of Nomad 0.11 and ignored since Vault 0.5. Please remove VaultGrace / vault_grace from template stanza.")) + } + return mErr.ErrorOrNil() }