Skip to content

Commit

Permalink
azure/validation: some memory values are float and not int
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuever committed Jan 8, 2021
1 parent 6bbe71a commit 62703ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/asset/installconfig/azure/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ func ValidateInstanceType(client API, fieldPath *field.Path, region, instanceTyp
for _, capability := range *typeMeta.Capabilities {

if strings.EqualFold(*capability.Name, "vCPUs") {
cpus, err := strconv.ParseInt(*capability.Value, 10, 0)
cpus, err := strconv.ParseFloat(*capability.Value, 0)
if err != nil {
return append(allErrs, field.InternalError(fieldPath, err))
}
if cpus < req.minimumVCpus {
if cpus < float64(req.minimumVCpus) {
errMsg := fmt.Sprintf("instance type does not meet minimum resource requirements of %d vCPUs", req.minimumVCpus)
allErrs = append(allErrs, field.Invalid(fieldPath.Child("type"), instanceType, errMsg))
}
} else if strings.EqualFold(*capability.Name, "MemoryGB") {
memory, err := strconv.ParseInt(*capability.Value, 10, 0)
memory, err := strconv.ParseFloat(*capability.Value, 0)
if err != nil {
return append(allErrs, field.InternalError(fieldPath, err))
}
if memory < req.minimumMemory {
if memory < float64(req.minimumMemory) {
errMsg := fmt.Sprintf("instance type does not meet minimum resource requirements of %d GB Memory", req.minimumMemory)
allErrs = append(allErrs, field.Invalid(fieldPath.Child("type"), instanceType, errMsg))
}
Expand Down

0 comments on commit 62703ab

Please sign in to comment.