Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start tightening scheme usage in oc #20385

Merged
merged 6 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1MB ? :-))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1MB ? :-))

Yeah, we were missing an api group.

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