Sandbox: Add annotations to controller CreateOptions

Following the addition of annotations to the grpc/ttrpc API surface,
follow suit with adding annotations to the controller api surface.

Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
Danny Canter 2023-08-11 23:24:45 -07:00
parent 939ccbed42
commit def5ff3c4b
2 changed files with 13 additions and 3 deletions

View File

@ -35,6 +35,7 @@ type CreateOptions struct {
// to setup global shim configuration. // to setup global shim configuration.
Options typeurl.Any Options typeurl.Any
NetNSPath string NetNSPath string
Annotations map[string]string
} }
type CreateOpt func(*CreateOptions) error type CreateOpt func(*CreateOptions) error
@ -68,6 +69,14 @@ func WithNetNSPath(netNSPath string) CreateOpt {
} }
} }
// WithAnnotations sets the provided annotations for sandbox creation.
func WithAnnotations(annotations map[string]string) CreateOpt {
return func(co *CreateOptions) error {
co.Annotations = annotations
return nil
}
}
type StopOptions struct { type StopOptions struct {
Timeout *time.Duration Timeout *time.Duration
} }

View File

@ -53,6 +53,7 @@ func (s *remoteSandboxController) Create(ctx context.Context, sandboxID string,
Value: options.Options.GetValue(), Value: options.Options.GetValue(),
}, },
NetnsPath: options.NetNSPath, NetnsPath: options.NetNSPath,
Annotations: options.Annotations,
}) })
if err != nil { if err != nil {
return errdefs.FromGRPC(err) return errdefs.FromGRPC(err)