Skip to content

feat(workergateway): populate clusters in aggregated instancetypeflavor#31

Merged
thxCode merged 1 commit into
mainfrom
feat/workergateway-aggregate-flavor-clusters
Jul 10, 2026
Merged

feat(workergateway): populate clusters in aggregated instancetypeflavor#31
thxCode merged 1 commit into
mainfrom
feat/workergateway-aggregate-flavor-clusters

Conversation

@thxCode

@thxCode thxCode commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

/kind enhancement
/kind api-change
/area workergateway

What this PR does / why we need it:

The aggregated instancetypeflavor listing deduplicates identical flavor pools across
clusters into a single entry, but until now dropped which clusters actually served each
pool. This PR attributes every contributing cluster to its aggregated flavor.

  • AggregatedInstanceTypeFlavorSpec becomes a struct embedding worker.InstanceTypeFlavorSpec
    and adding a Clusters []string field (was a bare type alias).
  • The aggregate list operator now indexes entries by spec (replacing the visited-set dedup) and
    accumulates every contributing cluster instead of discarding all but the first.
  • Result sorts each item's Clusters ascending, so the output is deterministic regardless of
    cluster iteration order.

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

Clusters is populated per (cluster, spec) and never duplicated: within a cluster a flavor's
name is deterministic from its spec, so each pair appears at most once during iteration.

Does this PR introduce a user-facing change?

The aggregated instance-type-flavor listing now reports the `clusters` serving each flavor.

Copilot AI review requested due to automatic review settings July 10, 2026 11:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the workergateway aggregated instancetypeflavor response to retain and report which clusters contribute to each deduplicated flavor pool, improving observability for multi-cluster deployments.

Changes:

  • Extend AggregatedInstanceTypeFlavorSpec to embed worker.InstanceTypeFlavorSpec and add a Clusters []string field.
  • Rework aggregated flavor deduplication to index by Spec and accumulate contributing clusters per aggregated entry.
  • Ensure deterministic output by sorting each aggregated flavor’s Clusters list ascending.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/workergateway/service/types.go Changes aggregated flavor spec from alias to struct and adds clusters field to the JSON response shape.
pkg/workergateway/service/helper.go Updates aggregation logic to collect clusters per deduped spec and sorts cluster lists for determinism.
pkg/workergateway/service/helper_test.go Updates/extends tests to validate cluster accumulation and sorted cluster output.

Comment thread pkg/workergateway/service/helper.go Outdated
Turn AggregatedInstanceTypeFlavorSpec from an alias into a struct that
embeds InstanceTypeFlavorSpec and adds a Clusters field, then have the
aggregate list operator accumulate every contributing cluster per spec
instead of only deduplicating. Result sorts each item's Clusters so the
output is deterministic regardless of cluster iteration order.

Signed-off-by: thxCode <thxcode0824@gmail.com>
Copilot AI review requested due to automatic review settings July 10, 2026 11:39
@thxCode thxCode force-pushed the feat/workergateway-aggregate-flavor-clusters branch from 7813e3d to dc67d98 Compare July 10, 2026 11:39
@thxCode thxCode merged commit 618e7b1 into main Jul 10, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines +83 to 85
item := &in.list.Items[itemIndex]
item.Spec.Clusters = append(item.Spec.Clusters, cluster)
return nil
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.

2 participants