You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LazyRESTMapper KindsFor does not return all versions when single version is previously queried #2349
addKnownGroupAndReload is only triggered when no matches are found. If priming the mapper with a single version and then requesting all versions (not specifying version), a match is found and only a single version returned (not multiple versions).
The test passes if lazyRestMapper.KindsFor(schema.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscaler"}) is removed, thus making the other KindsFor trigger a addKnownGroupAndReload.
t.Run("LazyRESTMapper should be able to fetch all versions after fetching single version", func(t*testing.T) {
g:=gmg.NewWithT(t)
httpClient, err:=rest.HTTPClientFor(restCfg)
g.Expect(err).NotTo(gmg.HaveOccurred())
lazyRestMapper, err:=apiutil.NewDynamicRESTMapper(restCfg, httpClient)
g.Expect(err).NotTo(gmg.HaveOccurred())
_, err=lazyRestMapper.KindsFor(schema.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscaler"})
g.Expect(err).NotTo(gmg.HaveOccurred())
kinds, err:=lazyRestMapper.KindsFor(schema.GroupVersionResource{Group: "autoscaling", Resource: "horizontalpodautoscaler"})
g.Expect(err).NotTo(gmg.HaveOccurred())
g.Expect(len(kinds)).To(gmg.BeNumerically(">", 1))
})
Suggestion
Trigger addKnownGroupAndReload when schema.GroupVersionResource input is partial, and some fields are unspecified.
changed the title [-]LazyRESTMapper does not discover new resources when match is found[/-][+]LazyRESTMapper KindsFor does not return all versions when single version is previously queried[/+]on May 25, 2023
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
This still looks live on main. All the *For methods only call addKnownGroupAndReload on a NoMatchError, so once a group has been primed with a single version (the autoscaling/v1 case here), a later version-less KindsFor finds that one match and returns just it, without reloading to pick up the rest.
The catch is we don't want to reload on every version-less query, since that gives up the lazy caching. But there's already enough state to tell a group is only partially loaded: apiGroups[group] has the full version list from discovery, while knownGroups[group] holds whatever has been loaded so far. So for a partial input (empty version) we could reload only when knownGroups is missing versions that discovery advertises, and leave the fast path alone otherwise.
Happy to open a PR along those lines, using the test from the issue. Does that match what you had in mind, or would you rather detect the partial input some other way?
Activity
[-]LazyRESTMapper does not discover new resources when match is found[/-][+]LazyRESTMapper KindsFor does not return all versions when single version is previously queried[/+]k8s-triage-robot commentedon Jan 21, 2024
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle stale/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
sbueringer commentedon Feb 9, 2024
/triage accepted
We fixed a somewhat related issue recently via: #2663. But I think this doesn't change the problem described here.
k8s-triage-robot commentedon Feb 8, 2025
This issue has not been updated in over 1 year, and should be re-triaged.
You can:
/triage accepted(org members only)/closeFor more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/
/remove-triage accepted
k8s-triage-robot commentedon Mar 10, 2025
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
k8s-triage-robot commentedon Apr 9, 2025
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/reopen/remove-lifecycle rottenPlease send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
k8s-ci-robot commentedon Apr 9, 2025
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
Details
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
sbueringer commentedon May 8, 2025
/remove-lifecycle rotten
/lifecycle frozen
/reopen
k8s-ci-robot commentedon May 8, 2025
@sbueringer: Reopened this issue.
Details
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
arpitjain099 commentedon Jul 3, 2026
This still looks live on main. All the
*Formethods only calladdKnownGroupAndReloadon aNoMatchError, so once a group has been primed with a single version (the autoscaling/v1 case here), a later version-lessKindsForfinds that one match and returns just it, without reloading to pick up the rest.The catch is we don't want to reload on every version-less query, since that gives up the lazy caching. But there's already enough state to tell a group is only partially loaded:
apiGroups[group]has the full version list from discovery, whileknownGroups[group]holds whatever has been loaded so far. So for a partial input (empty version) we could reload only whenknownGroupsis missing versions that discovery advertises, and leave the fast path alone otherwise.Happy to open a PR along those lines, using the test from the issue. Does that match what you had in mind, or would you rather detect the partial input some other way?