Skip to content

Commit

Permalink
Handle gracefully empty arch in kube env.
Browse files Browse the repository at this point in the history
  • Loading branch information
olagacek committed Jun 15, 2022
1 parent ccd9b6b commit 8396c7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cluster-autoscaler/cloudprovider/gce/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ func ToSystemArchitecture(arch string) SystemArchitecture {
return Arm64
case string(Amd64):
return Amd64
case "":
return DefaultArch
default:
return UnknownArch
}
Expand Down
9 changes: 9 additions & 0 deletions cluster-autoscaler/cloudprovider/gce/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ func TestBuildNodeFromTemplateSetsResources(t *testing.T) {
attachedLocalSSDCount: 4,
expectedErr: false,
},
{
scenario: "handle empty arch gracefully",
kubeEnv: "AUTOSCALER_ENV_VARS: os_distribution=cos;arch=;os=linux;ephemeral_storage_local_ssd_count=2\n",
physicalCpu: 8,
physicalMemory: 200 * units.MiB,
ephemeralStorageLocalSSDCount: 2,
attachedLocalSSDCount: 4,
expectedErr: false,
},
{
scenario: "ephemeral storage on local SSDs with kube-reserved",
kubeEnv: "AUTOSCALER_ENV_VARS: kube_reserved=cpu=0,memory=0,ephemeral-storage=10Gi;os_distribution=cos;os=linux;ephemeral_storage_local_ssd_count=2\n",
Expand Down

0 comments on commit 8396c7e

Please sign in to comment.