mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Merge pull request #43622 from deads2k/cli-10-category
Automatic merge from submit-queue (batch tested with PRs 42087, 43383, 43622) move category expansion out of restmapper RESTMapping isn't related to CategoryExpansion (the bit that expands "all" into items to be RESTMapped). This provides that separation and simplifies the RESTMapper interface. @kubernetes/sig-cli-pr-reviews
This commit is contained in:
@@ -105,6 +105,20 @@ func (f *ring1Factory) UnstructuredObject() (meta.RESTMapper, runtime.ObjectType
|
||||
return expander, typer, err
|
||||
}
|
||||
|
||||
func (f *ring1Factory) CategoryExpander() resource.CategoryExpander {
|
||||
var categoryExpander resource.CategoryExpander
|
||||
categoryExpander = resource.LegacyCategoryExpander
|
||||
discoveryClient, err := f.clientAccessFactory.DiscoveryClient()
|
||||
if err == nil {
|
||||
// wrap with discovery based filtering
|
||||
categoryExpander, err = resource.NewDiscoveryFilteredExpander(categoryExpander, discoveryClient)
|
||||
// you only have an error on missing discoveryClient, so this shouldn't fail. Check anyway.
|
||||
CheckErr(err)
|
||||
}
|
||||
|
||||
return categoryExpander
|
||||
}
|
||||
|
||||
func (f *ring1Factory) ClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error) {
|
||||
cfg, err := f.clientAccessFactory.ClientConfig()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user