From 5aedea16c5a97573816c93ccccb4e2697fa899a7 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Thu, 24 Mar 2016 18:25:20 -0600 Subject: [PATCH] feat(deployment): add describe command to helm cli --- cmd/helm/deployment.go | 30 +++++++++++++++++++++++++++++- pkg/client/deployments.go | 7 +++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/cmd/helm/deployment.go b/cmd/helm/deployment.go index dd83734b3..1e8897258 100644 --- a/cmd/helm/deployment.go +++ b/cmd/helm/deployment.go @@ -26,7 +26,10 @@ import ( "github.com/kubernetes/helm/pkg/format" ) -var errMissingDeploymentArg = errors.New("First argument, deployment name, is required. Try 'helm get --help'") +var ( + errMissingDeploymentArg = errors.New("First argument, deployment name, is required. Try 'helm get --help'") + errTooManyArgs = errors.New("Too many arguments provided. Try 'helm dep describe [DEPLOYMENT]'") +) const defaultShowFormat = `Name: {{.Name}} Status: {{.State.Status}} @@ -57,6 +60,12 @@ func deploymentCommands() cli.Command { ArgsUsage: "DEPLOYMENT [DEPLOYMENT [...]]", Action: func(c *cli.Context) { run(c, deleteDeployment) }, }, + { + Name: "describe", + Usage: "Describes the kubernetes resources for the named deployment(s).", + ArgsUsage: "DEPLOYMENT", + Action: func(c *cli.Context) { run(c, describeDeployment) }, + }, { Name: "manifest", Usage: "Dump the Kubernetes manifest file for this deployment.", @@ -125,6 +134,25 @@ func deleteDeployment(c *cli.Context) error { return nil } +func describeDeployment(c *cli.Context) error { + args := c.Args() + if len(args) < 1 { + return errMissingDeploymentArg + } + if len(args) > 1 { + return errTooManyArgs + } + name := args[0] + _, err := NewClient(c).DescribeDeployment(name) + if err != nil { + return err + } + + format.Info("TO BE IMPLEMENTED") + + return nil +} + func showDeployment(c *cli.Context) error { args := c.Args() if len(args) < 1 { diff --git a/pkg/client/deployments.go b/pkg/client/deployments.go index 9fb1e506a..30bf0ff45 100644 --- a/pkg/client/deployments.go +++ b/pkg/client/deployments.go @@ -100,6 +100,13 @@ func (c *Client) DeleteDeployment(name string) (*common.Deployment, error) { return deployment, err } +// DescribDeployment describes the kubernetes resources of the supplied deployment +func (c *Client) DescribeDeployment(name string) (*common.Deployment, error) { + var deployment *common.Deployment + //TODO: implement + return deployment, nil +} + // PostDeployment posts a deployment object to the manager service. func (c *Client) PostDeployment(res *common.Resource) error { // This is a stop-gap until we get this API cleaned up.