diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-11 05:32:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 05:32:42 -0400 |
commit | 26fb8d2cdea8b16e7163bfd0daa5843aad0fdc9d (patch) | |
tree | d69e844a9681657ff5784c8134cf1356a7c30dbf /pkg/domain/infra/abi | |
parent | 2bdb177b5525931c2363507cd5b23f8efb169144 (diff) | |
parent | 20f73b857f5974968cbcccce74fa5a5ec16a74ef (diff) | |
download | podman-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/domain/infra/abi')
-rw-r--r-- | pkg/domain/infra/abi/play.go | 6 |
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 } |