From 084c0da59a0c098a8ffe475a19db19c9bc0e2883 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Thu, 24 Mar 2016 14:21:45 -0600 Subject: [PATCH] feat(cli): move 'helm dm' to 'helm server' --- cmd/helm/{dm.go => server.go} | 39 +++++++++++++++++++++++++---------- cmd/helm/target.go | 37 --------------------------------- 2 files changed, 28 insertions(+), 48 deletions(-) rename cmd/helm/{dm.go => server.go} (80%) delete mode 100644 cmd/helm/target.go diff --git a/cmd/helm/dm.go b/cmd/helm/server.go similarity index 80% rename from cmd/helm/dm.go rename to cmd/helm/server.go index 9b5d8065c..df794f178 100644 --- a/cmd/helm/dm.go +++ b/cmd/helm/server.go @@ -18,6 +18,7 @@ package main import ( "errors" + "fmt" "os" "github.com/codegangsta/cli" @@ -26,7 +27,7 @@ import ( "github.com/kubernetes/helm/pkg/kubectl" ) -// ErrAlreadyInstalled indicates that DM is already installed. +// ErrAlreadyInstalled indicates that Helm Server is already installed. var ErrAlreadyInstalled = errors.New("Already Installed") func init() { @@ -35,14 +36,17 @@ func init() { func dmCmd() cli.Command { return cli.Command{ - Name: "dm", - Usage: "Manage DM on Kubernetes", + Name: "server", + Usage: "Manage Helm server-side components", Subcommands: []cli.Command{ { - Name: "install", - Usage: "Install DM on Kubernetes.", - ArgsUsage: "", - Description: ``, + Name: "install", + Usage: "Install Helm server components on Kubernetes.", + ArgsUsage: "", + Description: `Use kubectl to install Helm components in their own namespace on Kubernetes. + + Make sure your Kubernetes environment is pointed to the cluster on which you + wish to install.`, Flags: []cli.Flag{ cli.BoolFlag{ Name: "dry-run", @@ -77,13 +81,13 @@ func dmCmd() cli.Command { }, { Name: "uninstall", - Usage: "Uninstall the DM from Kubernetes.", + Usage: "Uninstall the Helm server-side from Kubernetes.", ArgsUsage: "", Description: ``, Flags: []cli.Flag{ cli.BoolFlag{ Name: "dry-run", - Usage: "Show what would be installed, but don't install anything.", + Usage: "Show what would be uninstalled, but don't remove anything.", }, }, Action: func(c *cli.Context) { @@ -95,7 +99,7 @@ func dmCmd() cli.Command { }, { Name: "status", - Usage: "Show status of DM.", + Usage: "Show status of Helm server-side components.", ArgsUsage: "", Flags: []cli.Flag{ cli.BoolFlag{ @@ -111,7 +115,7 @@ func dmCmd() cli.Command { }, { Name: "target", - Usage: "Displays information about cluster.", + Usage: "Displays information about the Kubernetes cluster.", ArgsUsage: "", Action: func(c *cli.Context) { if err := target(c.Bool("dry-run")); err != nil { @@ -177,3 +181,16 @@ func getKubectlRunner(dryRun bool) kubectl.Runner { } return &kubectl.RealRunner{} } + +func target(dryRun bool) error { + client := kubectl.Client + if dryRun { + client = kubectl.PrintRunner{} + } + out, err := client.ClusterInfo() + if err != nil { + return fmt.Errorf("%s (%s)", out, err) + } + format.Msg(string(out)) + return nil +} diff --git a/cmd/helm/target.go b/cmd/helm/target.go deleted file mode 100644 index bcf61bb40..000000000 --- a/cmd/helm/target.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package main - -import ( - "fmt" - - "github.com/kubernetes/helm/pkg/format" - "github.com/kubernetes/helm/pkg/kubectl" -) - -func target(dryRun bool) error { - client := kubectl.Client - if dryRun { - client = kubectl.PrintRunner{} - } - out, err := client.ClusterInfo() - if err != nil { - return fmt.Errorf("%s (%s)", out, err) - } - format.Msg(string(out)) - return nil -}