- adding a validation check on the deviceName for the additional volumes

- locking the feature down to aws only for now
This commit is contained in:
Rohith 2018-11-09 23:11:11 +00:00
parent bf69871a8b
commit 1774ce5861
2 changed files with 13 additions and 0 deletions

View File

@ -88,6 +88,12 @@ func ValidateInstanceGroup(g *kops.InstanceGroup) error {
}
}
for i, x := range g.Spec.Volumes {
if x.DeviceName == nil {
return field.Invalid(field.NewPath("volumes").Index(i).Child("deviceName"), "", "volume must have a device name")
}
}
if err := validateInstanceProfile(g.Spec.IAM, field.NewPath("iam")); err != nil {
return err
}

View File

@ -17,6 +17,7 @@ limitations under the License.
package validation
import (
"errors"
"fmt"
"net"
"strings"
@ -801,6 +802,12 @@ func DeepValidate(c *kops.Cluster, groups []*kops.InstanceGroup, strict bool) er
if len(errs) != 0 {
return errs[0]
}
default:
for _, x := range groups {
if len(x.Spec.Volumes) > 0 {
return errors.New("instancegroup volumes are only available with aws at present")
}
}
}
}