Add default-resource-class-name config option#798
Merged
Conversation
Allow specifying a default resource class that applies to jobs without an explicit resource_class agent tag.
Jobs without a resource_class agent tag now fall back to the configured default. Tag-specified classes still take priority.
a63feb0 to
4f1baa4
Compare
moskyb
reviewed
Jan 7, 2026
Contributor
moskyb
left a comment
There was a problem hiding this comment.
this looks really good! i've been wanting to add this feature myself ever since we added resource classes, so thank you!
one note: it might be worth adding a validation in controller.ParseAndValidateconfig to ensure that the default resource class is included in the list of resource classes provided, as it would significantly shorten the loop on fixing errors like missspelling the default resource class or similar.
so we can fail fast back to the user when they do a syntax silly or what not
Contributor
Author
oo yea that's a great idea, tyvm b6087f9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
We really like using
resource_classesfrom #668 to be able to vary CPU/memory requests based off a single agent template, but currently if a pipeline step doesn't specify aresource_class: foo, they don't get any resource requests at all. I was hoping perhaps specifying resources inpod-spec-patchwould be the fallback/default in that case, but pod-spec-patch's resources override anything fromresource_class:applyResourceClass happens around 524:
agent-stack-k8s/internal/controller/scheduler/scheduler.go
Lines 524 to 527 in 4beedd0
and then later on the pod-spec-patch and plugin spec patches are applied on top:
agent-stack-k8s/internal/controller/scheduler/scheduler.go
Lines 739 to 742 in 4beedd0
agent-stack-k8s/internal/controller/scheduler/scheduler.go
Lines 753 to 755 in 4beedd0
it'd be nice to have a default that applies when a step doesn't remember to specify a
resource_classChanges
Adds a new
default-resource-class-nameconfig option that references a named resource class fromresource-classes. When a job doesn't have aresource_classagent tag, the default kicks in; jobs that explicitly setresource_classstill take priority.usage looks like:
I also added
resource-classesto the helm schema since it seemed to be missing?Testing
applyResourceClasscovering the various combinations (no tag/no default, tag specified, default fallback, tag overrides default, error cases)