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

Move deployer and build binaries into oc #20011

Merged
merged 2 commits into from
Jun 16, 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
4 changes: 4 additions & 0 deletions hack/import-restrictions.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,11 @@
"github.com/openshift/origin/pkg/bulk",
"github.com/openshift/origin/pkg/client/config",
"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
11 changes: 8 additions & 3 deletions hack/lib/build/binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,16 @@ 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
ln -sf oc "${OS_OUTPUT_BINPATH}/${platform}/${linkname}"
done
for linkname in "${OC_BINARY_COPY[@]}"; do
ln -sf oc "${OS_OUTPUT_BINPATH}/${platform}/${linkname}"
done
Expand Down
23 changes: 12 additions & 11 deletions hack/lib/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ readonly OS_GOVET_BLACKLIST=(

#If you update this list, be sure to get the images/origin/Dockerfile
readonly OPENSHIFT_BINARY_SYMLINKS=(
openshift-router
)
readonly OC_BINARY_SYMLINKS=(
openshift-deploy
openshift-recycle
openshift-sti-build
openshift-docker-build
openshift-git-clone
openshift-manage-dockerfile
openshift-extract-image-content
origin
openshift-router
openshift-recycle
)
readonly OC_BINARY_COPY=(
kubectl
Expand Down Expand Up @@ -381,18 +382,18 @@ function os::build::images() {
for i in `jobs -p`; do wait $i; done

# images that depend on "${tag_prefix}-cli"
( os::build::image "${tag_prefix}-tests" images/tests ) &
( os::build::image "${tag_prefix}-control-plane" images/origin ) &
( os::build::image "${tag_prefix}-tests" images/tests ) &
( 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}-deployer" images/deployer ) &
( os::build::image "${tag_prefix}-recycler" images/recycler ) &
( os::build::image "${tag_prefix}-docker-builder" images/builder/docker/docker-builder ) &
( os::build::image "${tag_prefix}-f5-router" images/router/f5 ) &
( os::build::image "${tag_prefix}-node" images/node ) &
( 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/builder/docker/docker-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# The standard name for this image is openshift/origin-docker-builder
#
FROM openshift/origin-control-plane
FROM openshift/origin-cli

RUN INSTALL_PKGS=" \
which tar wget hostname sysvinit-tools util-linux \
Expand Down
2 changes: 1 addition & 1 deletion images/deployer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# The standard name for this image is openshift/origin-deployer
#
FROM openshift/origin-control-plane
FROM openshift/origin-cli

LABEL io.k8s.display-name="OpenShift Origin Deployer" \
io.k8s.description="This is a component of OpenShift Origin and executes the user deployment process to roll out new containers. It may be used as a base image for building your own custom deployer image." \
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
25 changes: 12 additions & 13 deletions origin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,12 @@ for cmd in \
openshift-extract-image-content \
openshift-f5-router \
openshift-recycle \
openshift-router
openshift-router \
kubectl
do
ln -s openshift %{buildroot}%{_bindir}/$cmd
ln -s oc %{buildroot}%{_bindir}/$cmd
done

ln -s oc %{buildroot}%{_bindir}/kubectl

install -d -m 0755 %{buildroot}%{_sysconfdir}/origin/{master,node}

# different service for origin vs aos
Expand Down Expand Up @@ -364,15 +363,6 @@ chmod 0744 $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
%doc README.md
%license LICENSE
%{_bindir}/openshift
%{_bindir}/openshift-deploy
%{_bindir}/openshift-f5-router
%{_bindir}/openshift-recycle
%{_bindir}/openshift-router
%{_bindir}/openshift-docker-build
%{_bindir}/openshift-sti-build
%{_bindir}/openshift-git-clone
%{_bindir}/openshift-extract-image-content
%{_bindir}/openshift-manage-dockerfile
%{_sharedstatedir}/origin
%{_sysconfdir}/bash_completion.d/openshift
%defattr(-,root,root,0700)
Expand Down Expand Up @@ -420,6 +410,15 @@ chmod 0744 $RPM_BUILD_ROOT/usr/sbin/%{name}-docker-excluder
%{_bindir}/oc
%{_bindir}/kubectl
%{_bindir}/oadm
%{_bindir}/openshift-deploy
%{_bindir}/openshift-docker-build
%{_bindir}/openshift-sti-build
%{_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
26 changes: 0 additions & 26 deletions pkg/cmd/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import (
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"

"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/server/start"
"github.com/openshift/origin/pkg/cmd/templates"
cmdutil "github.com/openshift/origin/pkg/cmd/util"
Expand All @@ -42,35 +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-deploy":
cmd = deployer.NewCommandDeployer(basename)
case "openshift-recycle":
cmd = recycle.NewCommandRecycle(basename, out)
case "openshift-sti-build":
cmd = builder.NewCommandS2IBuilder(basename)
case "openshift-docker-build":
cmd = builder.NewCommandDockerBuilder(basename)
case "openshift-git-clone":
cmd = builder.NewCommandGitClone(basename)
case "openshift-manage-dockerfile":
cmd = builder.NewCommandManageDockerfile(basename)
case "openshift-extract-image-content":
cmd = builder.NewCommandExtractImageContent(basename)
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
22 changes: 22 additions & 0 deletions pkg/oc/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import (
"k8s.io/kubernetes/pkg/kubectl/resource"

"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 @@ -316,6 +320,24 @@ func CommandFor(basename string) *cobra.Command {
switch basename {
case "kubectl":
cmd = kubecmd.NewKubectlCommand(kcmdutil.NewFactory(nil), in, out, errout)
case "openshift-deploy":
cmd = deployer.NewCommandDeployer(basename)
case "openshift-sti-build":
cmd = builder.NewCommandS2IBuilder(basename)
case "openshift-docker-build":
cmd = builder.NewCommandDockerBuilder(basename)
case "openshift-git-clone":
cmd = builder.NewCommandGitClone(basename)
case "openshift-manage-dockerfile":
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