Skip to content

fix: update armada to respect node pod limits#4517

Closed
jparraga-stackav wants to merge 4 commits intoarmadaproject:masterfrom
jparraga-stackav:issue-4515
Closed

fix: update armada to respect node pod limits#4517
jparraga-stackav wants to merge 4 commits intoarmadaproject:masterfrom
jparraga-stackav:issue-4515

Conversation

@jparraga-stackav
Copy link
Copy Markdown

@jparraga-stackav jparraga-stackav commented Nov 6, 2025

What type of PR is this?

Bug fix

What this PR does / why we need it:

This pull request updates armada to respect node limits. Without this change it is possible for Armada to try and schedule pods to nodes which do not have capacity in regards to concurrent running pods. When this happens the pods get stuck in a pending state and end up getting lease returned. Presumably Armada considers these pods towards fair share even though they cannot run.

  1. Configures default pod limits in the Armada server to include pods
  2. Configures the Armada scheduler to consider pods resource in scheduling decisions by default
  3. Updates the executor to sanitize pod resources before submitting pods to k8s
  4. Configures the executor to sanitize pod pods resources by default

Which issue(s) this PR fixes:

Fixes #4515

Special notes for your reviewer:

In order to rollout safely the executors must be updated first. After that the scheduler/server can be rolled out in any order.

Jason Parraga added 2 commits November 6, 2025 00:47
Signed-off-by: Jason Parraga <jparraga@stackav.com>
Signed-off-by: Jason Parraga <jparraga@stackav.com>
FailedPodChecks podchecks.FailedChecks
PendingPodChecks *podchecks.Checks
FatalPodSubmissionErrors []string
ResourcesToSanitize []string
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.

Can you please add docs for the new field?

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.

In our docs, we often link to config in https://pkg.go.dev, i.e. for the executor it will be https://pkg.go.dev/github.com/armadaproject/armada/internal/executor/configuration#ApplicationConfiguration, it is easier for the end-users if they can see the config field docs there.

}

// Sanitizes pod resources that may be used during scheduling but are invalid at runtime.
func (submitService *SubmitService) sanitizePodResources(pod *v1.Pod) {
Copy link
Copy Markdown
Member

@dejanzele dejanzele Nov 7, 2025

Choose a reason for hiding this comment

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

nit: this function can be simplified to a simple sanitizePodResources function, no need for it to be a receiver method on SubmitService, same for sanitizeResourceList

@JamesMurkin
Copy link
Copy Markdown
Contributor

Hey so generally a good direction but I there are a few things I think we'd like to consider / possibly change

  1. Generally we're trying to move to a world where all mutation happens on the executor API, and the executor does less edits. This PR does not move us in that direction
  2. We already basically have this functionality in the executor API
  1. I think we should debate if we add pods to more of the config:
  • indexedResources - I think add it here
  • dominantResourceFairnessResourcesToConsider - possibly add it here. It'd mean we fairshare on pods, which is probably correct in some cases (happy to leave this for now)
  1. Could we confirm if you overwrite the config it does actually remove pods (I can't remember if it merges or overwrites and I don't have time to test now)
  2. I'm somewhat debating if we should add it as defaultJobLimits as it means now the api + scheduler need to be configured in unison. It could just be a scheduler concern (tbh all of this PR could be just a scheduler concern) but I think this is probably the most configurable option for now.

@dave-gantenbein
Copy link
Copy Markdown
Member

@dejanzele @nikola-jokic to reveiw

@dejanzele
Copy link
Copy Markdown
Member

Closing in favour of #4841

@dejanzele dejanzele closed this Apr 24, 2026
dejanzele added a commit that referenced this pull request Apr 27, 2026
…ity (#4841)

## Summary

- Adds `scheduling.respectNodePodLimits` feature flag (default `false`)
that enables the scheduler to track `pods` as a resource and reject
scheduling to nodes that have exhausted their pod limit
(`node.Status.Allocatable["pods"]`)
- When enabled, the scheduler programmatically registers `pods` in
`supportedResourceTypes` and `indexedResources` at startup, and injects
`pods: 1` into every job's internal resource requirements
- The executor now always reports non-Armada pod count in
`NonArmadaAllocatedResources` so the scheduler can subtract
system/DaemonSet pods from available capacity

Fixes #4515

This PR builds on top of
#4517 and big thanks for the
initial work to @Sovietaced

## Operator upgrade notes

- **Executor change is unconditional.** After the executor upgrade,
`NonArmadaAllocatedResources` gains a `pods` key in every report
regardless of whether any scheduler has the flag enabled. Dashboards,
metrics, or custom consumers that iterate this map generically (e.g. sum
over all keys) will start including pod counts. Audit prometheus /
Grafana panels before rollout.
- **Rollback is clean.** Reverting the scheduler flag to `false` stops
the scheduler from tracking pods; reverting the executor binary removes
the `pods` key from its reports. Neither requires data migration.
- **Rolling upgrade order is flexible.** Old scheduler + new executor is
safe (scheduler's `FromNodeProto` silently drops unknown resources). New
scheduler + old executor briefly overestimates free pod capacity by the
count of non-Armada pods per node (~10-30 typically, DaemonSets + system
pods), since the old executor does not report them. The overestimate
resolves as executors are upgraded.

## Known limitations

- `pods` is **not** added to
`dominantResourceFairnessResourcesToConsider`. On dense-pod nodes (e.g.
GKE's 110-pod limit) a queue running many small pods can monopolize pod
slots without a fair-share penalty. Deferred per reviewer request;
follow-up if this becomes a problem in practice.

Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler does not respect node pod limits

4 participants