Skip to content

Commit

Permalink
Add missing machine type to Kubernetes provider (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludelafo authored Mar 30, 2023
1 parent 07ba810 commit 00d55e3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions iterative/kubernetes/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,15 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
// TODO: consider the use of an enumeration instead of a nested string map.
instanceTypes := make(map[string]map[string]map[string]string)
// Resource amounts mirror their AWS counterparts.
instanceTypes["s"] = map[string]map[string]string{
"accelerator": {
"count": "0",
"type": "",
"model": "",
},
"cores": {"count": "1"},
"memory": {"amount": "1Gi"},
}
instanceTypes["m"] = map[string]map[string]string{
"accelerator": {
"count": "0",
Expand Down Expand Up @@ -393,11 +402,11 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
}

size := instanceType

if instanceGPU != "" {
size += "+"+instanceGPU
size += "+" + instanceGPU
}

if val, ok := instanceTypes[size]; ok {
return val, nil
} else if val, ok := instanceTypes[instanceType]; ok {
Expand All @@ -413,15 +422,14 @@ func getInstanceType(instanceType string, instanceGPU string) (map[string]map[st
}, nil
}


if match := regexp.MustCompile(`^(\d+)-(\d+)(?:\+([^*]+)\*([1-9]\d*))?$`).FindStringSubmatch(size); match != nil {
return map[string]map[string]string{
"accelerator": {
"count": match[4],
"model": match[3],
"type": "nvidia.com/gpu",
},
"cores": {
"cores": {
"count": match[1],
},
"memory": {
Expand Down

0 comments on commit 00d55e3

Please sign in to comment.