Skip to content

Commit

Permalink
Add branch for platform-specific container opts
Browse files Browse the repository at this point in the history
- Add empty setPlatformContainerOptions() function per platform

Signed-off-by: Min Uk Lee <minuk.dev@gmail.com>
  • Loading branch information
minuk-dev committed Oct 10, 2022
1 parent 8de12b9 commit 82e3d04
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/nerdctl/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ func createContainer(cmd *cobra.Command, ctx context.Context, client *containerd
spec := containerd.WithSpec(&s, opts...)
cOpts = append(cOpts, spec)

cOpts, err = setPlatformContainerOptions(ctx, cOpts, cmd, client, id)
if err != nil {
return nil, nil, err
}

container, err := client.NewContainer(ctx, id, cOpts...)
if err != nil {
gcContainer := func() {
Expand Down
4 changes: 4 additions & 0 deletions cmd/nerdctl/run_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ func runShellComplete(cmd *cobra.Command, args []string, toComplete string) ([]s
func setPlatformOptions(ctx context.Context, opts []oci.SpecOpts, cmd *cobra.Command, client *containerd.Client, id string) ([]oci.SpecOpts, error) {
return opts, nil
}

func setPlatformContainerOptions(ctx context.Context, cOpts []containerd.NewContainerOpts, cmd *cobra.Command, client *containerd.Client, id string) ([]containerd.NewContainerOpts, error) {
return cOpts, nil
}
4 changes: 4 additions & 0 deletions cmd/nerdctl/run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func setPlatformOptions(ctx context.Context, opts []oci.SpecOpts, cmd *cobra.Com
return opts, nil
}

func setPlatformContainerOptions(ctx context.Context, cOpts []containerd.NewContainerOpts, cmd *cobra.Command, client *containerd.Client, id string) ([]containerd.NewContainerOpts, error) {
return cOpts, nil
}

func setOOMScoreAdj(opts []oci.SpecOpts, cmd *cobra.Command) ([]oci.SpecOpts, error) {
if !cmd.Flags().Changed("oom-score-adj") {
return opts, nil
Expand Down
4 changes: 4 additions & 0 deletions cmd/nerdctl/run_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,7 @@ func setPlatformOptions(ctx context.Context, opts []oci.SpecOpts, cmd *cobra.Com

return opts, nil
}

func setPlatformContainerOptions(ctx context.Context, cOpts []containerd.NewContainerOpts, cmd *cobra.Command, client *containerd.Client, id string) ([]containerd.NewContainerOpts, error) {
return cOpts, nil
}

0 comments on commit 82e3d04

Please sign in to comment.