Skip to content

Commit

Permalink
Merge pull request #20385 from deads2k/oc-04-scheme
Browse files Browse the repository at this point in the history
 start tightening scheme usage in oc
  • Loading branch information
openshift-merge-robot authored Jul 24, 2018
2 parents 3d40ec5 + 9878647 commit 9b64d4d
Show file tree
Hide file tree
Showing 46 changed files with 789 additions and 852 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
5 changes: 3 additions & 2 deletions hack/lib/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ function os::build::check_binaries() {
# enforce that certain binaries don't accidentally grow too large
# IMPORTANT: contact Clayton or another master team member before altering this code
if [[ -f "${OS_OUTPUT_BINPATH}/${platform}/oc" ]]; then
if [[ "$(du -m "${OS_OUTPUT_BINPATH}/${platform}/oc" | cut -f 1)" -gt "115" ]]; then
os::log::fatal "oc binary has grown substantially. You must have approval before bumping this limit."
ocsize=$(du -m "${OS_OUTPUT_BINPATH}/${platform}/oc" | cut -f 1)
if [[ "${ocsize}" -gt "116" ]]; then
os::log::fatal "oc binary has grown substantially to ${ocsize}. You must have approval before bumping this limit."
fi
fi
if [[ -f "${OS_OUTPUT_BINPATH}/${platform}/openshift-node-config" ]]; then
Expand Down
14 changes: 5 additions & 9 deletions hack/lib/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,11 @@ function os::start::internal::openshift_executable() {

openshift_executable="${sudo} docker run ${docker_options} ${volumes} ${envvars} openshift/origin:${version}"
else
local envvars=""
if [[ -n "${ENV:-}" ]]; then
envvars="env "
for envvar in "${ENV[@]}"; do
envvars+="${envvar} "
done
fi

openshift_executable="${sudo} ${envvars} $(which openshift)"
if [[ -n "${sudo}" ]]; then
openshift_executable="${sudo} -E $(which openshift)"
else
openshift_executable="$(which openshift)"
fi
fi

echo "${openshift_executable}"
Expand Down
Loading

0 comments on commit 9b64d4d

Please sign in to comment.