mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 05:36:12 +00:00
scheduler: fast check when there is no conflicts
This commit is contained in:
@@ -73,9 +73,13 @@ func (c *CachedNodeInfo) GetNodeInfo(id string) (*api.Node, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isVolumeConflict(volume api.Volume, pod *api.Pod) bool {
|
func isVolumeConflict(volume api.Volume, pod *api.Pod) bool {
|
||||||
|
// fast path if there is no conflict checking targets.
|
||||||
|
if volume.GCEPersistentDisk == nil && volume.AWSElasticBlockStore == nil && volume.RBD == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
for _, existingVolume := range pod.Spec.Volumes {
|
for _, existingVolume := range pod.Spec.Volumes {
|
||||||
// Same GCE Disk can be mounted as read-only by multiple pod simultaneously.
|
// Same GCE disk mounted by multiple pods conflicts unless all pods mount it read-only.
|
||||||
// Or they conflicts
|
|
||||||
if volume.GCEPersistentDisk != nil && existingVolume.GCEPersistentDisk != nil {
|
if volume.GCEPersistentDisk != nil && existingVolume.GCEPersistentDisk != nil {
|
||||||
disk, existingDisk := volume.GCEPersistentDisk, existingVolume.GCEPersistentDisk
|
disk, existingDisk := volume.GCEPersistentDisk, existingVolume.GCEPersistentDisk
|
||||||
if disk.PDName == existingDisk.PDName && !(disk.ReadOnly && existingDisk.ReadOnly) {
|
if disk.PDName == existingDisk.PDName && !(disk.ReadOnly && existingDisk.ReadOnly) {
|
||||||
|
Reference in New Issue
Block a user