Skip to content

Commit 6ce7191

Browse files
committed
start tightening scheme usage in oc
1 parent edb86bc commit 6ce7191

27 files changed

+662
-778
lines changed

cmd/oc/oc.go

+17-8
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ import (
1010
"k8s.io/apiserver/pkg/util/logs"
1111
"k8s.io/kubernetes/pkg/kubectl/scheme"
1212

13+
"github.com/openshift/api"
14+
"github.com/openshift/api/authorization"
15+
"github.com/openshift/api/quota"
1316
"github.com/openshift/library-go/pkg/serviceability"
17+
"github.com/openshift/origin/pkg/api/install"
18+
"github.com/openshift/origin/pkg/api/legacy"
1419
"github.com/openshift/origin/pkg/oc/cli"
1520
"github.com/openshift/origin/pkg/version"
16-
17-
// install all APIs
18-
apiinstall "github.com/openshift/origin/pkg/api/install"
19-
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
20-
_ "k8s.io/kubernetes/pkg/apis/batch/install"
21-
_ "k8s.io/kubernetes/pkg/apis/core/install"
22-
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
21+
"k8s.io/kubernetes/pkg/api/legacyscheme"
2322
)
2423

2524
func main() {
@@ -33,7 +32,17 @@ func main() {
3332
runtime.GOMAXPROCS(runtime.NumCPU())
3433
}
3534

36-
apiinstall.InstallAll(scheme.Scheme)
35+
// the kubectl scheme expects to have all the recognizable external types it needs to consume. Install those here.
36+
api.Install(scheme.Scheme)
37+
legacy.InstallExternalLegacyAll(scheme.Scheme)
38+
// TODO fix up the install for the "all types"
39+
authorization.Install(scheme.Scheme)
40+
quota.Install(scheme.Scheme)
41+
42+
// the legacyscheme is used in kubectl and expects to have the internal types registered. Explicitly wire our types here.
43+
// this does
44+
install.InstallInternalOpenShift(legacyscheme.Scheme)
45+
legacy.InstallInternalLegacyAll(scheme.Scheme)
3746

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

cmd/openshift/openshift.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func main() {
2929
defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"), version.Get())()
3030
defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop()
3131

32-
legacy.InstallLegacyInternalAll(legacyscheme.Scheme)
32+
legacy.InstallInternalLegacyAll(legacyscheme.Scheme)
3333

3434
rand.Seed(time.Now().UTC().UnixNano())
3535
if len(os.Getenv("GOMAXPROCS")) == 0 {

examples/examples_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
func init() {
36-
legacy.InstallLegacyInternalAll(legacyscheme.Scheme)
36+
legacy.InstallInternalLegacyAll(legacyscheme.Scheme)
3737
}
3838

3939
func walkJSONFiles(inDir string, fn func(name, path string, data []byte)) error {

0 commit comments

Comments
 (0)