Skip to content

Commit

Permalink
start tightening scheme usage in oc
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Jul 20, 2018
1 parent edb86bc commit 8d61367
Show file tree
Hide file tree
Showing 27 changed files with 662 additions and 778 deletions.
25 changes: 17 additions & 8 deletions cmd/oc/oc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ import (
"k8s.io/apiserver/pkg/util/logs"
"k8s.io/kubernetes/pkg/kubectl/scheme"

"github.com/openshift/api"
"github.com/openshift/api/authorization"
"github.com/openshift/api/quota"
"github.com/openshift/library-go/pkg/serviceability"
"github.com/openshift/origin/pkg/api/install"
"github.com/openshift/origin/pkg/api/legacy"
"github.com/openshift/origin/pkg/oc/cli"
"github.com/openshift/origin/pkg/version"

// install all APIs
apiinstall "github.com/openshift/origin/pkg/api/install"
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
_ "k8s.io/kubernetes/pkg/apis/batch/install"
_ "k8s.io/kubernetes/pkg/apis/core/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
"k8s.io/kubernetes/pkg/api/legacyscheme"
)

func main() {
Expand All @@ -33,7 +32,17 @@ func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
}

apiinstall.InstallAll(scheme.Scheme)
// the kubectl scheme expects to have all the recognizable external types it needs to consume. Install those here.
api.Install(scheme.Scheme)
legacy.InstallExternalLegacyAll(scheme.Scheme)
// TODO fix up the install for the "all types"
authorization.Install(scheme.Scheme)
quota.Install(scheme.Scheme)

// the legacyscheme is used in kubectl and expects to have the internal types registered. Explicitly wire our types here.
// this does
install.InstallInternalOpenShift(legacyscheme.Scheme)
legacy.InstallInternalLegacyAll(scheme.Scheme)

basename := filepath.Base(os.Args[0])
command := cli.CommandFor(basename)
Expand Down
2 changes: 1 addition & 1 deletion cmd/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func main() {
defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"), version.Get())()
defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop()

legacy.InstallLegacyInternalAll(legacyscheme.Scheme)
legacy.InstallInternalLegacyAll(legacyscheme.Scheme)

rand.Seed(time.Now().UTC().UnixNano())
if len(os.Getenv("GOMAXPROCS")) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
)

func init() {
legacy.InstallLegacyInternalAll(legacyscheme.Scheme)
legacy.InstallInternalLegacyAll(legacyscheme.Scheme)
}

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

0 comments on commit 8d61367

Please sign in to comment.