Skip to content

Commit 6b85582

Browse files
committed
remove last traces of oapi
1 parent 0e768b6 commit 6b85582

File tree

2 files changed

+5
-41
lines changed

2 files changed

+5
-41
lines changed

pkg/oc/cli/util/clientcmd/factory_builder.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ import (
2525
)
2626

2727
type ring2Factory struct {
28-
clientAccessFactory ClientAccessFactory
28+
clientAccessFactory kcmdutil.ClientAccessFactory
2929
objectMappingFactory kcmdutil.ObjectMappingFactory
3030
kubeBuilderFactory kcmdutil.BuilderFactory
3131
}
3232

33-
func NewBuilderFactory(clientAccessFactory ClientAccessFactory, objectMappingFactory kcmdutil.ObjectMappingFactory) kcmdutil.BuilderFactory {
33+
func NewBuilderFactory(clientAccessFactory kcmdutil.ClientAccessFactory, objectMappingFactory kcmdutil.ObjectMappingFactory) kcmdutil.BuilderFactory {
3434
return &ring2Factory{
3535
clientAccessFactory: clientAccessFactory,
3636
objectMappingFactory: objectMappingFactory,

pkg/oc/cli/util/clientcmd/factory_object_mapping.go

+3-39
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1212
"k8s.io/apimachinery/pkg/labels"
1313
"k8s.io/apimachinery/pkg/runtime"
14-
"k8s.io/client-go/dynamic"
1514
restclient "k8s.io/client-go/rest"
1615
kapi "k8s.io/kubernetes/pkg/apis/core"
1716
"k8s.io/kubernetes/pkg/controller"
@@ -33,18 +32,17 @@ import (
3332
buildmanualclient "github.com/openshift/origin/pkg/build/client/internalversion"
3433
buildclientinternal "github.com/openshift/origin/pkg/build/generated/internalclientset"
3534
buildutil "github.com/openshift/origin/pkg/build/util"
36-
configcmd "github.com/openshift/origin/pkg/bulk"
3735
imageapi "github.com/openshift/origin/pkg/image/apis/image"
3836
deploymentcmd "github.com/openshift/origin/pkg/oc/cli/deploymentconfigs"
3937
"github.com/openshift/origin/pkg/oc/cli/describe"
4038
)
4139

4240
type ring1Factory struct {
43-
clientAccessFactory ClientAccessFactory
41+
clientAccessFactory kcmdutil.ClientAccessFactory
4442
kubeObjectMappingFactory kcmdutil.ObjectMappingFactory
4543
}
4644

47-
func NewObjectMappingFactory(clientAccessFactory ClientAccessFactory) kcmdutil.ObjectMappingFactory {
45+
func NewObjectMappingFactory(clientAccessFactory kcmdutil.ClientAccessFactory) kcmdutil.ObjectMappingFactory {
4846
return &ring1Factory{
4947
clientAccessFactory: clientAccessFactory,
5048
kubeObjectMappingFactory: kcmdutil.NewObjectMappingFactory(clientAccessFactory),
@@ -60,45 +58,10 @@ func (f *ring1Factory) CategoryExpander() categories.CategoryExpander {
6058
}
6159

6260
func (f *ring1Factory) ClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error) {
63-
// TODO only do this for legacy kinds
64-
if latest.OriginKind(mapping.GroupVersionKind) {
65-
cfg, err := f.clientAccessFactory.ClientConfig()
66-
if err != nil {
67-
return nil, err
68-
}
69-
if err := configcmd.SetLegacyOpenShiftDefaults(cfg); err != nil {
70-
return nil, err
71-
}
72-
cfg.APIPath = "/apis"
73-
if mapping.GroupVersionKind.Group == kapi.GroupName {
74-
cfg.APIPath = "/oapi"
75-
}
76-
gv := mapping.GroupVersionKind.GroupVersion()
77-
cfg.GroupVersion = &gv
78-
return restclient.RESTClientFor(cfg)
79-
}
8061
return f.kubeObjectMappingFactory.ClientForMapping(mapping)
8162
}
8263

8364
func (f *ring1Factory) UnstructuredClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error) {
84-
// TODO only do this for legacy kinds
85-
if latest.OriginKind(mapping.GroupVersionKind) {
86-
cfg, err := f.clientAccessFactory.ClientConfig()
87-
if err != nil {
88-
return nil, err
89-
}
90-
if err := configcmd.SetLegacyOpenShiftDefaults(cfg); err != nil {
91-
return nil, err
92-
}
93-
cfg.APIPath = "/apis"
94-
if mapping.GroupVersionKind.Group == kapi.GroupName {
95-
cfg.APIPath = "/oapi"
96-
}
97-
gv := mapping.GroupVersionKind.GroupVersion()
98-
cfg.ContentConfig = dynamic.ContentConfig()
99-
cfg.GroupVersion = &gv
100-
return restclient.RESTClientFor(cfg)
101-
}
10265
return f.kubeObjectMappingFactory.UnstructuredClientForMapping(mapping)
10366
}
10467

@@ -123,6 +86,7 @@ func (f *ring1Factory) Describer(mapping *meta.RESTMapping) (kprinters.Describer
12386
}
12487
return describer, nil
12588
}
89+
12690
return f.kubeObjectMappingFactory.Describer(mapping)
12791
}
12892

0 commit comments

Comments
 (0)