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 23, 2018
1 parent 79cfa01 commit 527aac0
Show file tree
Hide file tree
Showing 28 changed files with 665 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 527aac0

Please sign in to comment.