mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
divide statically known typer from dynamically derive restmapper
This commit is contained in:
@@ -342,7 +342,7 @@ func (f *TestFactory) Command(*cobra.Command, bool) string {
|
||||
}
|
||||
|
||||
func (f *TestFactory) NewBuilder() *resource.Builder {
|
||||
mapper, _ := f.Object()
|
||||
mapper := f.RESTMapper()
|
||||
|
||||
return resource.NewBuilder(
|
||||
&resource.Mapper{
|
||||
@@ -430,7 +430,7 @@ func (f *TestFactory) ClientSetForVersion(requiredVersion *schema.GroupVersion)
|
||||
return f.ClientSet()
|
||||
}
|
||||
|
||||
func (f *TestFactory) Object() (meta.RESTMapper, runtime.ObjectTyper) {
|
||||
func (f *TestFactory) RESTMapper() meta.RESTMapper {
|
||||
groupResources := testDynamicResources()
|
||||
mapper := discovery.NewRESTMapper(
|
||||
groupResources,
|
||||
@@ -457,10 +457,9 @@ func (f *TestFactory) Object() (meta.RESTMapper, runtime.ObjectTyper) {
|
||||
}
|
||||
|
||||
// TODO: should probably be the external scheme
|
||||
typer := discovery.NewUnstructuredObjectTyper(groupResources, legacyscheme.Scheme)
|
||||
fakeDs := &fakeCachedDiscoveryClient{}
|
||||
expander := cmdutil.NewShortcutExpander(mapper, fakeDs)
|
||||
return expander, typer
|
||||
return expander
|
||||
}
|
||||
|
||||
func (f *TestFactory) LogsForObject(object, options runtime.Object, timeout time.Duration) (*restclient.Request, error) {
|
||||
|
||||
Reference in New Issue
Block a user