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

Update consul-template to v0.24.1 and remove deprecated vault grace #7170

Merged

Conversation

fredrikhgrelland
Copy link
Contributor

Fixes #6946
Needed consul connect ca features of consul-template in nomad.

@fredrikhgrelland fredrikhgrelland requested a review from a team as a code owner February 17, 2020 18:53
@fredrikhgrelland
Copy link
Contributor Author

@schmichael I needed the new template features for consul connect in a presentation.
I hope this helps to get the consul-template library updated in nomad.

Copy link
Contributor

@jescalan jescalan left a comment

Choose a reason for hiding this comment

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

Docs changes are good!

Copy link
Member

@schmichael schmichael left a comment

Choose a reason for hiding this comment

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

Thanks @fredrikhgrelland !

For the next release we should emit a warning before removing the field entirely. I made comments that should guide you through the required changes.

Let me know if you don't have time to make the changes, and I can do it.

Thanks again!

command/agent/job_endpoint.go Outdated Show resolved Hide resolved
jobspec/parse_task.go Outdated Show resolved Hide resolved
nomad/structs/structs.go Show resolved Hide resolved
nomad/structs/structs.go Show resolved Hide resolved
@schmichael
Copy link
Member

We'll also need to add a changelog entry and section to https://github.com/hashicorp/nomad/blob/master/website/pages/guides/upgrade/upgrade-specific.mdx

We can always do that in a followup PR.

@fredrikhgrelland
Copy link
Contributor Author

@schmichael I implemented the suggested changes and added the documentation. Let me know if there is anything else.

@fredrikhgrelland
Copy link
Contributor Author

Found a panic when posting job. Will investigate.

@@ -737,9 +737,6 @@ func (tmpl *Template) Canonicalize() {
if tmpl.Envvars == nil {
tmpl.Envvars = boolToPtr(false)
}
if tmpl.VaultGrace == nil {
tmpl.VaultGrace = timeToPtr(15 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

Removing this is probably the source of panics/issues. It ensured VaultGrace was always initialized (never nil) in the HTTP API.

Removing this code is the right thing to do. We just need to fix any code that depended on VaultGrace always being non-nil. I'll investigate and try to help.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry haven't found time today to fix this up. The really sneaky place that converts public api structs to internal nomad/structs structs is hidden in the job endpoint here: https://github.com/hashicorp/nomad/blob/v0.10.4/command/agent/job_endpoint.go#L620

That may need updating to convert nil api VaultGrace values to 0 nomad/struct VaultGrace values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment below.

@@ -374,6 +374,7 @@ func parseTemplates(result *[]*api.Template, list *ast.ObjectList) error {
ChangeMode: helper.StringToPtr("restart"),
Splay: helper.TimeToPtr(5 * time.Second),
Perms: helper.StringToPtr("0644"),
VaultGrace: helper.TimeToPtr(0),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added default value in parser. Time.period can not be nil.
This allows for silent parsing when vault_grace is not set or set to 0. Warning when set to a non zero value.

@fredrikhgrelland
Copy link
Contributor Author

@schmichael Apologies for all the pushes. I have added warnings to templates, and made changes to the documentation and change log to match the current situation.
Nomad will happily run with and without vault_grace set, I am however not able to figure out the tests. The addition of VaultGrace: helper.TimeToPtr(0), in parseTemplates might not be the most elegant solution-
Please have a look at the current state. I am happy to do more changes, but without more experience with this code base I am a bit stuck now.

Copy link
Member

@schmichael schmichael left a comment

Choose a reason for hiding this comment

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

Thanks for your hard work on this @fredrikhgrelland ! I can take over any test failures from here. I really appreciate you sticking with this. There is a lot of plumbing involved in jobspec handling.

@schmichael schmichael merged commit 64c40af into hashicorp:master Mar 10, 2020
schmichael added a commit that referenced this pull request Mar 10, 2020
Followup to #7170

- Moved canonicalization of VaultGrace back into `api/` package.
- Fixed tests.
- Made docs styling consistent.
@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 Jan 16, 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.

Upgrade consul-template and remove deprecated Grace field
3 participants