diff options
author | Chen Zhiwei <zhiweik@gmail.com> | 2021-09-21 05:30:10 -0400 |
---|---|---|
committer | Chen Zhiwei <zhiweik@gmail.com> | 2021-10-08 10:14:35 +0800 |
commit | 6fc73ea4ea4fa8b82092fc605390d3cfece97dd1 (patch) | |
tree | a3705e99f19f204f87bbb927d25e7c5988af3cec /cmd/podman | |
parent | 14c0fcc6b7b3e8c1f28efea329ab9a6bf0d99b70 (diff) | |
download | podman-6fc73ea4ea4fa8b82092fc605390d3cfece97dd1.tar.gz podman-6fc73ea4ea4fa8b82092fc605390d3cfece97dd1.tar.bz2 podman-6fc73ea4ea4fa8b82092fc605390d3cfece97dd1.zip |
[CI:DOCS] introduce --replace flag for play kube
With this flag, users can easily sync up the yaml content with the existing pods.
Fixes #11481
Signed-off-by: Chen Zhiwei <zhiweik@gmail.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/play/kube.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go index 85e0c279c..e6869efd3 100644 --- a/cmd/podman/play/kube.go +++ b/cmd/podman/play/kube.go @@ -11,7 +11,9 @@ import ( "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/registry" "github.com/containers/podman/v3/cmd/podman/utils" + "github.com/containers/podman/v3/libpod/define" "github.com/containers/podman/v3/pkg/domain/entities" + "github.com/containers/podman/v3/pkg/errorhandling" "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -90,6 +92,9 @@ func init() { downFlagName := "down" flags.BoolVar(&kubeOptions.Down, downFlagName, false, "Stop pods defined in the YAML file") + replaceFlagName := "replace" + flags.BoolVar(&kubeOptions.Replace, replaceFlagName, false, "Delete and recreate pods defined in the YAML file") + if !registry.IsRemote() { certDirFlagName := "cert-dir" flags.StringVar(&kubeOptions.CertDir, certDirFlagName, "", "`Pathname` of a directory containing TLS certificates and keys") @@ -151,6 +156,11 @@ func kube(cmd *cobra.Command, args []string) error { if kubeOptions.Down { return teardown(yamlfile) } + if kubeOptions.Replace { + if err := teardown(yamlfile); err != nil && !errorhandling.Contains(err, define.ErrNoSuchPod) { + return err + } + } return playkube(yamlfile) } |