summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-11 05:32:42 -0400
committerGitHub <noreply@github.com>2020-09-11 05:32:42 -0400
commit26fb8d2cdea8b16e7163bfd0daa5843aad0fdc9d (patch)
treed69e844a9681657ff5784c8134cf1356a7c30dbf /pkg
parent2bdb177b5525931c2363507cd5b23f8efb169144 (diff)
parent20f73b857f5974968cbcccce74fa5a5ec16a74ef (diff)
downloadpodman-26fb8d2cdea8b16e7163bfd0daa5843aad0fdc9d.tar.gz
podman-26fb8d2cdea8b16e7163bfd0daa5843aad0fdc9d.tar.bz2
podman-26fb8d2cdea8b16e7163bfd0daa5843aad0fdc9d.zip
Merge pull request #7586 from ashley-cui/rokube
Add read-only volume mount to play kube
Diffstat (limited to 'pkg')
-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
}