Skip to content

Commit dbdb9bb

Browse files
committed
add InstallAll method pkg/api
1 parent f6d3d26 commit dbdb9bb

File tree

2 files changed

+32
-41
lines changed

2 files changed

+32
-41
lines changed

cmd/oc/oc.go

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,8 @@ import (
1212
"github.com/openshift/origin/pkg/cmd/util/serviceability"
1313
"github.com/openshift/origin/pkg/oc/cli"
1414

15-
"k8s.io/kubernetes/pkg/kubectl/scheme"
16-
17-
apps "github.com/openshift/origin/pkg/apps/apis/apps/install"
18-
authz "github.com/openshift/origin/pkg/authorization/apis/authorization/install"
19-
build "github.com/openshift/origin/pkg/build/apis/build/install"
20-
image "github.com/openshift/origin/pkg/image/apis/image/install"
21-
network "github.com/openshift/origin/pkg/network/apis/network/install"
22-
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth/install"
23-
project "github.com/openshift/origin/pkg/project/apis/project/install"
24-
quota "github.com/openshift/origin/pkg/quota/apis/quota/install"
25-
route "github.com/openshift/origin/pkg/route/apis/route/install"
26-
security "github.com/openshift/origin/pkg/security/apis/security/install"
27-
template "github.com/openshift/origin/pkg/template/apis/template/install"
28-
user "github.com/openshift/origin/pkg/user/apis/user/install"
29-
3015
// install all APIs
31-
_ "github.com/openshift/origin/pkg/api/install"
16+
api "github.com/openshift/origin/pkg/api/install"
3217
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
3318
_ "k8s.io/kubernetes/pkg/apis/batch/install"
3419
_ "k8s.io/kubernetes/pkg/apis/core/install"
@@ -46,19 +31,7 @@ func main() {
4631
runtime.GOMAXPROCS(runtime.NumCPU())
4732
}
4833

49-
// add Origin types to the kubectl scheme
50-
apps.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
51-
authz.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
52-
build.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
53-
image.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
54-
network.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
55-
oauth.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
56-
project.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
57-
quota.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
58-
route.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
59-
security.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
60-
template.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
61-
user.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
34+
api.InstallAll()
6235

6336
basename := filepath.Base(os.Args[0])
6437
command := cli.CommandFor(basename)

pkg/api/install/install.go

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"k8s.io/kubernetes/pkg/api/legacyscheme"
77
kapi "k8s.io/kubernetes/pkg/apis/core"
88
kapiv1 "k8s.io/kubernetes/pkg/apis/core/v1"
9+
"k8s.io/kubernetes/pkg/kubectl/scheme"
910

1011
// we have a strong dependency on kube objects for deployments and scale
1112
_ "k8s.io/kubernetes/pkg/apis/apps/install"
@@ -21,19 +22,20 @@ import (
2122
_ "k8s.io/kubernetes/pkg/apis/settings/install"
2223
_ "k8s.io/kubernetes/pkg/apis/storage/install"
2324

24-
_ "github.com/openshift/origin/pkg/apps/apis/apps/install"
25-
_ "github.com/openshift/origin/pkg/authorization/apis/authorization/install"
26-
_ "github.com/openshift/origin/pkg/build/apis/build/install"
2725
_ "github.com/openshift/origin/pkg/cmd/server/api/install"
28-
_ "github.com/openshift/origin/pkg/image/apis/image/install"
29-
_ "github.com/openshift/origin/pkg/network/apis/network/install"
30-
_ "github.com/openshift/origin/pkg/oauth/apis/oauth/install"
31-
_ "github.com/openshift/origin/pkg/project/apis/project/install"
32-
_ "github.com/openshift/origin/pkg/quota/apis/quota/install"
33-
_ "github.com/openshift/origin/pkg/route/apis/route/install"
34-
_ "github.com/openshift/origin/pkg/security/apis/security/install"
35-
_ "github.com/openshift/origin/pkg/template/apis/template/install"
36-
_ "github.com/openshift/origin/pkg/user/apis/user/install"
26+
27+
apps "github.com/openshift/origin/pkg/apps/apis/apps/install"
28+
authz "github.com/openshift/origin/pkg/authorization/apis/authorization/install"
29+
build "github.com/openshift/origin/pkg/build/apis/build/install"
30+
image "github.com/openshift/origin/pkg/image/apis/image/install"
31+
network "github.com/openshift/origin/pkg/network/apis/network/install"
32+
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth/install"
33+
project "github.com/openshift/origin/pkg/project/apis/project/install"
34+
quota "github.com/openshift/origin/pkg/quota/apis/quota/install"
35+
route "github.com/openshift/origin/pkg/route/apis/route/install"
36+
security "github.com/openshift/origin/pkg/security/apis/security/install"
37+
template "github.com/openshift/origin/pkg/template/apis/template/install"
38+
user "github.com/openshift/origin/pkg/user/apis/user/install"
3739

3840
metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion"
3941
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -592,3 +594,19 @@ func init() {
592594
return false, nil
593595
})
594596
}
597+
598+
func InstallAll() {
599+
// add Origin types to the kubectl scheme
600+
apps.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
601+
authz.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
602+
build.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
603+
image.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
604+
network.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
605+
oauth.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
606+
project.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
607+
quota.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
608+
route.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
609+
security.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
610+
template.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
611+
user.Install(scheme.GroupFactoryRegistry, scheme.Registry, scheme.Scheme)
612+
}

0 commit comments

Comments
 (0)