Skip to content

Commit

Permalink
Allow any CIDR range on the api/operator whitelist (#2363)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8d31e85)
  • Loading branch information
RobertLucian authored and deliahu committed Jul 21, 2021
1 parent a2e7cca commit 0796f2f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/types/clusterconfig/cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ var CoreConfigStructFieldValidations = []*cr.StructFieldValidation{
{
StructField: "VPCCIDR",
StringPtrValidation: &cr.StringPtrValidation{
Validator: validateCIDR,
Validator: validateVPCCIDR,
},
},
}
Expand Down Expand Up @@ -1470,6 +1470,15 @@ func (ng *NodeGroup) FillEmptySpotFields(region string) {
}

func validateCIDR(cidr string) (string, error) {
_, _, err := net.ParseCIDR(cidr)
if err != nil {
return "", errors.WithStack(err)
}

return cidr, nil
}

func validateVPCCIDR(cidr string) (string, error) {
_, network, err := net.ParseCIDR(cidr)
if err != nil {
return "", errors.WithStack(err)
Expand Down

0 comments on commit 0796f2f

Please sign in to comment.