diff options
author | Niall Crowe <nicrowe@redhat.com> | 2022-07-18 14:20:35 +0100 |
---|---|---|
committer | Niall Crowe <nicrowe@redhat.com> | 2022-08-02 16:27:01 +0100 |
commit | 1249cbb75f50182f19e5976fa149386672451f2a (patch) | |
tree | 1a69e285813ea6d26c7da06d4e12230826ddb19e /cmd/podman/kube/down.go | |
parent | c09457e34a429622475e27fe68e17effe47fe0c3 (diff) | |
download | podman-1249cbb75f50182f19e5976fa149386672451f2a.tar.gz podman-1249cbb75f50182f19e5976fa149386672451f2a.tar.bz2 podman-1249cbb75f50182f19e5976fa149386672451f2a.zip |
add "podman kube down" command
The "podman kube down" reads in a structured file of
Kubernetes YAML and removes pods based on the Kubernetes kind described in the YAML,
similiar to "podman play kube --down". Users will still be able to use
"podman play kube --down" and "podman kube play --down" to
perform the same function.
Signed-off-by: Niall Crowe <nicrowe@redhat.com>
Diffstat (limited to 'cmd/podman/kube/down.go')
-rw-r--r-- | cmd/podman/kube/down.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cmd/podman/kube/down.go b/cmd/podman/kube/down.go new file mode 100644 index 000000000..b8c025928 --- /dev/null +++ b/cmd/podman/kube/down.go @@ -0,0 +1,39 @@ +package pods + +import ( + "github.com/containers/podman/v4/cmd/podman/common" + "github.com/containers/podman/v4/cmd/podman/registry" + "github.com/spf13/cobra" +) + +var ( + downDescription = `Reads in a structured file of Kubernetes YAML. + + Removes pods that have been based on the Kubernetes kind described in the YAML.` + + downCmd = &cobra.Command{ + Use: "down KUBEFILE|-", + Short: "Remove pods based on Kubernetes YAML.", + Long: downDescription, + RunE: down, + Args: cobra.ExactArgs(1), + ValidArgsFunction: common.AutocompleteDefaultOneArg, + Example: `podman kube down nginx.yml + cat nginx.yml | podman kube down -`, + } +) + +func init() { + registry.Commands = append(registry.Commands, registry.CliCommand{ + Command: downCmd, + Parent: kubeCmd, + }) +} + +func down(cmd *cobra.Command, args []string) error { + reader, err := readerFromArg(args[0]) + if err != nil { + return err + } + return teardown(reader) +} |