Add scheduler predicate to filter for max Azure disks attached

This commit is contained in:
Alexander Block
2017-02-02 17:32:02 +01:00
parent b3d627c2e2
commit 73a0083a84
3 changed files with 37 additions and 3 deletions

View File

@@ -36,9 +36,11 @@ import (
const (
// GCE instances can have up to 16 PD volumes attached.
DefaultMaxGCEPDVolumes = 16
ClusterAutoscalerProvider = "ClusterAutoscalerProvider"
StatefulSetKind = "StatefulSet"
DefaultMaxGCEPDVolumes = 16
// Larger Azure VMs can actually have much more disks attached. TODO We should determine the max based on VM size
DefaultMaxAzureDiskVolumes = 16
ClusterAutoscalerProvider = "ClusterAutoscalerProvider"
StatefulSetKind = "StatefulSet"
)
func init() {
@@ -136,6 +138,15 @@ func defaultPredicates() sets.String {
return predicates.NewMaxPDVolumeCountPredicate(predicates.GCEPDVolumeFilter, maxVols, args.PVInfo, args.PVCInfo)
},
),
// Fit is determined by whether or not there would be too many Azure Disk volumes attached to the node
factory.RegisterFitPredicateFactory(
"MaxAzureDiskVolumeCount",
func(args factory.PluginFactoryArgs) algorithm.FitPredicate {
// TODO: allow for generically parameterized scheduler predicates, because this is a bit ugly
maxVols := getMaxVols(DefaultMaxAzureDiskVolumes)
return predicates.NewMaxPDVolumeCountPredicate(predicates.AzureDiskVolumeFilter, maxVols, args.PVInfo, args.PVCInfo)
},
),
// Fit is determined by inter-pod affinity.
factory.RegisterFitPredicateFactory(
"MatchInterPodAffinity",