Merge pull request #965 from DualSpark/patch-panic-validation

Adding backwards support for non-topology validation
This commit is contained in:
Chris Love 2016-11-21 07:55:52 -07:00 committed by GitHub
commit 4308340ed2
1 changed files with 12 additions and 0 deletions

View File

@ -293,6 +293,18 @@ func (c *Cluster) Validate(strict bool) error {
}
// Topology support
if c.Spec.Topology == nil {
// This is a case of an older cluster making changes with newer code.. Adding this in for backwards
// compatibility.. Putting this in validation because it can be called from a few places in the code
// base.. all of which make the assumption that the validation should work for their current
// representation of the cluster..
// @kris-nova
// #960
// #943
c.Spec.Topology = &TopologySpec{Masters: TopologyPublic, Nodes: TopologyPublic}
}
if c.Spec.Topology.Masters != "" && c.Spec.Topology.Nodes != "" {
if c.Spec.Topology.Masters != TopologyPublic && c.Spec.Topology.Masters != TopologyPrivate {
return fmt.Errorf("Invalid Masters value for Topology")