@@ -11,7 +11,6 @@ import (
11
11
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12
12
"k8s.io/apimachinery/pkg/labels"
13
13
"k8s.io/apimachinery/pkg/runtime"
14
- "k8s.io/client-go/dynamic"
15
14
restclient "k8s.io/client-go/rest"
16
15
kapi "k8s.io/kubernetes/pkg/apis/core"
17
16
"k8s.io/kubernetes/pkg/controller"
@@ -33,18 +32,17 @@ import (
33
32
buildmanualclient "github.com/openshift/origin/pkg/build/client/internalversion"
34
33
buildclientinternal "github.com/openshift/origin/pkg/build/generated/internalclientset"
35
34
buildutil "github.com/openshift/origin/pkg/build/util"
36
- configcmd "github.com/openshift/origin/pkg/bulk"
37
35
imageapi "github.com/openshift/origin/pkg/image/apis/image"
38
36
deploymentcmd "github.com/openshift/origin/pkg/oc/cli/deploymentconfigs"
39
37
"github.com/openshift/origin/pkg/oc/cli/describe"
40
38
)
41
39
42
40
type ring1Factory struct {
43
- clientAccessFactory ClientAccessFactory
41
+ clientAccessFactory kcmdutil. ClientAccessFactory
44
42
kubeObjectMappingFactory kcmdutil.ObjectMappingFactory
45
43
}
46
44
47
- func NewObjectMappingFactory (clientAccessFactory ClientAccessFactory ) kcmdutil.ObjectMappingFactory {
45
+ func NewObjectMappingFactory (clientAccessFactory kcmdutil. ClientAccessFactory ) kcmdutil.ObjectMappingFactory {
48
46
return & ring1Factory {
49
47
clientAccessFactory : clientAccessFactory ,
50
48
kubeObjectMappingFactory : kcmdutil .NewObjectMappingFactory (clientAccessFactory ),
@@ -60,45 +58,10 @@ func (f *ring1Factory) CategoryExpander() categories.CategoryExpander {
60
58
}
61
59
62
60
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
- }
80
61
return f .kubeObjectMappingFactory .ClientForMapping (mapping )
81
62
}
82
63
83
64
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
- }
102
65
return f .kubeObjectMappingFactory .UnstructuredClientForMapping (mapping )
103
66
}
104
67
@@ -123,6 +86,7 @@ func (f *ring1Factory) Describer(mapping *meta.RESTMapping) (kprinters.Describer
123
86
}
124
87
return describer , nil
125
88
}
89
+
126
90
return f .kubeObjectMappingFactory .Describer (mapping )
127
91
}
128
92
0 commit comments