Pass ttrpc address to shim via env

Because of the way go handles flags, passing a flag that is not defined
will cause an error. In our case, if we kept this as a flag, then
third-party shims would break when they see this new flag.  To fix this,
I moved this new configuration option to an env var.  We should use env
vars from here on out to avoid breaking shim compat.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2019-08-22 18:48:51 +00:00
parent 1be6ee5396
commit 6cf031e1e4
4 changed files with 13 additions and 8 deletions

View File

@@ -50,7 +50,6 @@ func Command(ctx context.Context, runtime, containerdAddress, containerdTTRPCAdd
args := []string{
"-namespace", ns,
"-address", containerdAddress,
"-ttrpc-address", containerdTTRPCAddress,
"-publish-binary", self,
}
args = append(args, cmdArgs...)
@@ -96,7 +95,11 @@ func Command(ctx context.Context, runtime, containerdAddress, containerdTTRPCAdd
cmd := exec.Command(cmdPath, args...)
cmd.Dir = path
cmd.Env = append(os.Environ(), "GOMAXPROCS=2")
cmd.Env = append(
os.Environ(),
"GOMAXPROCS=2",
fmt.Sprintf("%s=%s", ttrpcAddressEnv, containerdTTRPCAddress),
)
cmd.SysProcAttr = getSysProcAttr()
if opts != nil {
d, err := proto.Marshal(opts)