diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-21 12:42:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 12:42:32 -0400 |
commit | e3816ddb1185f83373725710ea91fc7ade5c4293 (patch) | |
tree | e8df01f9171fda81bdb121f89fc5cf59b32e035b /pkg/specgen/generate | |
parent | 782634334eaadb43e056571a57e76bd2ee9016f4 (diff) | |
parent | 117850e6eb6144d2c33f5ac94eb9b924c1103dbf (diff) | |
download | podman-e3816ddb1185f83373725710ea91fc7ade5c4293.tar.gz podman-e3816ddb1185f83373725710ea91fc7ade5c4293.tar.bz2 podman-e3816ddb1185f83373725710ea91fc7ade5c4293.zip |
Merge pull request #10992 from rhatdan/play
Fix handling of selinux labels in podman play kube
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r-- | pkg/specgen/generate/kube/kube.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index 37cacdaa3..fb7eb99a2 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -276,10 +276,11 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener return nil, err } + volume.MountPath = dest switch volumeSource.Type { case KubeVolumeTypeBindMount: mount := spec.Mount{ - Destination: dest, + Destination: volume.MountPath, Source: volumeSource.Source, Type: "bind", Options: options, @@ -287,7 +288,7 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener s.Mounts = append(s.Mounts, mount) case KubeVolumeTypeNamed: namedVolume := specgen.NamedVolume{ - Dest: dest, + Dest: volume.MountPath, Name: volumeSource.Source, Options: options, } @@ -330,12 +331,16 @@ func parseMountPath(mountPath string, readOnly bool) (string, []string, error) { options = strings.Split(splitVol[1], ",") } if err := parse.ValidateVolumeCtrDir(dest); err != nil { - return "", options, errors.Wrapf(err, "error in parsing MountPath") + return "", options, errors.Wrapf(err, "parsing MountPath") } if readOnly { options = append(options, "ro") } - return dest, options, nil + opts, err := parse.ValidateVolumeOpts(options) + if err != nil { + return "", opts, errors.Wrapf(err, "parsing MountOptions") + } + return dest, opts, nil } func setupLivenessProbe(s *specgen.SpecGenerator, containerYAML v1.Container, restartPolicy string) error { |