Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #80923: Reduce GCE PD Attach Limits by 1 because Node Boot Disk #80926

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pkg/volume/gcepd/gce_pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ const (
// 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
// 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 (
VolumeLimit16 = 16
VolumeLimit128 = 128
volumeLimitSmall = 15
VolumeLimitBig = 127
)

func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
Expand Down Expand Up @@ -121,7 +124,7 @@ func (plugin *gcePersistentDiskPlugin) GetAccessModes() []v1.PersistentVolumeAcc

func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, error) {
volumeLimits := map[string]int64{
util.GCEVolumeLimitKey: VolumeLimit16,
util.GCEVolumeLimitKey: volumeLimitSmall,
}
cloud := plugin.host.GetCloudProvider()

Expand Down Expand Up @@ -149,9 +152,9 @@ func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, erro
return volumeLimits, nil
}
if strings.HasPrefix(instanceType, "n1-") || strings.HasPrefix(instanceType, "custom-") {
volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit128
volumeLimits[util.GCEVolumeLimitKey] = VolumeLimitBig
} else {
volumeLimits[util.GCEVolumeLimitKey] = VolumeLimit16
volumeLimits[util.GCEVolumeLimitKey] = volumeLimitSmall
}

return volumeLimits, nil
Expand Down