diff options
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/config_unsupported.go | 2 | ||||
-rw-r--r-- | pkg/specgen/container_validate.go | 6 | ||||
-rw-r--r-- | pkg/specgen/generate/config_linux.go | 4 | ||||
-rw-r--r-- | pkg/specgen/generate/config_linux_cgo.go | 6 | ||||
-rw-r--r-- | pkg/specgen/generate/config_linux_nocgo.go | 4 | ||||
-rw-r--r-- | pkg/specgen/generate/container.go | 12 | ||||
-rw-r--r-- | pkg/specgen/generate/container_create.go | 13 | ||||
-rw-r--r-- | pkg/specgen/generate/kube/kube.go | 8 | ||||
-rw-r--r-- | pkg/specgen/generate/kube/seccomp.go | 2 | ||||
-rw-r--r-- | pkg/specgen/generate/kube/volume.go | 2 | ||||
-rw-r--r-- | pkg/specgen/generate/namespaces.go | 12 | ||||
-rw-r--r-- | pkg/specgen/generate/oci.go | 10 | ||||
-rw-r--r-- | pkg/specgen/generate/pod_create.go | 4 | ||||
-rw-r--r-- | pkg/specgen/generate/ports.go | 4 | ||||
-rw-r--r-- | pkg/specgen/generate/security.go | 10 | ||||
-rw-r--r-- | pkg/specgen/generate/storage.go | 8 | ||||
-rw-r--r-- | pkg/specgen/generate/validate.go | 6 | ||||
-rw-r--r-- | pkg/specgen/namespaces.go | 4 | ||||
-rw-r--r-- | pkg/specgen/pod_validate.go | 4 | ||||
-rw-r--r-- | pkg/specgen/volumes.go | 13 |
20 files changed, 73 insertions, 61 deletions
diff --git a/pkg/specgen/config_unsupported.go b/pkg/specgen/config_unsupported.go index 85ff1e9fd..3d89e49f8 100644 --- a/pkg/specgen/config_unsupported.go +++ b/pkg/specgen/config_unsupported.go @@ -3,7 +3,7 @@ package specgen import ( - "github.com/containers/podman/v2/libpod/image" + "github.com/containers/podman/v3/libpod/image" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) diff --git a/pkg/specgen/container_validate.go b/pkg/specgen/container_validate.go index 042e20e02..caea51ea8 100644 --- a/pkg/specgen/container_validate.go +++ b/pkg/specgen/container_validate.go @@ -4,9 +4,9 @@ import ( "strconv" "strings" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/util" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) diff --git a/pkg/specgen/generate/config_linux.go b/pkg/specgen/generate/config_linux.go index b9f024814..2792d0cb7 100644 --- a/pkg/specgen/generate/config_linux.go +++ b/pkg/specgen/generate/config_linux.go @@ -8,8 +8,8 @@ import ( "path/filepath" "strings" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/util" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-tools/generate" "github.com/pkg/errors" diff --git a/pkg/specgen/generate/config_linux_cgo.go b/pkg/specgen/generate/config_linux_cgo.go index 7a53cb01c..41f03d5b6 100644 --- a/pkg/specgen/generate/config_linux_cgo.go +++ b/pkg/specgen/generate/config_linux_cgo.go @@ -7,9 +7,9 @@ import ( "io/ioutil" goSeccomp "github.com/containers/common/pkg/seccomp" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/seccomp" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/seccomp" + "github.com/containers/podman/v3/pkg/specgen" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/pkg/specgen/generate/config_linux_nocgo.go b/pkg/specgen/generate/config_linux_nocgo.go index 184122aeb..0867988b6 100644 --- a/pkg/specgen/generate/config_linux_nocgo.go +++ b/pkg/specgen/generate/config_linux_nocgo.go @@ -5,8 +5,8 @@ package generate import ( "errors" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/specgen" spec "github.com/opencontainers/runtime-spec/specs-go" ) diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index f2af9dd5f..3d20ed8ff 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -6,12 +6,12 @@ import ( "strings" "github.com/containers/image/v5/manifest" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/image" - ann "github.com/containers/podman/v2/pkg/annotations" - envLib "github.com/containers/podman/v2/pkg/env" - "github.com/containers/podman/v2/pkg/signal" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/image" + ann "github.com/containers/podman/v3/pkg/annotations" + envLib "github.com/containers/podman/v3/pkg/env" + "github.com/containers/podman/v3/pkg/signal" + "github.com/containers/podman/v3/pkg/specgen" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 74291325c..03697b353 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -7,10 +7,10 @@ import ( "strings" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" "github.com/containers/storage" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" @@ -247,8 +247,9 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen. var vols []*libpod.ContainerOverlayVolume for _, v := range overlays { vols = append(vols, &libpod.ContainerOverlayVolume{ - Dest: v.Destination, - Source: v.Source, + Dest: v.Destination, + Source: v.Source, + Options: v.Options, }) } options = append(options, libpod.WithOverlayVolumes(vols)) diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index e04ced3d3..d61c8bd19 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -7,10 +7,10 @@ import ( "strings" "github.com/containers/common/pkg/parse" - "github.com/containers/podman/v2/libpod/image" - ann "github.com/containers/podman/v2/pkg/annotations" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod/image" + ann "github.com/containers/podman/v3/pkg/annotations" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" diff --git a/pkg/specgen/generate/kube/seccomp.go b/pkg/specgen/generate/kube/seccomp.go index 353f9cbf2..da15cf519 100644 --- a/pkg/specgen/generate/kube/seccomp.go +++ b/pkg/specgen/generate/kube/seccomp.go @@ -4,7 +4,7 @@ import ( "path/filepath" "strings" - "github.com/containers/podman/v2/libpod" + "github.com/containers/podman/v3/libpod" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" ) diff --git a/pkg/specgen/generate/kube/volume.go b/pkg/specgen/generate/kube/volume.go index c3241a49e..e4f3eb196 100644 --- a/pkg/specgen/generate/kube/volume.go +++ b/pkg/specgen/generate/kube/volume.go @@ -4,7 +4,7 @@ import ( "os" "github.com/containers/common/pkg/parse" - "github.com/containers/podman/v2/libpod" + "github.com/containers/podman/v3/libpod" "github.com/pkg/errors" "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go index f66ad6101..b87375a92 100644 --- a/pkg/specgen/generate/namespaces.go +++ b/pkg/specgen/generate/namespaces.go @@ -7,12 +7,12 @@ import ( "strings" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-tools/generate" "github.com/pkg/errors" diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index eefe45dfe..23a9ce831 100644 --- a/pkg/specgen/generate/oci.go +++ b/pkg/specgen/generate/oci.go @@ -5,11 +5,11 @@ import ( "strings" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/specgen" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-tools/generate" "github.com/pkg/errors" diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index 645bf7a47..5d7bf1930 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -3,8 +3,8 @@ package generate import ( "context" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/pkg/specgen" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/pkg/specgen/generate/ports.go b/pkg/specgen/generate/ports.go index 83ded059f..6cf83ed81 100644 --- a/pkg/specgen/generate/ports.go +++ b/pkg/specgen/generate/ports.go @@ -6,8 +6,8 @@ import ( "strconv" "strings" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/specgen" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/specgen" "github.com/cri-o/ocicni/pkg/ocicni" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/pkg/specgen/generate/security.go b/pkg/specgen/generate/security.go index fb45d87db..56aac8bfd 100644 --- a/pkg/specgen/generate/security.go +++ b/pkg/specgen/generate/security.go @@ -6,11 +6,11 @@ import ( "github.com/containers/common/pkg/apparmor" "github.com/containers/common/pkg/capabilities" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/define" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/define" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" "github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" diff --git a/pkg/specgen/generate/storage.go b/pkg/specgen/generate/storage.go index 63713726e..0bb1421f6 100644 --- a/pkg/specgen/generate/storage.go +++ b/pkg/specgen/generate/storage.go @@ -9,10 +9,10 @@ import ( "strings" "github.com/containers/common/pkg/config" - "github.com/containers/podman/v2/libpod" - "github.com/containers/podman/v2/libpod/image" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/libpod" + "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/pkg/util" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/pkg/specgen/generate/validate.go b/pkg/specgen/generate/validate.go index 77cccad3e..50efe7fa3 100644 --- a/pkg/specgen/generate/validate.go +++ b/pkg/specgen/generate/validate.go @@ -5,9 +5,9 @@ import ( "path/filepath" "github.com/containers/common/pkg/sysinfo" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/specgen" - "github.com/containers/podman/v2/utils" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/specgen" + "github.com/containers/podman/v3/utils" "github.com/pkg/errors" ) diff --git a/pkg/specgen/namespaces.go b/pkg/specgen/namespaces.go index 9d78a0210..fb7d65da4 100644 --- a/pkg/specgen/namespaces.go +++ b/pkg/specgen/namespaces.go @@ -3,8 +3,8 @@ package specgen import ( "strings" - "github.com/containers/podman/v2/pkg/cgroups" - "github.com/containers/podman/v2/pkg/rootless" + "github.com/containers/podman/v3/pkg/cgroups" + "github.com/containers/podman/v3/pkg/rootless" "github.com/pkg/errors" ) diff --git a/pkg/specgen/pod_validate.go b/pkg/specgen/pod_validate.go index c9bcdf623..c746bcd1a 100644 --- a/pkg/specgen/pod_validate.go +++ b/pkg/specgen/pod_validate.go @@ -1,8 +1,8 @@ package specgen import ( - "github.com/containers/podman/v2/pkg/rootless" - "github.com/containers/podman/v2/pkg/util" + "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" ) diff --git a/pkg/specgen/volumes.go b/pkg/specgen/volumes.go index 83634b4ef..d85d2bdd1 100644 --- a/pkg/specgen/volumes.go +++ b/pkg/specgen/volumes.go @@ -31,6 +31,8 @@ type OverlayVolume struct { Destination string `json:"destination"` // Source specifies the source path of the mount. Source string `json:"source,omitempty"` + // Options holds overlay volume options. + Options []string `json:"options,omitempty"` } // ImageVolume is a volume based on a container image. The container image is @@ -100,10 +102,17 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na if strings.HasPrefix(src, "/") || strings.HasPrefix(src, ".") { // This is not a named volume overlayFlag := false + chownFlag := false for _, o := range options { if o == "O" { overlayFlag = true - if len(options) > 1 { + + joinedOpts := strings.Join(options, "") + if strings.Contains(joinedOpts, "U") { + chownFlag = true + } + + if len(options) > 2 || (len(options) == 2 && !chownFlag) { return nil, nil, nil, errors.New("can't use 'O' with other options") } } @@ -113,6 +122,8 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na newOverlayVol := new(OverlayVolume) newOverlayVol.Destination = cleanDest newOverlayVol.Source = src + newOverlayVol.Options = options + if _, ok := overlayVolumes[newOverlayVol.Destination]; ok { return nil, nil, nil, errors.Wrapf(errDuplicateDest, newOverlayVol.Destination) } |