From b01e2a387d015b36527fa5dc6d4fc6afe764f571 Mon Sep 17 00:00:00 2001 From: Jing Xu Date: Tue, 23 Apr 2019 19:14:31 -0700 Subject: [PATCH] Update the dynamic volume limit in GCE PD Currently GCE PD support 128 maximum disks attached to a node for all machines types except shared-core. This PR updates the limit number to date. Change-Id: Id9dfdbd24763b6b4138935842c246b1803838b78 --- pkg/volume/gcepd/gce_pd.go | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/pkg/volume/gcepd/gce_pd.go b/pkg/volume/gcepd/gce_pd.go index b48fc283d5..82d9d7ae22 100644 --- a/pkg/volume/gcepd/gce_pd.go +++ b/pkg/volume/gcepd/gce_pd.go @@ -64,11 +64,7 @@ const ( // persistent disks that can be attached to an instance. Please refer to gcloud doc // https://cloud.google.com/compute/docs/disks/#increased_persistent_disk_limits const ( - OneCPU = 1 - EightCPUs = 8 VolumeLimit16 = 16 - VolumeLimit32 = 32 - VolumeLimit64 = 64 VolumeLimit128 = 128 ) @@ -152,22 +148,12 @@ func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, erro klog.Errorf("Failed to get instance type from GCE cloud provider") return volumeLimits, nil } - if strings.HasPrefix(instanceType, "n1-") { - splits := strings.Split(instanceType, "-") - if len(splits) < 3 { - return volumeLimits, nil - } - last := splits[2] - if num, err := strconv.Atoi(last); err == nil { - if num == OneCPU { - volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit32 - } else if num < EightCPUs { - volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit64 - } else { - volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit128 - } - } + if strings.HasPrefix(instanceType, "n1-") || strings.HasPrefix(instanceType, "custom-") { + volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit128 + } else { + volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit16 } + return volumeLimits, nil }