summaryrefslogtreecommitdiff
path: root/pkg/bindings/play
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-08-26 13:58:44 -0400
committerGitHub <noreply@github.com>2021-08-26 13:58:44 -0400
commit94c37d7d470871f9d63b32c97094f5faab1e8a08 (patch)
tree7597eba1d8c63fbf9c7fe19c1ee5255f9194a027 /pkg/bindings/play
parent70caa63e7cfc4a2b70722058be9f315b4a76defe (diff)
parente88b62b34bbd7cd0240a8717ba14f31e1856f832 (diff)
downloadpodman-94c37d7d470871f9d63b32c97094f5faab1e8a08.tar.gz
podman-94c37d7d470871f9d63b32c97094f5faab1e8a08.tar.bz2
podman-94c37d7d470871f9d63b32c97094f5faab1e8a08.zip
Merge pull request #11298 from baude/kubeupdown
teardown play kube
Diffstat (limited to 'pkg/bindings/play')
-rw-r--r--pkg/bindings/play/play.go29
-rw-r--r--pkg/bindings/play/types.go4
2 files changed, 32 insertions, 1 deletions
diff --git a/pkg/bindings/play/play.go b/pkg/bindings/play/play.go
index 8451cd533..89a6f9b65 100644
--- a/pkg/bindings/play/play.go
+++ b/pkg/bindings/play/play.go
@@ -6,6 +6,8 @@ import (
"os"
"strconv"
+ "github.com/sirupsen/logrus"
+
"github.com/containers/podman/v3/pkg/auth"
"github.com/containers/podman/v3/pkg/bindings"
"github.com/containers/podman/v3/pkg/domain/entities"
@@ -56,3 +58,30 @@ func Kube(ctx context.Context, path string, options *KubeOptions) (*entities.Pla
return &report, nil
}
+
+func KubeDown(ctx context.Context, path string) (*entities.PlayKubeReport, error) {
+ var report entities.PlayKubeReport
+ conn, err := bindings.GetClient(ctx)
+ if err != nil {
+ return nil, err
+ }
+
+ f, err := os.Open(path)
+ if err != nil {
+ return nil, err
+ }
+ defer func() {
+ if err := f.Close(); err != nil {
+ logrus.Warn(err)
+ }
+ }()
+ response, err := conn.DoRequest(f, http.MethodDelete, "/play/kube", nil, nil)
+ if err != nil {
+ return nil, err
+ }
+ if err := response.Process(&report); err != nil {
+ return nil, err
+ }
+
+ return &report, nil
+}
diff --git a/pkg/bindings/play/types.go b/pkg/bindings/play/types.go
index 52a72c7b6..787069169 100644
--- a/pkg/bindings/play/types.go
+++ b/pkg/bindings/play/types.go
@@ -1,6 +1,8 @@
package play
-import "net"
+import (
+ "net"
+)
//go:generate go run ../generator/generator.go KubeOptions
// KubeOptions are optional options for replaying kube YAML files