Skip to content

Commit

Permalink
Added validation to Networking Canal spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
KashifSaadat committed Aug 26, 2017
1 parent 4ea68dd commit f254a06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/apis/kops/validation/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ func ValidateCluster(c *kops.Cluster, strict bool) *field.Error {
}
}

// Check Canal Networking Spec if used
if c.Spec.Networking.Canal != nil {
action := c.Spec.Networking.Canal.DefaultEndpointToHostAction
switch action {
case "", "ACCEPT", "DROP", "RETURN":
default:
return field.Invalid(fieldSpec.Child("Networking", "Canal", "DefaultEndpointToHostAction"), action, fmt.Sprintf("Unsupported value: %s, supports ACCEPT, DROP or RETURN", action))
}
}

// Check ClusterCIDR
if c.Spec.KubeControllerManager != nil {
var clusterCIDR *net.IPNet
Expand Down
2 changes: 2 additions & 0 deletions upup/pkg/fi/cloudup/populatecluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func buildMinimalCluster() *api.Cluster {
// TODO: Mock cloudprovider
c.Spec.DNSZone = "test.com"

c.Spec.Networking = &api.NetworkingSpec{}

return c
}

Expand Down

0 comments on commit f254a06

Please sign in to comment.