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

MaxClientDisconnect Jobspec checklist #12177

Conversation

DerekStrickland
Copy link
Contributor

@DerekStrickland DerekStrickland commented Mar 3, 2022

max_client_disconnect Jobspec Checklist

Code

  • Consider similar features in Consul, Kubernetes, and other tools. Is there prior art we should match? Terminology, structure, etc?
  • Add structs/fields to api/ package
    • New fields should be added to existing Canonicalize, Copy methods
      • No existing Copy Method
      • No default and nothing inherited from job, so no need to updated Canonicalize
    • Test the structs/fields via methods mentioned above
      • Not applicable
  • Add structs/fields to nomad/structs package - NOTE: That field was added in a previous PR
    • structs/ structs usually have Copy, Equals, and Validate methods
    • Validation happens in this package and must be implemented
    • Note that analogous struct field names should match with api/ package
    • Test the structs/fields via methods mentioned above
    • Implement and test other logical methods - Note: implementation link is to a previous PR
  • Add conversion between api/ and nomad/structs/ in command/agent/job_endpoint.go
    • Add test for conversion
  • Determine JSON encoding strategy for responses from RPC
  • Implement diff logic for new structs/fields in nomad/structs/diff.go
    • Add test for diff of new structs/fields
  • Add change detection for new structs/fields in scheduler/util.go/tasksUpdated
    • Not applicable - non-desctructive change

Docs

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.

LGTM. I've left some small suggestions but once those are resolved it should be good-to-merge

if tg.MaxClientDisconnect == nil {
oldPrimitiveFlat["MaxClientDisconnect"] = ""
} else {
oldPrimitiveFlat["MaxClientDisconnect"] = fmt.Sprintf("%d", *tg.MaxClientDisconnect)
Copy link
Member

Choose a reason for hiding this comment

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

This the first time I really noticed what we're doing to these duration fields in Diff and it's kinda weird to squash them down into ints, right? But definitely the right thing to match the behavior of the other fields. 🤷

nomad/structs/structs.go Outdated Show resolved Hide resolved
nomad/structs/structs_test.go Show resolved Hide resolved
website/content/api-docs/jobs.mdx Outdated Show resolved Hide resolved
@DerekStrickland DerekStrickland merged commit 060182e into f-disconnected-client-allocation-handling Mar 4, 2022
@DerekStrickland DerekStrickland deleted the f-jobspec-disconnected-clients branch March 4, 2022 16:28
DerekStrickland added a commit that referenced this pull request Apr 5, 2022
* api: Add struct, conversion function, and tests
* TaskGroup: Add field, validation, and tests
* diff: Add diff handler and test
* docs: Update docs
DerekStrickland added a commit that referenced this pull request Apr 6, 2022
* api: Add struct, conversion function, and tests
* TaskGroup: Add field, validation, and tests
* diff: Add diff handler and test
* docs: Update docs
@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 Oct 27, 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.

None yet

2 participants