Skip to content

Commit

Permalink
Remove openshift start node
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Aug 14, 2018
1 parent e2fd943 commit 564ee03
Show file tree
Hide file tree
Showing 13 changed files with 286 additions and 1,368 deletions.
11 changes: 5 additions & 6 deletions pkg/cmd/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

"k8s.io/apimachinery/pkg/util/wait"
kcmd "k8s.io/kubernetes/pkg/kubectl/cmd"
ktemplates "k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
Expand All @@ -27,10 +28,7 @@ var (
openshiftLong = ktemplates.LongDesc(`
%[2]s
The %[3]s helps you build, deploy, and manage your applications on top of
Docker containers. To start an all-in-one server with the default configuration, run:
$ %[1]s start &`)
The %[3]s helps you build, deploy, and manage containerized applications.`)
)

// CommandFor returns the appropriate command for this base name,
Expand Down Expand Up @@ -68,8 +66,8 @@ func NewCommandOpenShift(name string) *cobra.Command {
Run: kcmdutil.DefaultSubCommandRun(out),
}

startAllInOne, _ := start.NewCommandStartAllInOne(name, out, errout)
root.AddCommand(startAllInOne)
root.AddCommand(start.NewCommandStart(name, out, errout, wait.NeverStop))

root.AddCommand(newCompletionCommand("completion", name+" completion"))
root.AddCommand(cmdversion.NewCmdVersion(name, osversion.Get(), os.Stdout))
root.AddCommand(newCmdOptions())
Expand Down Expand Up @@ -125,6 +123,7 @@ var (
* zsh completions are only supported in versions of zsh >= 5.2`)
)

// NewCmdCompletion creates a completion command.
func NewCmdCompletion(fullName string, out io.Writer) *cobra.Command {
cmdHelpName := fullName

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/server/kubernetes/node/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package node
78 changes: 0 additions & 78 deletions pkg/cmd/server/kubernetes/node/node.go

This file was deleted.

171 changes: 0 additions & 171 deletions pkg/cmd/server/start/bootstrap_node.go

This file was deleted.

51 changes: 0 additions & 51 deletions pkg/cmd/server/start/command_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package start

import (
"errors"
"fmt"
"io/ioutil"
"os"
"path"
Expand All @@ -14,9 +12,6 @@ import (

"github.com/spf13/cobra"

configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
configapilatest "github.com/openshift/origin/pkg/cmd/server/apis/config/latest"

// install all APIs
_ "github.com/openshift/origin/pkg/api/install"
_ "k8s.io/kubernetes/pkg/apis/core/install"
Expand Down Expand Up @@ -205,49 +200,3 @@ func executeMasterCommand(args []string) *MasterArgs {

return cfg.MasterArgs
}

func executeAllInOneCommand(args []string) (*MasterArgs, *NodeArgs) {
masterArgs, _, _, nodeArgs, _, _ := executeAllInOneCommandWithConfigs(args)
return masterArgs, nodeArgs
}

func executeAllInOneCommandWithConfigs(args []string) (*MasterArgs, *configapi.MasterConfig, error, *NodeArgs, *configapi.NodeConfig, error) {
argsToUse := make([]string, 0, 4+len(args))
argsToUse = append(argsToUse, "start")
argsToUse = append(argsToUse, args...)
argsToUse = append(argsToUse, "--write-config="+getCleanAllInOneConfigDir())
argsToUse = append(argsToUse, "--create-certs=false")

root := &cobra.Command{
Use: "openshift",
Short: "test",
Long: "",
Run: func(c *cobra.Command, args []string) {
c.Help()
},
}

openshiftStartCommand, cfg := NewCommandStartAllInOne("openshift start", os.Stdout, os.Stderr)
root.AddCommand(openshiftStartCommand)
root.SetArgs(argsToUse)
root.Execute()

masterCfg, masterErr := configapilatest.ReadAndResolveMasterConfig(path.Join(getAllInOneConfigDir(), "master", "master-config.yaml"))

var nodeCfg *configapi.NodeConfig
var nodeErr error

nodeConfigs, nodeErr := filepath.Glob(getNodeConfigGlob())
if nodeErr == nil {
if len(nodeConfigs) != 1 {
nodeErr = fmt.Errorf("found wrong number of node configs: %v", nodeConfigs)
} else {
nodeCfg, nodeErr = configapilatest.ReadAndResolveNodeConfig(nodeConfigs[0])
}
}

if nodeCfg == nil && nodeErr == nil {
nodeErr = errors.New("did not find node config")
}
return cfg.MasterOptions.MasterArgs, masterCfg, masterErr, cfg.NodeArgs, nodeCfg, nodeErr
}
16 changes: 0 additions & 16 deletions pkg/cmd/server/start/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,6 @@ func TestKubeClientForExternalKubernetesMasterWithConfig(t *testing.T) {
}
}

func TestKubeClientForNodeWithConfig(t *testing.T) {
expectedServer := "https://some-other-server:1234"
expectedUser := "myuser"

nodeArgs := NewDefaultNodeArgs()
nodeArgs.KubeConnectionArgs.ClientConfigLoadingRules, nodeArgs.KubeConnectionArgs.ClientConfig = makeKubeconfig(expectedServer, expectedUser)

actual, err := nodeArgs.KubeConnectionArgs.GetKubernetesAddress(nil)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if expectedServer != actual.String() {
t.Fatalf("expected %v, got %v", expectedServer, actual)
}
}

func TestKubeClientForExternalKubernetesMasterWithErrorKubeconfig(t *testing.T) {
masterArgs := NewDefaultMasterArgs()
masterArgs.KubeConnectionArgs.ClientConfigLoadingRules, masterArgs.KubeConnectionArgs.ClientConfig = makeErrorKubeconfig()
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/server/start/master_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func NewDefaultMasterArgs() *MasterArgs {
ListenArg: NewDefaultListenArg(),
ImageFormatArgs: NewDefaultImageFormatArgs(),
KubeConnectionArgs: NewDefaultKubeConnectionArgs(),
NetworkArgs: NewDefaultNetworkArgs(),
NetworkArgs: NewDefaultMasterNetworkArgs(),
}

return config
Expand Down
Loading

0 comments on commit 564ee03

Please sign in to comment.