mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Merge pull request #88602 from yuga711/pd-limit
Fix to expose max gce-pd disks per instance
This commit is contained in:
commit
a555825ab4
@ -25,7 +25,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
"k8s.io/utils/mount"
|
"k8s.io/utils/mount"
|
||||||
@ -65,13 +64,13 @@ 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/machine-types
|
||||||
// These constants are all the documented attach limit minus one because the
|
// 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
|
// node boot disk is considered an attachable disk so effective attach limit is
|
||||||
// one less.
|
// one less.
|
||||||
const (
|
const (
|
||||||
volumeLimitSmall = 15
|
volumeLimitSmall = 15
|
||||||
VolumeLimitBig = 127
|
volumeLimitBig = 127
|
||||||
)
|
)
|
||||||
|
|
||||||
func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
|
func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
|
||||||
@ -149,12 +148,14 @@ func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, erro
|
|||||||
klog.Errorf("Failed to get instance type from GCE cloud provider")
|
klog.Errorf("Failed to get instance type from GCE cloud provider")
|
||||||
return volumeLimits, nil
|
return volumeLimits, nil
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(instanceType, "n1-") || strings.HasPrefix(instanceType, "custom-") {
|
smallMachineTypes := []string{"f1-micro", "g1-small", "e2-micro", "e2-small", "e2-medium"}
|
||||||
volumeLimits[util.GCEVolumeLimitKey] = VolumeLimitBig
|
for _, small := range smallMachineTypes {
|
||||||
} else {
|
if instanceType == small {
|
||||||
volumeLimits[util.GCEVolumeLimitKey] = volumeLimitSmall
|
volumeLimits[util.GCEVolumeLimitKey] = volumeLimitSmall
|
||||||
|
return volumeLimits, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
volumeLimits[util.GCEVolumeLimitKey] = volumeLimitBig
|
||||||
return volumeLimits, nil
|
return volumeLimits, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user