mirror of https://github.com/kubernetes/kops.git
fix: ignore additional instance types
This commit is contained in:
parent
0b9ab26862
commit
46b1c70b96
|
|
@ -94,15 +94,16 @@ func awsValidateAMIforNVMe(fieldPath *field.Path, ig *kops.InstanceGroup) field.
|
|||
allErrs := field.ErrorList{}
|
||||
|
||||
for _, prefix := range NVMe_INSTANCE_PREFIXES {
|
||||
if strings.Contains(strings.ToUpper(ig.Spec.MachineType), strings.ToUpper(prefix)) {
|
||||
glog.V(2).Infof("machineType %s requires an image based on stretch to operate. Trying to check compatibility", ig.Spec.MachineType)
|
||||
if strings.Contains(ig.Spec.Image, "jessie") {
|
||||
errString := fmt.Sprintf("%s cannot use machineType %s with image based on Debian jessie.", ig.Name, ig.Spec.MachineType)
|
||||
allErrs = append(allErrs, field.Forbidden(fieldPath, errString))
|
||||
continue
|
||||
for _, machineType := range strings.Split(ig.Spec.MachineType, ",") {
|
||||
if strings.Contains(strings.ToUpper(machineType), strings.ToUpper(prefix)) {
|
||||
glog.V(2).Infof("machineType %s requires an image based on stretch to operate. Trying to check compatibility", machineType)
|
||||
if strings.Contains(ig.Spec.Image, "jessie") {
|
||||
errString := fmt.Sprintf("%s cannot use machineType %s with image based on Debian jessie.", ig.Name, machineType)
|
||||
allErrs = append(allErrs, field.Forbidden(fieldPath, errString))
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package awsmodel
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
},
|
||||
IAMInstanceProfile: link,
|
||||
ImageID: s(ig.Spec.Image),
|
||||
InstanceType: s(ig.Spec.MachineType),
|
||||
InstanceType: s(strings.Split(ig.Spec.MachineType, ",")[0]),
|
||||
InstanceMonitoring: ig.Spec.DetailedInstanceMonitoring,
|
||||
|
||||
RootVolumeSize: i64(int64(volumeSize)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue