@@ -25,7 +25,6 @@ import (
25
25
"path/filepath"
26
26
"runtime"
27
27
"strconv"
28
- "strings"
29
28
30
29
"k8s.io/klog"
31
30
"k8s.io/utils/mount"
@@ -65,13 +64,13 @@ const (
65
64
66
65
// The constants are used to map from the machine type (number of CPUs) to the limit of
67
66
// persistent disks that can be attached to an instance. Please refer to gcloud doc
68
- // https://cloud.google.com/compute/docs/disks/#increased_persistent_disk_limits
67
+ // https://cloud.google.com/compute/docs/machine-types
69
68
// These constants are all the documented attach limit minus one because the
70
69
// node boot disk is considered an attachable disk so effective attach limit is
71
70
// one less.
72
71
const (
73
72
volumeLimitSmall = 15
74
- VolumeLimitBig = 127
73
+ volumeLimitBig = 127
75
74
)
76
75
77
76
func getPath (uid types.UID , volName string , host volume.VolumeHost ) string {
@@ -149,12 +148,14 @@ func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, erro
149
148
klog .Errorf ("Failed to get instance type from GCE cloud provider" )
150
149
return volumeLimits , nil
151
150
}
152
- if strings .HasPrefix (instanceType , "n1-" ) || strings .HasPrefix (instanceType , "custom-" ) {
153
- volumeLimits [util .GCEVolumeLimitKey ] = VolumeLimitBig
154
- } else {
155
- volumeLimits [util .GCEVolumeLimitKey ] = volumeLimitSmall
151
+ smallMachineTypes := []string {"f1-micro" , "g1-small" , "e2-micro" , "e2-small" , "e2-medium" }
152
+ for _ , small := range smallMachineTypes {
153
+ if instanceType == small {
154
+ volumeLimits [util .GCEVolumeLimitKey ] = volumeLimitSmall
155
+ return volumeLimits , nil
156
+ }
156
157
}
157
-
158
+ volumeLimits [ util . GCEVolumeLimitKey ] = volumeLimitBig
158
159
return volumeLimits , nil
159
160
}
160
161
0 commit comments