Skip to content

remove deprecated resource fields from Allocation struct - #28486

Open
tgross wants to merge 2 commits into
mainfrom
alloc-remove-deprecated-resource-fields
Open

remove deprecated resource fields from Allocation struct#28486
tgross wants to merge 2 commits into
mainfrom
alloc-remove-deprecated-resource-fields

Conversation

@tgross

@tgross tgross commented Sep 2, 2026

Copy link
Copy Markdown
Member

As part of the "client v2" effort for Nomad 0.9 we changed how allocated resources were tracked, but we ended up leaving the existing struct fields around. All consumers of these fields have been updated to handle the newer fields for a very long time.

Remove the fields from the nomad/structs package version of the object, and formally deprecate them in the api package. This also requires removing the upgrade path in the client state database, but the state database is automatically updated on agent upgrades and Nomad clients older than 1.6 have been non-functional since 1.9. So this only impacts users trying to restore from pre-0.9 backups of their state stores, which seems safe.

Ref: #28447 (comment)

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation n/a
  • LLM Usage n/a

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

@chrisroberts chrisroberts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm familiarizing myself with where these were still in use. All these adjustments look great to me so far. I did find that AllocatedResources.OldTaskResources() still exists but should probably be removed with this changeset.

Outside of that, I think the only other thing of note I've seen is the ent specific usage of TaskResources.

As part of the "client v2" effort for Nomad 0.9 we changed how allocated
resources were tracked, but we ended up leaving the existing struct fields
around. All consumers of these fields have been updated to handle the newer
fields for a very long time.

Remove the fields from the `nomad/structs` package version of the object, and
formally deprecate them in the `api` package. This also requires removing the
upgrade path in the client state database, but the state database is
automatically updated on agent upgrades and Nomad clients older than 1.6 have
been non-functional since 1.9. So this only impacts users trying to restore from
pre-0.9 backups of their state stores, which seems safe.
@tgross

tgross commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

I'm familiarizing myself with where these were still in use. All these adjustments look great to me so far. I did find that AllocatedResources.OldTaskResources() still exists but should probably be removed with this changeset.

done!

Outside of that, I think the only other thing of note I've seen is the ent specific usage of TaskResources.

gah! The quotas feature uses these pretty heavily in particular. I'll open an ENT PR that moves those uses to AllocatedResources before merging this one.

@tgross

tgross commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

Working branch for the ENT code in https://github.com/hashicorp/nomad-enterprise/pull/4467. I'll pick that up next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/2.0.x backport to 2.0.x release line type/tech-debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants