From 82e3d04723bc3bd86f7dd075da5ff091e6432022 Mon Sep 17 00:00:00 2001 From: Min Uk Lee Date: Thu, 6 Oct 2022 05:37:18 +0900 Subject: [PATCH] Add branch for platform-specific container opts - Add empty setPlatformContainerOptions() function per platform Signed-off-by: Min Uk Lee --- cmd/nerdctl/run.go | 5 +++++ cmd/nerdctl/run_freebsd.go | 4 ++++ cmd/nerdctl/run_linux.go | 4 ++++ cmd/nerdctl/run_windows.go | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/cmd/nerdctl/run.go b/cmd/nerdctl/run.go index 90e1bb4a3b5..613351333f4 100644 --- a/cmd/nerdctl/run.go +++ b/cmd/nerdctl/run.go @@ -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() { diff --git a/cmd/nerdctl/run_freebsd.go b/cmd/nerdctl/run_freebsd.go index e532ebf4e80..3e2ed6723da 100644 --- a/cmd/nerdctl/run_freebsd.go +++ b/cmd/nerdctl/run_freebsd.go @@ -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 +} diff --git a/cmd/nerdctl/run_linux.go b/cmd/nerdctl/run_linux.go index 94d9cb9658f..3a2eb669c1a 100644 --- a/cmd/nerdctl/run_linux.go +++ b/cmd/nerdctl/run_linux.go @@ -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 diff --git a/cmd/nerdctl/run_windows.go b/cmd/nerdctl/run_windows.go index 97f559f0218..915ddbf7975 100644 --- a/cmd/nerdctl/run_windows.go +++ b/cmd/nerdctl/run_windows.go @@ -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 +}