Skip to content

Commit

Permalink
remove openshift infra command
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Nov 28, 2017
1 parent fe4f498 commit 28f8685
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 19 deletions.
46 changes: 46 additions & 0 deletions cmd/openshift-diagnostics/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package main

import (
"math/rand"
"os"
"runtime"
"time"

"k8s.io/apiserver/pkg/util/logs"

"github.com/openshift/origin/pkg/cmd/util/serviceability"
"github.com/openshift/origin/pkg/oc/admin/diagnostics"
"github.com/spf13/cobra"

// install all APIs
_ "github.com/openshift/origin/pkg/api/install"
_ "k8s.io/kubernetes/pkg/api/install"
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
_ "k8s.io/kubernetes/pkg/apis/batch/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
)

func main() {
logs.InitLogs()
defer logs.FlushLogs()
defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"))()
defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop()

rand.Seed(time.Now().UTC().UnixNano())
if len(os.Getenv("GOMAXPROCS")) == 0 {
runtime.GOMAXPROCS(runtime.NumCPU())
}

cmd := &cobra.Command{
Use: "openshift-diagnostics",
Short: "Diagnose OpenShift clusters",
}
cmd.AddCommand(
diagnostics.NewCommandPodDiagnostics("diagnostic-pod", os.Stdout),
diagnostics.NewCommandNetworkPodDiagnostics("network-diagnostic-pod", os.Stdout),
)

if err := cmd.Execute(); err != nil {
os.Exit(1)
}
}
1 change: 1 addition & 0 deletions hack/lib/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ readonly OS_CROSS_COMPILE_TARGETS=(
cmd/openshift
cmd/oc
cmd/kubefed
cmd/openshift-diagnostics
cmd/template-service-broker
vendor/k8s.io/kubernetes/cmd/hyperkube
)
Expand Down
19 changes: 0 additions & 19 deletions pkg/cmd/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,6 @@ func NewCommandOpenShift(name string) *cobra.Command {
root.AddCommand(newExperimentalCommand("ex", name+" ex"))
root.AddCommand(newCompletionCommand("completion", name+" completion"))
root.AddCommand(cmd.NewCmdVersion(name, f, out, cmd.VersionOptions{PrintEtcdVersion: true, IsServer: true}))

// infra commands are those that are bundled with the binary but not displayed to end users
// directly
infra := &cobra.Command{
Use: "infra", // Because this command exposes no description, it will not be shown in help
}

infra.AddCommand(
irouter.NewCommandTemplateRouter("router"),
irouter.NewCommandF5Router("f5-router"),
deployer.NewCommandDeployer("deploy"),
recycle.NewCommandRecycle("recycle", out),
builder.NewCommandS2IBuilder("sti-build"),
builder.NewCommandDockerBuilder("docker-build"),
diagnostics.NewCommandPodDiagnostics("diagnostic-pod", out),
diagnostics.NewCommandNetworkPodDiagnostics("network-diagnostic-pod", out),
)
root.AddCommand(infra)

root.AddCommand(cmd.NewCmdOptions(out))

// TODO: add groups
Expand Down

0 comments on commit 28f8685

Please sign in to comment.