From 37c27a97f6b7d379ccd06716af669cd710d68438 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Mon, 21 Mar 2016 17:22:03 -0600 Subject: [PATCH 1/3] doc(workflow): change 'helm deployment delete' command Also fix a few typos. --- docs/workflow/developer-workflows.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/workflow/developer-workflows.md b/docs/workflow/developer-workflows.md index 238837fd8..dcbe8aa87 100644 --- a/docs/workflow/developer-workflows.md +++ b/docs/workflow/developer-workflows.md @@ -56,7 +56,7 @@ Created wonky-panda - The client sends the server a request to deploy `helm:example.com/foo/bar`. - The server assigns a random name `wonky-panda`, fetches the chart from object storage, and goes about the deployment process. - + General patterns: ``` helm deploy [-f CONFIG] [-n NAME] [CHART] @@ -176,7 +176,7 @@ helm redeploy [-f CONFIG] NAME #### Delete: ``` -$ helm delete taco-tuesday +$ helm deployment delete taco-tuesday Destroyed taco-tuesday ``` @@ -185,10 +185,9 @@ Destroyed taco-tuesday General pattern: ``` -helm uninstall NAME [NAME...] +helm deployment delete NAME [NAME...] ``` - ### Power User Features Users familiar with the system may desire additional tools. From 64c7ab2091c1b2dc93cc6d13d80ea08072ebe075 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Mon, 21 Mar 2016 17:44:49 -0600 Subject: [PATCH 2/3] feat(cli): Add 'helm deployment delete' Closes #239 --- cmd/helm/delete.go | 50 ------------------------------------------ cmd/helm/deployment.go | 31 ++++++++++++++++++++++---- scripts/start-local.sh | 6 ++--- 3 files changed, 30 insertions(+), 57 deletions(-) delete mode 100644 cmd/helm/delete.go diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go deleted file mode 100644 index 750bd1f6c..000000000 --- a/cmd/helm/delete.go +++ /dev/null @@ -1,50 +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 ( - "errors" - - "github.com/codegangsta/cli" - "github.com/kubernetes/helm/pkg/format" -) - -func init() { - addCommands(deleteCmd()) -} - -func deleteCmd() cli.Command { - return cli.Command{ - Name: "delete", - Usage: "Deletes the supplied deployment", - ArgsUsage: "DEPLOYMENT", - Action: func(c *cli.Context) { run(c, deleteDeployment) }, - } -} - -func deleteDeployment(c *cli.Context) error { - args := c.Args() - if len(args) < 1 { - return errors.New("First argument, deployment name, is required. Try 'helm get --help'") - } - name := args[0] - deployment, err := NewClient(c).DeleteDeployment(name) - if err != nil { - return err - } - return format.YAML(deployment) -} diff --git a/cmd/helm/deployment.go b/cmd/helm/deployment.go index c4b7b7dee..28e93a3ea 100644 --- a/cmd/helm/deployment.go +++ b/cmd/helm/deployment.go @@ -40,6 +40,13 @@ func deploymentCommands() cli.Command { Usage: "Dump the configuration file for this deployment.", ArgsUsage: "DEPLOYMENT", }, + { + Name: "delete", + Aliases: []string{"del"}, + Usage: "Deletes the named deployment(s).", + ArgsUsage: "DEPLOYMENT [DEPLOYMENT [...]]", + Action: func(c *cli.Context) { run(c, deleteDeployment) }, + }, { Name: "manifest", Usage: "Dump the Kubernetes manifest file for this deployment.", @@ -53,15 +60,16 @@ func deploymentCommands() cli.Command { }, { Name: "list", - Usage: "list all deployments, or filter by an optional pattern", - ArgsUsage: "PATTERN", - Action: func(c *cli.Context) { run(c, list) }, + Aliases: []string{"ls"}, + Usage: "list all deployments, or filter by an optional regular expression.", + ArgsUsage: "REGEXP", + Action: func(c *cli.Context) { run(c, listDeployments) }, }, }, } } -func list(c *cli.Context) error { +func listDeployments(c *cli.Context) error { list, err := NewClient(c).ListDeployments() if err != nil { return err @@ -90,3 +98,18 @@ func list(c *cli.Context) error { format.List(list) return nil } + +func deleteDeployment(c *cli.Context) error { + args := c.Args() + if len(args) < 1 { + return errors.New("First argument, deployment name, is required. Try 'helm get --help'") + } + for _, name := range args { + deployment, err := NewClient(c).DeleteDeployment(name) + if err != nil { + return err + } + format.Info("Deleted %q at %s", name, deployment.DeletedAt) + } + return nil +} diff --git a/scripts/start-local.sh b/scripts/start-local.sh index 14fe39308..b97c38cc3 100755 --- a/scripts/start-local.sh +++ b/scripts/start-local.sh @@ -34,15 +34,15 @@ fi KUBECTL=$(which kubectl) || error_exit "Cannot find kubectl" echo "Starting resourcifier..." -pkill -f $RESOURCIFIER +#pkill -f $RESOURCIFIER nohup $RESOURCIFIER > $LOGDIR/resourcifier.log 2>&1 --kubectl="${KUBECTL}" --port=8082 & echo "Starting expandybird..." -pkill -f $EXPANDYBIRD +#pkill -f $EXPANDYBIRD nohup $EXPANDYBIRD > $LOGDIR/expandybird.log 2>&1 --port=8081 --expansion_binary=expansion/expansion.py & echo "Starting deployment manager..." -pkill -f $MANAGER +#pkill -f $MANAGER nohup $MANAGER > $LOGDIR/manager.log 2>&1 --port="${MANAGER_PORT}" --kubectl="${KUBECTL}" --expanderURL=http://localhost:8081 --deployerURL=http://localhost:8082 & if [[ "$KUBE_PROXY" ]]; then From 0d281bc07c15b6f109efafefa83f49ab270e51a0 Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Mon, 21 Mar 2016 17:49:14 -0600 Subject: [PATCH 3/3] fix(scripts): back-out accidental change --- scripts/start-local.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/start-local.sh b/scripts/start-local.sh index b97c38cc3..14fe39308 100755 --- a/scripts/start-local.sh +++ b/scripts/start-local.sh @@ -34,15 +34,15 @@ fi KUBECTL=$(which kubectl) || error_exit "Cannot find kubectl" echo "Starting resourcifier..." -#pkill -f $RESOURCIFIER +pkill -f $RESOURCIFIER nohup $RESOURCIFIER > $LOGDIR/resourcifier.log 2>&1 --kubectl="${KUBECTL}" --port=8082 & echo "Starting expandybird..." -#pkill -f $EXPANDYBIRD +pkill -f $EXPANDYBIRD nohup $EXPANDYBIRD > $LOGDIR/expandybird.log 2>&1 --port=8081 --expansion_binary=expansion/expansion.py & echo "Starting deployment manager..." -#pkill -f $MANAGER +pkill -f $MANAGER nohup $MANAGER > $LOGDIR/manager.log 2>&1 --port="${MANAGER_PORT}" --kubectl="${KUBECTL}" --expanderURL=http://localhost:8081 --deployerURL=http://localhost:8082 & if [[ "$KUBE_PROXY" ]]; then