summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-10-08 15:05:42 +0200
committerGitHub <noreply@github.com>2021-10-08 15:05:42 +0200
commitbd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67 (patch)
treea3705e99f19f204f87bbb927d25e7c5988af3cec /cmd/podman
parent14c0fcc6b7b3e8c1f28efea329ab9a6bf0d99b70 (diff)
parent6fc73ea4ea4fa8b82092fc605390d3cfece97dd1 (diff)
downloadpodman-bd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67.tar.gz
podman-bd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67.tar.bz2
podman-bd4d9a09520b2329b1cf3dd8cdf8194b8bdeab67.zip
Merge pull request #11671 from chenzhiwei/kube-replace
introduce --replace flag for play kube
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/play/kube.go10
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)
}