Skip to content

Commit

Permalink
Merge pull request kubernetes#5610 from jayantjain93/fallback-machine…
Browse files Browse the repository at this point in the history
…-family

GCE: Fallback f1 and g1 machine families to n1
  • Loading branch information
k8s-ci-robot authored Mar 22, 2023
2 parents 241643d + 9f8916d commit 543fb03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cluster-autoscaler/cloudprovider/gce/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func GetMachineFamily(machineType string) (string, error) {
if len(parts) < 2 {
return "", fmt.Errorf("unable to parse machine type %q", machineType)
}
if parts[0] == "custom" {
if parts[0] == "custom" || parts[0] == "f1" || parts[0] == "g1" {
return "n1", nil
}
return parts[0], nil
Expand Down
8 changes: 8 additions & 0 deletions cluster-autoscaler/cloudprovider/gce/machine_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ func TestGetMachineFamily(t *testing.T) {
machineType: "e2-small",
wantFamily: "e2",
},
"fallback f1 family to n1": {
machineType: "f1-micro",
wantFamily: "n1",
},
"fallback g1 family to n1": {
machineType: "g1-small",
wantFamily: "n1",
},
"custom machine type with family prefix": {
machineType: "n2-custom-2-2816",
wantFamily: "n2",
Expand Down

0 comments on commit 543fb03

Please sign in to comment.