summaryrefslogtreecommitdiff
path: root/libpod/adapter
diff options
context:
space:
mode:
authorAnders F Björklund <anders.f.bjorklund@gmail.com>2019-01-11 23:28:20 +0100
committerAnders F Björklund <anders.f.bjorklund@gmail.com>2019-01-13 18:16:34 +0100
commitc90e3e7fe59db0bfbce0c10bba8a9ff71c7c7266 (patch)
tree020679ca54cef6baa17e8ce55d8cb9430075fab0 /libpod/adapter
parentf31fdb221910130db4997df876b5b820a4590646 (diff)
downloadpodman-c90e3e7fe59db0bfbce0c10bba8a9ff71c7c7266.tar.gz
podman-c90e3e7fe59db0bfbce0c10bba8a9ff71c7c7266.tar.bz2
podman-c90e3e7fe59db0bfbce0c10bba8a9ff71c7c7266.zip
Add bridge support, for the varlink connection
Read the $PODMAN_VARLINK_BRIDGE environment variable (normally looks like: "ssh user@host varlink bridge") Also respect $PODMAN_VARLINK_ADDRESS as an override, if using a different podman socket than the default. Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Diffstat (limited to 'libpod/adapter')
-rw-r--r--libpod/adapter/client.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/libpod/adapter/client.go b/libpod/adapter/client.go
index 383c242c9..b3bb9acae 100644
--- a/libpod/adapter/client.go
+++ b/libpod/adapter/client.go
@@ -3,12 +3,32 @@
package adapter
import (
+ "os"
+
+ "github.com/sirupsen/logrus"
"github.com/varlink/go/varlink"
)
+// DefaultAddress is the default address of the varlink socket
+const DefaultAddress = "unix:/run/podman/io.podman"
+
// Connect provides a varlink connection
func (r RemoteRuntime) Connect() (*varlink.Connection, error) {
- connection, err := varlink.NewConnection("unix:/run/podman/io.podman")
+ var err error
+ var connection *varlink.Connection
+ if bridge := os.Getenv("PODMAN_VARLINK_BRIDGE"); bridge != "" {
+ logrus.Infof("Connecting with varlink bridge")
+ logrus.Debugf("%s", bridge)
+ connection, err = varlink.NewBridge(bridge)
+ } else {
+ address := os.Getenv("PODMAN_VARLINK_ADDRESS")
+ if address == "" {
+ address = DefaultAddress
+ }
+ logrus.Infof("Connecting with varlink address")
+ logrus.Debugf("%s", address)
+ connection, err = varlink.NewConnection(address)
+ }
if err != nil {
return nil, err
}