mirror of
https://github.com/containers/podman.git
synced 2025-06-19 16:33:24 +08:00
Merge pull request #21084 from ygalblum/kube-generate-bind-mount-annotation
Kube Generate - check options in bind-mount-options exist before accessing
This commit is contained in:
@ -488,7 +488,7 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
|
|||||||
// Make sure the z/Z option is not already there (from editing the YAML)
|
// Make sure the z/Z option is not already there (from editing the YAML)
|
||||||
if k == define.BindMountPrefix {
|
if k == define.BindMountPrefix {
|
||||||
lastIndex := strings.LastIndex(v, ":")
|
lastIndex := strings.LastIndex(v, ":")
|
||||||
if v[:lastIndex] == volumeSource.Source && !cutil.StringInSlice("z", options) && !cutil.StringInSlice("Z", options) {
|
if lastIndex != -1 && v[:lastIndex] == volumeSource.Source && !cutil.StringInSlice("z", options) && !cutil.StringInSlice("Z", options) {
|
||||||
options = append(options, v[lastIndex+1:])
|
options = append(options, v[lastIndex+1:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user