summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-02 20:12:25 +0200
committerGitHub <noreply@github.com>2022-09-02 20:12:25 +0200
commitc5da5e459a36c4a64a6f9de777ea791aac0998b2 (patch)
tree3de8514db28352fe64e633ca7f9e04a24285b706 /pkg/specgen
parent0e66f75f2a6d3792ae7fd2d77fe8a55b6fbdb0ce (diff)
parent4a1acccf965362eb315b38f9b2cb35a8564aa173 (diff)
downloadpodman-c5da5e459a36c4a64a6f9de777ea791aac0998b2.tar.gz
podman-c5da5e459a36c4a64a6f9de777ea791aac0998b2.tar.bz2
podman-c5da5e459a36c4a64a6f9de777ea791aac0998b2.zip
Merge pull request #15599 from umohnani8/gen-kube
Fix bind-mount-option annotation in gen/play kube
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/kube/kube.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 375b719d3..5862d3f1c 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -357,8 +357,11 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
// a selinux mount option exists for it
for k, v := range opts.Annotations {
// Make sure the z/Z option is not already there (from editing the YAML)
- if strings.Replace(k, define.BindMountPrefix, "", 1) == volumeSource.Source && !cutil.StringInSlice("z", options) && !cutil.StringInSlice("Z", options) {
- options = append(options, v)
+ if k == define.BindMountPrefix {
+ lastIndex := strings.LastIndex(v, ":")
+ if v[:lastIndex] == volumeSource.Source && !cutil.StringInSlice("z", options) && !cutil.StringInSlice("Z", options) {
+ options = append(options, v[lastIndex+1:])
+ }
}
}
mount := spec.Mount{