mv HasMountRefs from mount pkg to vol/util
HasMountRefs is only used internal to K8s and should not be moved out with the mount package. move it to pkg/volume/util instead.
This commit is contained in:
@@ -576,3 +576,20 @@ func addContainerVolumes(containers []v1.Container, mounts, devices sets.String)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HasMountRefs checks if the given mountPath has mountRefs.
|
||||
// TODO: this is a workaround for the unmount device issue caused by gci mounter.
|
||||
// In GCI cluster, if gci mounter is used for mounting, the container started by mounter
|
||||
// script will cause additional mounts created in the container. Since these mounts are
|
||||
// irrelevant to the original mounts, they should be not considered when checking the
|
||||
// mount references. Current solution is to filter out those mount paths that contain
|
||||
// the string of original mount path.
|
||||
// Plan to work on better approach to solve this issue.
|
||||
func HasMountRefs(mountPath string, mountRefs []string) bool {
|
||||
for _, ref := range mountRefs {
|
||||
if !strings.Contains(ref, mountPath) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user