WithNewSpec generates a new spec for a new container
(opts ...oci.SpecOpts)
| 314 | |
| 315 | // WithNewSpec generates a new spec for a new container |
| 316 | func WithNewSpec(opts ...oci.SpecOpts) NewContainerOpts { |
| 317 | return func(ctx context.Context, client *Client, c *containers.Container) error { |
| 318 | if _, ok := namespaces.Namespace(ctx); !ok { |
| 319 | ctx = namespaces.WithNamespace(ctx, client.DefaultNamespace()) |
| 320 | } |
| 321 | s, err := oci.GenerateSpec(ctx, client, c, opts...) |
| 322 | if err != nil { |
| 323 | return err |
| 324 | } |
| 325 | c.Spec, err = typeurl.MarshalAny(s) |
| 326 | return err |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | // WithSpec sets the provided spec on the container |
| 331 | func WithSpec(s *oci.Spec, opts ...oci.SpecOpts) NewContainerOpts { |
searching dependent graphs…