diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/domain/entities/pods.go | 2 | ||||
-rw-r--r-- | pkg/specgen/generate/container_create.go | 3 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 3 | ||||
-rw-r--r-- | pkg/specgenutil/specgen.go | 11 |
4 files changed, 18 insertions, 1 deletions
diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go index 309677396..a2f36eaa6 100644 --- a/pkg/domain/entities/pods.go +++ b/pkg/domain/entities/pods.go @@ -235,7 +235,7 @@ type ContainerCreateOptions struct { SignaturePolicy string StopSignal string StopTimeout uint - StorageOpt []string + StorageOpts []string SubUIDName string SubGIDName string Sysctl []string diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 92c0f22d9..9f398a0ed 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -366,6 +366,9 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen. if s.Entrypoint != nil { options = append(options, libpod.WithEntrypoint(s.Entrypoint)) } + if len(s.ContainerStorageConfig.StorageOpts) > 0 { + options = append(options, libpod.WithStorageOpts(s.StorageOpts)) + } // If the user did not specify a workdir on the CLI, let's extract it // from the image. if s.WorkDir == "" && imageData != nil { diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 79185db04..5a07af0f9 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -272,6 +272,9 @@ type ContainerStorageConfig struct { // If unset, the default, /, will be used. // Optional. WorkDir string `json:"work_dir,omitempty"` + // StorageOpts is the container's storage options + // Optional. + StorageOpts map[string]string `json:"storage_opts,omitempty"` // RootfsPropagation is the rootfs propagation mode for the container. // If not set, the default of rslave will be used. // Optional. diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go index 8007e5d8e..683cd2918 100644 --- a/pkg/specgenutil/specgen.go +++ b/pkg/specgenutil/specgen.go @@ -394,6 +394,17 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions } s.Annotations = annotations + if len(c.StorageOpts) > 0 { + opts := make(map[string]string, len(c.StorageOpts)) + for _, opt := range c.StorageOpts { + split := strings.SplitN(opt, "=", 2) + if len(split) != 2 { + return errors.Errorf("storage-opt must be formatted KEY=VALUE") + } + opts[split[0]] = split[1] + } + s.StorageOpts = opts + } s.WorkDir = c.Workdir if c.Entrypoint != nil { entrypoint := []string{} |