Allow explicit configuration of TTRPC address
Previously the TTRPC address was generated as "<GRPC address>.ttrpc". This change now allows explicit configuration of the TTRPC address, with the default still being the old format if no value is specified. As part of this change, a new configuration section is added for TTRPC listener options. Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
This commit is contained in:
@@ -57,7 +57,7 @@ type Init func(context.Context, string, Publisher, func()) (Shim, error)
|
||||
type Shim interface {
|
||||
shimapi.TaskService
|
||||
Cleanup(ctx context.Context) (*shimapi.DeleteResponse, error)
|
||||
StartShim(ctx context.Context, id, containerdBinary, containerdAddress string) (string, error)
|
||||
StartShim(ctx context.Context, id, containerdBinary, containerdAddress, containerdTTRPCAddress string) (string, error)
|
||||
}
|
||||
|
||||
// OptsKey is the context key for the Opts value.
|
||||
@@ -89,6 +89,7 @@ var (
|
||||
socketFlag string
|
||||
bundlePath string
|
||||
addressFlag string
|
||||
ttrpcAddressFlag string
|
||||
containerdBinaryFlag string
|
||||
action string
|
||||
)
|
||||
@@ -101,6 +102,7 @@ func parseFlags() {
|
||||
flag.StringVar(&bundlePath, "bundle", "", "path to the bundle if not workdir")
|
||||
|
||||
flag.StringVar(&addressFlag, "address", "", "grpc address back to main containerd")
|
||||
flag.StringVar(&ttrpcAddressFlag, "ttrpc-address", "", "ttrpc address back to main containerd")
|
||||
flag.StringVar(&containerdBinaryFlag, "publish-binary", "containerd", "path to publish binary (used for publishing events)")
|
||||
|
||||
flag.Parse()
|
||||
@@ -163,8 +165,7 @@ func run(id string, initFunc Init, config Config) error {
|
||||
}
|
||||
}
|
||||
|
||||
address := fmt.Sprintf("%s.ttrpc", addressFlag)
|
||||
publisher, err := newPublisher(address)
|
||||
publisher, err := newPublisher(ttrpcAddressFlag)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -203,7 +204,7 @@ func run(id string, initFunc Init, config Config) error {
|
||||
}
|
||||
return nil
|
||||
case "start":
|
||||
address, err := service.StartShim(ctx, idFlag, containerdBinaryFlag, addressFlag)
|
||||
address, err := service.StartShim(ctx, idFlag, containerdBinaryFlag, addressFlag, ttrpcAddressFlag)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import (
|
||||
var runtimePaths sync.Map
|
||||
|
||||
// Command returns the shim command with the provided args and configuration
|
||||
func Command(ctx context.Context, runtime, containerdAddress, path string, opts *types.Any, cmdArgs ...string) (*exec.Cmd, error) {
|
||||
func Command(ctx context.Context, runtime, containerdAddress, containerdTTRPCAddress, path string, opts *types.Any, cmdArgs ...string) (*exec.Cmd, error) {
|
||||
ns, err := namespaces.NamespaceRequired(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -50,6 +50,7 @@ func Command(ctx context.Context, runtime, containerdAddress, path string, opts
|
||||
args := []string{
|
||||
"-namespace", ns,
|
||||
"-address", containerdAddress,
|
||||
"-ttrpc-address", containerdTTRPCAddress,
|
||||
"-publish-binary", self,
|
||||
}
|
||||
args = append(args, cmdArgs...)
|
||||
|
||||
Reference in New Issue
Block a user