Merge pull request #1990 from kunalkushwaha/bugfix-NamedVolumeCheck

condition fixed for adding volume to boltdb.
This commit is contained in:
OpenShift Merge Robot 2018-12-13 06:51:26 -08:00 committed by GitHub
commit d8d3950dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -565,10 +565,12 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error {
}
// Add container to volume dependencies bucket if container is using a named volume
if ctr.runtime.config.VolumePath == "" {
return nil
}
for _, vol := range ctr.config.Spec.Mounts {
if strings.Contains(vol.Source, ctr.runtime.config.VolumePath) {
volName := strings.Split(vol.Source[len(ctr.runtime.config.VolumePath)+1:], "/")[0]
volDB := volBkt.Bucket([]byte(volName))
if volDB == nil {
return errors.Wrapf(ErrNoSuchVolume, "no volume with name %s found in database", volName)