Skip to content

fix(clustered): propagate pod metadata to JobSet - #8000

Open
Chiuuu0209 wants to merge 1 commit into
flyteorg:mainfrom
Chiuuu0209:fix/clustered-jobset-metadata
Open

fix(clustered): propagate pod metadata to JobSet#8000
Chiuuu0209 wants to merge 1 commit into
flyteorg:mainfrom
Chiuuu0209:fix/clustered-jobset-metadata

Conversation

@Chiuuu0209

Copy link
Copy Markdown

Tracking issue

Closes #7989

Why are the changes needed?

PodTemplate labels and annotations are propagated to the child pod
template but not to the parent JobSet. Controllers such as Kueue read
queue labels from the parent JobSet CRD, so clustered tasks using these
labels cannot be admitted correctly.

What changes were proposed in this pull request?

Merge the resolved PodTemplate labels and annotations into the JobSet's
ObjectMeta.

Flyte-managed metadata is applied after the PodTemplate metadata so that
the following values retain precedence:

  • flyte.org/execution
  • flyte.org/task-type
  • flyte.org/primary-container

A regression test verifies that custom labels and annotations are
propagated to both the parent JobSet and the child pod template. It also
verifies that Flyte-managed metadata retains precedence over
user-provided values.

The regression test was confirmed to fail before the fix because the
custom metadata was absent from the parent JobSet.

How was this patch tested?

go test -race ./flyteplugins/go/tasks/plugins/k8s/clustered \
  -run '^TestBuildResource_PropagatesPodTemplateMetadataToJobSet$' \
  -count=1

go test -race ./flyteplugins/go/tasks/plugins/k8s/clustered -count=1

go test -race -coverprofile=coverage.out \
  -covermode=atomic ./flyteplugins/...

go vet ./flyteplugins/go/tasks/plugins/k8s/clustered

All commands passed.

make -C flyteplugins lint did not reach the lint step because the local
tooling bootstrap expected flytestdlib/bin/pflags, which is not produced
by the current flytestdlib compile target.

Labels

fixed

Setup process

No special setup is required.

Screenshots

Not applicable.

Check all the applicable boxes

  • I updated the documentation accordingly. Not applicable: no documented behavior changed.
  • All new and existing tests passed.
  • All commits are signed-off.

Signed-off-by: Chris Chiu <69319144+Chiuuu0209@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 8, 2026 08:21
@github-actions github-actions Bot added the flyte2 label Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is small, aligns with the stated behavior and precedence requirements, and is covered by a focused regression test.

Pull request overview

This PR fixes the clustered K8s plugin so labels/annotations resolved onto the PodTemplate are also propagated to the parent JobSet’s ObjectMeta, enabling admission controllers (e.g., Kueue) that rely on CRD-level metadata to function correctly for clustered tasks.

Changes:

  • Merge resolved pod-template labels into JobSet ObjectMeta.Labels, while ensuring flyte.org/execution retains precedence.
  • Merge resolved pod-template annotations into JobSet ObjectMeta.Annotations, while ensuring Flyte-owned annotations retain precedence.
  • Add a regression test covering both propagation (parent + child) and precedence behavior.
File summaries
File Description
flyteplugins/go/tasks/plugins/k8s/clustered/build.go Propagates resolved pod-template labels/annotations up to the parent JobSet, preserving Flyte-owned key precedence.
flyteplugins/go/tasks/plugins/k8s/clustered/clustered_test.go Adds regression coverage asserting parent JobSet receives custom metadata and Flyte-owned keys override user-provided values.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[clustered plugin] PodTemplate labels/annotations not propagated to JobSet ObjectMeta

2 participants