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 2fd2db2 commit 222879b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/apis/kops/validation/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,24 @@ 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
if action != "" {
found := false
validActions := []string{"ACCEPT", "DROP", "RETURN"}
for _, validAction := range validActions {
if action == validAction {
found = true
break
}
}
if !found {
return field.Invalid(fieldSpec.Child("Networking", "Canal", "DefaultEndpointToHostAction"), action, fmt.Sprintf("Supported values: %s", validActions))
}
}
}

// Check ClusterCIDR
if c.Spec.KubeControllerManager != nil {
var clusterCIDR *net.IPNet
Expand Down

0 comments on commit 222879b

Please sign in to comment.