From 6c9d4d62a7822533ca2e81f97391cc97184630e1 Mon Sep 17 00:00:00 2001 From: Edwin Chong <8726446-ewchong@users.noreply.gitlab.com> Date: Tue, 23 Apr 2024 14:07:16 -0400 Subject: [PATCH] Add podman remote support Close #27 --- connector.go | 1 + internal/argsbuilder/argsbuilder.go | 7 +++++++ internal/argsbuilder/argsbuilder_interface.go | 1 + 3 files changed, 9 insertions(+) diff --git a/connector.go b/connector.go index a003d20..bd3a31f 100644 --- a/connector.go +++ b/connector.go @@ -49,6 +49,7 @@ func (c *Connector) Deploy(ctx context.Context, image string) (deployer.Plugin, SetCgroupNs(string(hostConfig.CgroupnsMode)). SetNetworkMode(string(hostConfig.NetworkMode)). SetPrivileged(hostConfig.Privileged) + SetConnection(c.config.Podman.Connection) stdin, stdout, err := c.podmanCliWrapper.Deploy(image, commandArgs, []string{"--atp"}) diff --git a/internal/argsbuilder/argsbuilder.go b/internal/argsbuilder/argsbuilder.go index 05fa409..e93bea9 100644 --- a/internal/argsbuilder/argsbuilder.go +++ b/internal/argsbuilder/argsbuilder.go @@ -53,3 +53,10 @@ func (a *argsBuilder) SetPrivileged(privileged bool) ArgsBuilder { } return a } + +func (a *argsBuilder) SetConnection(connectionName string) ArgsBuilder { + if connectionName != "" { + *a.commandArgs = append(*a.commandArgs, "--connection", connectionName) + } + return a +} diff --git a/internal/argsbuilder/argsbuilder_interface.go b/internal/argsbuilder/argsbuilder_interface.go index 3dcd54c..f074fb1 100644 --- a/internal/argsbuilder/argsbuilder_interface.go +++ b/internal/argsbuilder/argsbuilder_interface.go @@ -7,6 +7,7 @@ type ArgsBuilder interface { SetContainerName(name string) ArgsBuilder SetNetworkMode(networkMode string) ArgsBuilder SetPrivileged(privileged bool) ArgsBuilder + SetConnection(networkMode string) ArgsBuilder } func NewBuilder(commandArgs *[]string) ArgsBuilder {