summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-02-18 06:11:29 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-02-19 12:53:25 -0500
commitf06dd45e0c1b4a36bb93f33cc863d54af94b5155 (patch)
tree1b41b817cb0a7941c9b5a1bcbb1369aceb40f078 /cmd
parentb6db60e58f2f5abb4902c28c91e770495f3d4926 (diff)
downloadpodman-f06dd45e0c1b4a36bb93f33cc863d54af94b5155.tar.gz
podman-f06dd45e0c1b4a36bb93f33cc863d54af94b5155.tar.bz2
podman-f06dd45e0c1b4a36bb93f33cc863d54af94b5155.zip
Allow podman play kube to read yaml file from stdin
Fixes: https://github.com/containers/podman/issues/8996 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/play/kube.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 511e208cf..dafb6abe6 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -35,13 +35,14 @@ var (
It creates the pod and containers described in the YAML. The containers within the pod are then started and the ID of the new Pod is output.`
kubeCmd = &cobra.Command{
- Use: "kube [options] KUBEFILE",
+ Use: "kube [options] KUBEFILE|-",
Short: "Play a pod based on Kubernetes YAML.",
Long: kubeDescription,
RunE: kube,
Args: cobra.ExactArgs(1),
ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman play kube nginx.yml
+ cat nginx.yml | podman play kube -
podman play kube --creds user:password --seccomp-profile-root /custom/path apache.yml`,
}
)
@@ -119,7 +120,11 @@ func kube(cmd *cobra.Command, args []string) error {
kubeOptions.Password = creds.Password
}
- report, err := registry.ContainerEngine().PlayKube(registry.GetContext(), args[0], kubeOptions.PlayKubeOptions)
+ yamlfile := args[0]
+ if yamlfile == "-" {
+ yamlfile = "/dev/stdin"
+ }
+ report, err := registry.ContainerEngine().PlayKube(registry.GetContext(), yamlfile, kubeOptions.PlayKubeOptions)
if err != nil {
return err
}