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

Node Drain Metadata #10250

Merged
merged 19 commits into from
May 7, 2021
Merged

Node Drain Metadata #10250

merged 19 commits into from
May 7, 2021

Conversation

cgbaker
Copy link
Contributor

@cgbaker cgbaker commented Mar 28, 2021

resolves #9928

This persists information about the last "drain operation" in a new Node.LastDrain field. A "drain operation" begins when the node begins draining, and ends when the drain is complete or canceled. A new drain operation will overwrite any existing Node.LastDrain field.

In addition to native metadata about the drain operation (start time, status, end time), operators can provide additional key/value pairs about the drain operation:

  • API: via the .Meta field in the drain payload
  • CLI: via the -meta flag or the -m git-style shortcut (which is a shortcut for Meta.message or Meta.cancel_message, appropriately)

The work in this PR performs the following:

  • a new field LastDrain in structs.Node and api.Node
  • updates to the FSM and the state store to propagate LastDrain
    • a fair bit of this was just around properly resetting or propagating this field
  • tests, including the distinction between drain cancellation and completion
  • API and SDK support for LastDrain and drain metadata during drain updates
  • CLI support for -m and -meta
  • CLI and API documentation

@cgbaker cgbaker changed the title F drain metadata WIP: Node Drain Metadata Mar 29, 2021
cgbaker added a commit that referenced this pull request Mar 31, 2021
@cgbaker cgbaker changed the title WIP: Node Drain Metadata Node Drain Metadata Apr 1, 2021
cgbaker added a commit that referenced this pull request Apr 1, 2021
@cgbaker cgbaker force-pushed the f-drain-metadata branch from 549e981 to 7e8a3a5 Compare April 1, 2021 21:53
}, q)
return resp, err
}

Copy link
Contributor Author

@cgbaker cgbaker Apr 1, 2021

Choose a reason for hiding this comment

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

needed a new method, followed the Jobs().RegisterOpts() pattern so we'll never need to do this again 🤞

@@ -43,13 +43,13 @@ func TestHTTP_NodesList(t *testing.T) {
}

// Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
if respW.Header().Get("X-Nomad-Index") == "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

all of these are because HeaderMap is deprecated, thought I'd clean up while I was in here

@vercel vercel bot temporarily deployed to Preview – nomad April 1, 2021 22:13 Inactive
@cgbaker cgbaker added this to the 1.1.0 milestone Apr 1, 2021
@cgbaker cgbaker marked this pull request as ready for review April 1, 2021 22:32
@cgbaker cgbaker requested a review from schmichael April 1, 2021 22:32
@lgfa29 lgfa29 force-pushed the f-drain-metadata branch from bef417c to 180f8a5 Compare May 7, 2021 17:35
@vercel vercel bot temporarily deployed to Preview – nomad May 7, 2021 17:35 Inactive
@lgfa29 lgfa29 merged commit 140e7b3 into main May 7, 2021
@lgfa29 lgfa29 deleted the f-drain-metadata branch May 7, 2021 17:58
@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 23, 2022
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.

Node drain metadata
4 participants