github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/domain/infra/tunnel/play.go (about)

     1  package tunnel
     2  
     3  import (
     4  	"context"
     5  	"io"
     6  
     7  	"github.com/containers/image/v5/types"
     8  	"github.com/hanks177/podman/v4/pkg/bindings/play"
     9  	"github.com/hanks177/podman/v4/pkg/domain/entities"
    10  )
    11  
    12  func (ic *ContainerEngine) PlayKube(ctx context.Context, body io.Reader, opts entities.PlayKubeOptions) (*entities.PlayKubeReport, error) {
    13  	options := new(play.KubeOptions).WithAuthfile(opts.Authfile).WithUsername(opts.Username).WithPassword(opts.Password)
    14  	options.WithCertDir(opts.CertDir).WithQuiet(opts.Quiet).WithSignaturePolicy(opts.SignaturePolicy).WithConfigMaps(opts.ConfigMaps)
    15  	options.WithLogDriver(opts.LogDriver).WithNetwork(opts.Networks).WithSeccompProfileRoot(opts.SeccompProfileRoot)
    16  	options.WithStaticIPs(opts.StaticIPs).WithStaticMACs(opts.StaticMACs)
    17  	if len(opts.LogOptions) > 0 {
    18  		options.WithLogOptions(opts.LogOptions)
    19  	}
    20  	if opts.Annotations != nil {
    21  		options.WithAnnotations(opts.Annotations)
    22  	}
    23  	options.WithNoHosts(opts.NoHosts).WithUserns(opts.Userns)
    24  	if s := opts.SkipTLSVerify; s != types.OptionalBoolUndefined {
    25  		options.WithSkipTLSVerify(s == types.OptionalBoolTrue)
    26  	}
    27  	if start := opts.Start; start != types.OptionalBoolUndefined {
    28  		options.WithStart(start == types.OptionalBoolTrue)
    29  	}
    30  	return play.KubeWithBody(ic.ClientCtx, body, options)
    31  }
    32  
    33  func (ic *ContainerEngine) PlayKubeDown(ctx context.Context, body io.Reader, _ entities.PlayKubeDownOptions) (*entities.PlayKubeReport, error) {
    34  	return play.KubeDownWithBody(ic.ClientCtx, body)
    35  }