feat(workergateway): populate clusters in aggregated instancetypeflavor#31
Merged
Merged
Conversation
There was a problem hiding this comment.
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
AggregatedInstanceTypeFlavorSpecto embedworker.InstanceTypeFlavorSpecand add aClusters []stringfield. - Rework aggregated flavor deduplication to index by
Specand accumulate contributing clusters per aggregated entry. - Ensure deterministic output by sorting each aggregated flavor’s
Clusterslist 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. |
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>
7813e3d to
dc67d98
Compare
Comment on lines
+83
to
85
| item := &in.list.Items[itemIndex] | ||
| item.Spec.Clusters = append(item.Spec.Clusters, cluster) | ||
| return nil |
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.
What type of PR is this?
/kind enhancement
/kind api-change
/area workergateway
What this PR does / why we need it:
The aggregated
instancetypeflavorlisting deduplicates identical flavor pools acrossclusters into a single entry, but until now dropped which clusters actually served each
pool. This PR attributes every contributing cluster to its aggregated flavor.
AggregatedInstanceTypeFlavorSpecbecomes a struct embeddingworker.InstanceTypeFlavorSpecand adding a
Clusters []stringfield (was a bare type alias).accumulates every contributing cluster instead of discarding all but the first.
Resultsorts each item'sClustersascending, so the output is deterministic regardless ofcluster iteration order.
Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
Clustersis populated per(cluster, spec)and never duplicated: within a cluster a flavor'sname is deterministic from its spec, so each pair appears at most once during iteration.
Does this PR introduce a user-facing change?