From 379a8c8c7105f66af60572000a00a9d7d11e5e68 Mon Sep 17 00:00:00 2001 From: Kris Childress Date: Mon, 21 Nov 2016 07:35:07 -0700 Subject: [PATCH] Adding backwards support for non-topology validation --- pkg/apis/kops/validation.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/apis/kops/validation.go b/pkg/apis/kops/validation.go index be62bbb49ae4c..2ebc5b2efdb69 100644 --- a/pkg/apis/kops/validation.go +++ b/pkg/apis/kops/validation.go @@ -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")