Skip to content

Fix findlabelSelector when vai enabled but resource type not supported#16734

Merged
richard-cox merged 1 commit intorancher:masterfrom
richard-cox:fix-findLabelSelector-unsupported-types
Feb 26, 2026
Merged

Fix findlabelSelector when vai enabled but resource type not supported#16734
richard-cox merged 1 commit intorancher:masterfrom
richard-cox:fix-findLabelSelector-unsupported-types

Conversation

@richard-cox
Copy link
Copy Markdown
Member

@richard-cox richard-cox commented Feb 23, 2026

Summary

Fixes #16621

Occurred changes and/or fixed issues

  • When vai is enabled the old method of applying labelSelectors server-side is not supported
  • At the moment though we use the old method if vai is enabled AND the resource is configured to use it
  • This led to bugs where vai enabled, resource is not configured to use it --> old method
  • Now we don't check if the type supports ssp, we just check vai enabled
    • The supported flag is just something locally to enable us to easily manage resources that use ssp lists / other features
    • They're tracked in shell/plugins/steve/steve-pagination-utils.ts PAGINATION_SETTINGS_STORE_DEFAULTS

Technical notes summary

  • This only affects two places, and only when supplied type is not SSP enabled
    • findLabelSelector
      • shell/dialog/ExtensionCatalogUninstallDialog.vue finding catalog.cattle.io.clusterrepo
      • shell/dialog/ScaleMachineDownDialog.vue finding cluster.x-k8s.io.machineset
      • _findRelationship --> findOwned --> shell/models/compliance.cattle.io.clusterscan.js getReports
    • shell/utils/selector-typed.ts matching fn
      • not used anywhere that supplies a type not SSP enabled

Areas or cases that should be tested

  • RKE2 scale down modal
    • Provision an RKE2 cluster with 3 pools, two with just a worker
    • Nav to cluster detail page, open dev tools
    • Confirm that http requests to fetch cluster.x-k8s.io.machineset return 1 result when...
      • for each machine in each worker pool click action menu --> Scale down.
      • a model should show which kicks off a request to fetch machinesets in that pool
      • the requests should return only the machine relevant to the pool
  • Compliance (replacement app for CIS Benchmark)

Areas which could experience regressions

  • Find two deployments with different amount of pods
  • Flick multiple times between the detail page of each deployment and ensure the Pods list contains the correct values
  • Also refresh on a detail page and ensure Pods list contains correct values

Screenshot/Video

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 fixes labelSelector-based lookups when the Steve cache (VAI) is enabled by ensuring the code paths use the cache-backed pagination API rather than the legacy labelSelector request parameter, which is not supported in that mode.

Changes:

  • Switch findLabelSelector and selector-typed matching() to treat VAI enablement as the deciding factor (instead of per-type SSP enablement).
  • Fix selector/page caching bookkeeping so the store’s “what’s cached” record matches what is actually in the cache.
  • Update matchingLabelSelector behavior and add unit tests to cover key cache scenarios; also restore fetching Services in workload detail to populate related-services.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
shell/utils/selector-typed.ts Uses VAI enablement to choose findPage vs local filtering when matching label selectors.
shell/plugins/dashboard-store/actions.js Updates findLabelSelector to use findPage whenever VAI is enabled.
shell/plugins/dashboard-store/mutations.js Resets cache “haveX” tracking when loading selector results to avoid stale/incorrect selector bookkeeping.
shell/plugins/dashboard-store/getters.js Adjusts matchingLabelSelector behavior when the cache contains a VAI page or all resources.
shell/plugins/dashboard-store/__tests__/getters.test.ts Adds tests for matchingLabelSelector decision logic.
shell/detail/workload/index.vue Fetches Services in the workload namespace so relatedServices can be resolved.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- vai on - old style not supported, so always use new style
- so ignore if type is ssp enabled or not, just look at feature flag
@richard-cox richard-cox force-pushed the fix-findLabelSelector-unsupported-types branch from 34a82ef to 4ab442f Compare February 24, 2026 13:36
@richard-cox richard-cox marked this pull request as ready for review February 24, 2026 13:41
@richard-cox richard-cox merged commit 6015496 into rancher:master Feb 26, 2026
48 of 50 checks passed
@richard-cox richard-cox deleted the fix-findLabelSelector-unsupported-types branch February 26, 2026 14:08
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.

findLabelSelector is broken when vai is enabled and resource does not support ssp

3 participants