Skip to content

Commit

Permalink
Move other binaries out of openshift
Browse files Browse the repository at this point in the history
They will live in oc temporarily until they get their own binary.
  • Loading branch information
smarterclayton committed Jun 15, 2018
1 parent 10d8fc9 commit d0c7303
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 41 deletions.
2 changes: 2 additions & 0 deletions hack/import-restrictions.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,9 @@
"github.com/openshift/origin/pkg/cmd/flagtypes",
"github.com/openshift/origin/pkg/cmd/infra/builder",
"github.com/openshift/origin/pkg/cmd/infra/deployer",
"github.com/openshift/origin/pkg/cmd/infra/router",
"github.com/openshift/origin/pkg/cmd/openshift-operators/generated/clientset/versioned",
"github.com/openshift/origin/pkg/cmd/recycle",
"github.com/openshift/origin/pkg/cmd/server/admin",
"github.com/openshift/origin/pkg/cmd/server/apis/config",
"github.com/openshift/origin/pkg/cmd/server/apis/config/install",
Expand Down
8 changes: 5 additions & 3 deletions hack/lib/build/binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,11 @@ readonly -f os::build::release_sha
function os::build::make_openshift_binary_symlinks() {
platform=$(os::build::host_platform)
if [[ -f "${OS_OUTPUT_BINPATH}/${platform}/openshift" ]]; then
for linkname in "${OPENSHIFT_BINARY_SYMLINKS[@]}"; do
ln -sf openshift "${OS_OUTPUT_BINPATH}/${platform}/${linkname}"
done
if [[ -n "${OPENSHIFT_BINARY_SYMLINKS-}" ]]; then
for linkname in "${OPENSHIFT_BINARY_SYMLINKS[@]}"; do
ln -sf openshift "${OS_OUTPUT_BINPATH}/${platform}/${linkname}"
done
fi
fi
if [[ -f "${OS_OUTPUT_BINPATH}/${platform}/oc" ]]; then
for linkname in "${OC_BINARY_SYMLINKS[@]}"; do
Expand Down
10 changes: 5 additions & 5 deletions hack/lib/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ readonly OS_GOVET_BLACKLIST=(

#If you update this list, be sure to get the images/origin/Dockerfile
readonly OPENSHIFT_BINARY_SYMLINKS=(
openshift-router
openshift-recycle
)
readonly OC_BINARY_SYMLINKS=(
openshift-deploy
Expand All @@ -75,6 +73,8 @@ readonly OC_BINARY_SYMLINKS=(
openshift-git-clone
openshift-manage-dockerfile
openshift-extract-image-content
openshift-router
openshift-recycle
)
readonly OC_BINARY_COPY=(
kubectl
Expand Down Expand Up @@ -386,13 +386,13 @@ function os::build::images() {
( os::build::image "${tag_prefix}-control-plane" images/origin ) &
( os::build::image "${tag_prefix}-deployer" images/deployer ) &
( os::build::image "${tag_prefix}-docker-builder" images/builder/docker/docker-builder ) &
( os::build::image "${tag_prefix}-haproxy-router" images/router/haproxy ) &
( os::build::image "${tag_prefix}-recycler" images/recycler ) &
( os::build::image "${tag_prefix}-f5-router" images/router/f5 ) &

for i in `jobs -p`; do wait $i; done

# images that depend on "${tag_prefix}-control-plane"
( os::build::image "${tag_prefix}-haproxy-router" images/router/haproxy ) &
( os::build::image "${tag_prefix}-recycler" images/recycler ) &
( os::build::image "${tag_prefix}-f5-router" images/router/f5 ) &
( os::build::image "${tag_prefix}-node" images/node ) &

for i in `jobs -p`; do wait $i; done
Expand Down
2 changes: 1 addition & 1 deletion images/recycler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# The standard name for this image is openshift/origin-recycler
#
FROM openshift/origin-control-plane
FROM openshift/origin-cli

LABEL io.k8s.display-name="OpenShift Origin Volume Recycler" \
io.k8s.description="This is a component of OpenShift Origin and is used to prepare persistent volumes for reuse after they are deleted." \
Expand Down
2 changes: 1 addition & 1 deletion images/router/f5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# The standard name for this image is openshift/origin-f5-router
#
FROM openshift/origin-control-plane
FROM openshift/origin-cli

LABEL io.k8s.display-name="OpenShift Origin F5 Router" \
io.k8s.description="This is a component of OpenShift Origin and programs a BigIP F5 router to expose services within the cluster." \
Expand Down
2 changes: 1 addition & 1 deletion images/router/haproxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# The standard name for this image is openshift/origin-haproxy-router
#
FROM openshift/origin-control-plane
FROM openshift/origin-cli

RUN INSTALL_PKGS="haproxy18" && \
yum install -y $INSTALL_PKGS && \
Expand Down
2 changes: 1 addition & 1 deletion images/router/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# The standard name for this image is openshift/origin-nginx-router
#
FROM openshift/origin-control-plane
FROM openshift/origin-cli

ENV NGINX_VERSION 1.13.12-1.el7_4.ngx

Expand Down
17 changes: 6 additions & 11 deletions origin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,12 @@ for cmd in \
openshift-git-clone \
openshift-manage-dockerfile \
openshift-extract-image-content \
kubectl
do
ln -s oc %{buildroot}%{_bindir}/$cmd
done

for cmd in \
openshift-f5-router \
openshift-recycle \
openshift-router
openshift-router \
kubectl
do
ln -s openshift %{buildroot}%{_bindir}/$cmd
ln -s oc %{buildroot}%{_bindir}/$cmd
done

install -d -m 0755 %{buildroot}%{_sysconfdir}/origin/{master,node}
Expand Down Expand Up @@ -368,9 +363,6 @@ chmod 0744 $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
%doc README.md
%license LICENSE
%{_bindir}/openshift
%{_bindir}/openshift-f5-router
%{_bindir}/openshift-recycle
%{_bindir}/openshift-router
%{_sharedstatedir}/origin
%{_sysconfdir}/bash_completion.d/openshift
%defattr(-,root,root,0700)
Expand Down Expand Up @@ -424,6 +416,9 @@ chmod 0744 $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
%{_bindir}/openshift-git-clone
%{_bindir}/openshift-extract-image-content
%{_bindir}/openshift-manage-dockerfile
%{_bindir}/openshift-f5-router
%{_bindir}/openshift-recycle
%{_bindir}/openshift-router
%{_sysconfdir}/bash_completion.d/oc
%{_mandir}/man1/oc*

Expand Down
12 changes: 0 additions & 12 deletions pkg/cmd/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"

"github.com/openshift/origin/pkg/cmd/flagtypes"
irouter "github.com/openshift/origin/pkg/cmd/infra/router"
"github.com/openshift/origin/pkg/cmd/recycle"
"github.com/openshift/origin/pkg/cmd/server/start"
"github.com/openshift/origin/pkg/cmd/templates"
cmdutil "github.com/openshift/origin/pkg/cmd/util"
Expand All @@ -40,23 +38,13 @@ var (
func CommandFor(basename string, stopCh <-chan struct{}) *cobra.Command {
var cmd *cobra.Command

out := os.Stdout

// Make case-insensitive and strip executable suffix if present
if runtime.GOOS == "windows" {
basename = strings.ToLower(basename)
basename = strings.TrimSuffix(basename, ".exe")
}

switch basename {
case "openshift-router":
cmd = irouter.NewCommandTemplateRouter(basename)
case "openshift-f5-router":
cmd = irouter.NewCommandF5Router(basename)
case "openshift-recycle":
cmd = recycle.NewCommandRecycle(basename, out)
case "origin":
cmd = NewCommandOpenShift(basename, stopCh)
default:
cmd = NewCommandOpenShift("openshift", stopCh)
}
Expand Down
7 changes: 1 addition & 6 deletions pkg/cmd/openshift/openshift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ import (
)

func TestCommandFor(t *testing.T) {
cmd := CommandFor("openshift-router", wait.NeverStop)
if cmd.Use != "openshift-router" {
t.Errorf("expected command to start with prefix: %#v", cmd)
}

cmd = CommandFor("unknown", wait.NeverStop)
cmd := CommandFor("unknown", wait.NeverStop)
if cmd.Use != "openshift" {
t.Errorf("expected command to be openshift: %#v", cmd)
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/oc/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/openshift/origin/pkg/cmd/flagtypes"
"github.com/openshift/origin/pkg/cmd/infra/builder"
"github.com/openshift/origin/pkg/cmd/infra/deployer"
irouter "github.com/openshift/origin/pkg/cmd/infra/router"
"github.com/openshift/origin/pkg/cmd/recycle"
"github.com/openshift/origin/pkg/cmd/templates"
"github.com/openshift/origin/pkg/cmd/util/term"
"github.com/openshift/origin/pkg/oc/admin"
Expand Down Expand Up @@ -330,6 +332,12 @@ func CommandFor(basename string) *cobra.Command {
cmd = builder.NewCommandManageDockerfile(basename)
case "openshift-extract-image-content":
cmd = builder.NewCommandExtractImageContent(basename)
case "openshift-router":
cmd = irouter.NewCommandTemplateRouter(basename)
case "openshift-f5-router":
cmd = irouter.NewCommandF5Router(basename)
case "openshift-recycle":
cmd = recycle.NewCommandRecycle(basename, out)
default:
// we only need this change for `oc`. `kubectl` should behave as close to `kubectl` as we can
resource.OAPIToGroupified = legacygroupification.OAPIToGroupified
Expand Down

0 comments on commit d0c7303

Please sign in to comment.