diff --git a/sandbox/controller.go b/sandbox/controller.go index 0ee315b93..45264e791 100644 --- a/sandbox/controller.go +++ b/sandbox/controller.go @@ -33,8 +33,9 @@ type CreateOptions struct { // CRI will use this to pass PodSandboxConfig. // Don't confuse this with Runtime options, which are passed at shim instance start // to setup global shim configuration. - Options typeurl.Any - NetNSPath string + Options typeurl.Any + NetNSPath string + Annotations map[string]string } 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 { Timeout *time.Duration } diff --git a/sandbox/proxy/controller.go b/sandbox/proxy/controller.go index 05b550722..770b561b7 100644 --- a/sandbox/proxy/controller.go +++ b/sandbox/proxy/controller.go @@ -52,7 +52,8 @@ func (s *remoteSandboxController) Create(ctx context.Context, sandboxID string, TypeUrl: options.Options.GetTypeUrl(), Value: options.Options.GetValue(), }, - NetnsPath: options.NetNSPath, + NetnsPath: options.NetNSPath, + Annotations: options.Annotations, }) if err != nil { return errdefs.FromGRPC(err)