summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
diff options
context:
space:
mode:
authorAshley Cui <acui@redhat.com>2020-09-10 14:56:47 -0400
committerAshley Cui <acui@redhat.com>2020-09-10 15:13:22 -0400
commit20f73b857f5974968cbcccce74fa5a5ec16a74ef (patch)
treecc32a8a79932cb70ca598df29752aa395a1aa9b9 /pkg/domain/infra/abi
parentbe7778df6c70227dab760ea92637ed97dad29641 (diff)
downloadpodman-20f73b857f5974968cbcccce74fa5a5ec16a74ef.tar.gz
podman-20f73b857f5974968cbcccce74fa5a5ec16a74ef.tar.bz2
podman-20f73b857f5974968cbcccce74fa5a5ec16a74ef.zip
Add read-only mount to play kube
add support for read-only volume mounts in podman play kube Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/play.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 31ad51672..47d1c48f2 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -556,6 +556,7 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container
containerConfig.Env = envs
for _, volume := range containerYAML.VolumeMounts {
+ var readonly string
hostPath, exists := volumes[volume.Name]
if !exists {
return nil, errors.Errorf("Volume mount %s specified for container but not configured in volumes", volume.Name)
@@ -563,7 +564,10 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container
if err := parse.ValidateVolumeCtrDir(volume.MountPath); err != nil {
return nil, errors.Wrapf(err, "error in parsing MountPath")
}
- containerConfig.Volumes = append(containerConfig.Volumes, fmt.Sprintf("%s:%s", hostPath, volume.MountPath))
+ if volume.ReadOnly {
+ readonly = ":ro"
+ }
+ containerConfig.Volumes = append(containerConfig.Volumes, fmt.Sprintf("%s:%s%s", hostPath, volume.MountPath, readonly))
}
return &containerConfig, nil
}