Merge pull request #80923 from davidz627/fix/pdAttachLimit

Reduce GCE PD Attach Limits by 1 because Node Boot Disk counts as 1 attached disk
This commit is contained in:
Kubernetes Prow Robot 2019-08-03 01:27:51 -07:00 committed by GitHub
commit 5c16a784c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,9 +63,12 @@ const (
// The constants are used to map from the machine type (number of CPUs) to the limit of // The constants are used to map from the machine type (number of CPUs) to the limit of
// persistent disks that can be attached to an instance. Please refer to gcloud doc // 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 // https://cloud.google.com/compute/docs/disks/#increased_persistent_disk_limits
// These constants are all the documented attach limit minus one because the
// node boot disk is considered an attachable disk so effective attach limit is
// one less.
const ( const (
VolumeLimit16 = 16 volumeLimitSmall = 15
VolumeLimit128 = 128 VolumeLimitBig = 127
) )
func getPath(uid types.UID, volName string, host volume.VolumeHost) string { func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
@ -121,7 +124,7 @@ func (plugin *gcePersistentDiskPlugin) GetAccessModes() []v1.PersistentVolumeAcc
func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, error) { func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, error) {
volumeLimits := map[string]int64{ volumeLimits := map[string]int64{
util.GCEVolumeLimitKey: VolumeLimit16, util.GCEVolumeLimitKey: volumeLimitSmall,
} }
cloud := plugin.host.GetCloudProvider() cloud := plugin.host.GetCloudProvider()
@ -149,9 +152,9 @@ func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, erro
return volumeLimits, nil return volumeLimits, nil
} }
if strings.HasPrefix(instanceType, "n1-") || strings.HasPrefix(instanceType, "custom-") { if strings.HasPrefix(instanceType, "n1-") || strings.HasPrefix(instanceType, "custom-") {
volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit128 volumeLimits[util.GCEVolumeLimitKey] = VolumeLimitBig
} else { } else {
volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit16 volumeLimits[util.GCEVolumeLimitKey] = volumeLimitSmall
} }
return volumeLimits, nil return volumeLimits, nil