feat(cli): Add 'helm deployment delete'

Closes #239
pull/427/head
Matt Butcher 9 years ago
parent 37c27a97f6
commit 64c7ab2091

@ -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)
}

@ -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
}

@ -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

Loading…
Cancel
Save