From a57d49271355d63d058463e0b723180a3c463bad Mon Sep 17 00:00:00 2001 From: Andrew Pilloud Date: Thu, 28 Dec 2017 19:19:11 -0800 Subject: [PATCH] Move DefaultMaxEBSVolumes constant into scheduler A constant only used by the scheduler lives in the aws cloudprovider package. Moving the constant into the only package where it is used reduces import bloat. --- pkg/cloudprovider/providers/aws/aws.go | 5 ----- plugin/pkg/scheduler/algorithm/predicates/BUILD | 1 - plugin/pkg/scheduler/algorithm/predicates/predicates.go | 8 ++++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index 41a4a4b5041..2c2a953f117 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -247,11 +247,6 @@ const MaxReadThenCreateRetries = 30 // need hardcoded defaults. const DefaultVolumeType = "gp2" -// DefaultMaxEBSVolumes is the limit for volumes attached to an instance. -// Amazon recommends no more than 40; the system root volume uses at least one. -// See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html#linux-specific-volume-limits -const DefaultMaxEBSVolumes = 39 - // Used to call RecognizeWellKnownRegions just once var once sync.Once diff --git a/plugin/pkg/scheduler/algorithm/predicates/BUILD b/plugin/pkg/scheduler/algorithm/predicates/BUILD index ebaf3171942..ed72a2878a3 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/BUILD +++ b/plugin/pkg/scheduler/algorithm/predicates/BUILD @@ -19,7 +19,6 @@ go_library( deps = [ "//pkg/apis/core/v1/helper:go_default_library", "//pkg/apis/core/v1/helper/qos:go_default_library", - "//pkg/cloudprovider/providers/aws:go_default_library", "//pkg/features:go_default_library", "//pkg/kubelet/apis:go_default_library", "//pkg/volume/util:go_default_library", diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates.go b/plugin/pkg/scheduler/algorithm/predicates/predicates.go index eaac3e77b97..67c4caf7b45 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/predicates.go +++ b/plugin/pkg/scheduler/algorithm/predicates/predicates.go @@ -35,7 +35,6 @@ import ( "k8s.io/client-go/util/workqueue" v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper" v1qos "k8s.io/kubernetes/pkg/apis/core/v1/helper/qos" - "k8s.io/kubernetes/pkg/cloudprovider/providers/aws" "k8s.io/kubernetes/pkg/features" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" volumeutil "k8s.io/kubernetes/pkg/volume/util" @@ -68,6 +67,11 @@ const ( NoVolumeZoneConflictPred = "NoVolumeZoneConflict" CheckNodeMemoryPressurePred = "CheckNodeMemoryPressure" CheckNodeDiskPressurePred = "CheckNodeDiskPressure" + + // DefaultMaxEBSVolumes is the limit for volumes attached to an instance. + // Amazon recommends no more than 40; the system root volume uses at least one. + // See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html#linux-specific-volume-limits + DefaultMaxEBSVolumes = 39 // DefaultMaxGCEPDVolumes defines the maximum number of PD Volumes for GCE // GCE instances can have up to 16 PD volumes attached. DefaultMaxGCEPDVolumes = 16 @@ -283,7 +287,7 @@ func NewMaxPDVolumeCountPredicate(filterName string, pvInfo PersistentVolumeInfo case EBSVolumeFilterType: filter = EBSVolumeFilter - maxVolumes = getMaxVols(aws.DefaultMaxEBSVolumes) + maxVolumes = getMaxVols(DefaultMaxEBSVolumes) case GCEPDVolumeFilterType: filter = GCEPDVolumeFilter maxVolumes = getMaxVols(DefaultMaxGCEPDVolumes)