Skip to content

Commit e65306c

Browse files
juanvallejodeads2k
authored andcommitted
Add origin types to the kubectl scheme
1 parent 9d4b6a7 commit e65306c

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

cmd/oc/oc.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import (
88
"time"
99

1010
"k8s.io/apiserver/pkg/util/logs"
11+
"k8s.io/kubernetes/pkg/kubectl/scheme"
1112

1213
"github.com/openshift/origin/pkg/cmd/util/serviceability"
1314
"github.com/openshift/origin/pkg/oc/cli"
1415

1516
// install all APIs
16-
_ "github.com/openshift/origin/pkg/api/install"
17+
apiinstall "github.com/openshift/origin/pkg/api/install"
1718
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
1819
_ "k8s.io/kubernetes/pkg/apis/batch/install"
1920
_ "k8s.io/kubernetes/pkg/apis/core/install"
@@ -31,6 +32,8 @@ func main() {
3132
runtime.GOMAXPROCS(runtime.NumCPU())
3233
}
3334

35+
apiinstall.InstallAll(scheme.Scheme, scheme.GroupFactoryRegistry, scheme.Registry)
36+
3437
basename := filepath.Base(os.Args[0])
3538
command := cli.CommandFor(basename)
3639
if err := command.Execute(); err != nil {

pkg/api/install/install.go

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ package install
22

33
import (
44
kv1 "k8s.io/api/core/v1"
5+
"k8s.io/apimachinery/pkg/apimachinery/announced"
6+
"k8s.io/apimachinery/pkg/apimachinery/registered"
57
"k8s.io/apimachinery/pkg/conversion"
8+
"k8s.io/apimachinery/pkg/runtime"
69
"k8s.io/kubernetes/pkg/api/legacyscheme"
710
kapi "k8s.io/kubernetes/pkg/apis/core"
811
kapiv1 "k8s.io/kubernetes/pkg/apis/core/v1"
@@ -21,19 +24,20 @@ import (
2124
_ "k8s.io/kubernetes/pkg/apis/settings/install"
2225
_ "k8s.io/kubernetes/pkg/apis/storage/install"
2326

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"
2727
_ "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"
28+
29+
apps "github.com/openshift/origin/pkg/apps/apis/apps/install"
30+
authz "github.com/openshift/origin/pkg/authorization/apis/authorization/install"
31+
build "github.com/openshift/origin/pkg/build/apis/build/install"
32+
image "github.com/openshift/origin/pkg/image/apis/image/install"
33+
network "github.com/openshift/origin/pkg/network/apis/network/install"
34+
oauth "github.com/openshift/origin/pkg/oauth/apis/oauth/install"
35+
project "github.com/openshift/origin/pkg/project/apis/project/install"
36+
quota "github.com/openshift/origin/pkg/quota/apis/quota/install"
37+
route "github.com/openshift/origin/pkg/route/apis/route/install"
38+
security "github.com/openshift/origin/pkg/security/apis/security/install"
39+
template "github.com/openshift/origin/pkg/template/apis/template/install"
40+
user "github.com/openshift/origin/pkg/user/apis/user/install"
3741

3842
metainternal "k8s.io/apimachinery/pkg/apis/meta/internalversion"
3943
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -592,3 +596,19 @@ func init() {
592596
return false, nil
593597
})
594598
}
599+
600+
func InstallAll(scheme *runtime.Scheme, groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager) {
601+
// add Origin types to the given scheme
602+
apps.Install(groupFactoryRegistry, registry, scheme)
603+
authz.Install(groupFactoryRegistry, registry, scheme)
604+
build.Install(groupFactoryRegistry, registry, scheme)
605+
image.Install(groupFactoryRegistry, registry, scheme)
606+
network.Install(groupFactoryRegistry, registry, scheme)
607+
oauth.Install(groupFactoryRegistry, registry, scheme)
608+
project.Install(groupFactoryRegistry, registry, scheme)
609+
quota.Install(groupFactoryRegistry, registry, scheme)
610+
route.Install(groupFactoryRegistry, registry, scheme)
611+
security.Install(groupFactoryRegistry, registry, scheme)
612+
template.Install(groupFactoryRegistry, registry, scheme)
613+
user.Install(groupFactoryRegistry, registry, scheme)
614+
}

0 commit comments

Comments
 (0)