diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go index db068db..43d692b 100644 --- a/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_address.go @@ -32,7 +32,7 @@ func (r *dynamicAddressSyntaxValidator) Validate(claim *IPClaim) field.ErrorList ipPrefixType := claim.GetIPPrefixType() if ipPrefixType == IPPrefixType_Invalid { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), + field.NewPath("spec.prefixType"), claim, fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), )) diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go index ece850e..bf76233 100644 --- a/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_dynamic_prefix.go @@ -32,7 +32,7 @@ func (r *dynamicPrefixSyntaxValidator) Validate(claim *IPClaim) field.ErrorList ipPrefixType := claim.GetIPPrefixType() if ipPrefixType == IPPrefixType_Invalid { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), + field.NewPath("spec.prefixType"), claim, fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), )) diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go b/apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go index 14146fc..a83c333 100644 --- a/apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_static_prefix.go @@ -62,7 +62,7 @@ func (r *staticPrefixSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { ipPrefixType := claim.GetIPPrefixType() if ipPrefixType == IPPrefixType_Invalid { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), + field.NewPath("spec.prefixType"), claim, fmt.Errorf("%s, invalid claim type, got %s", r.name, string(ipPrefixType)).Error(), )) @@ -80,14 +80,14 @@ func (r *staticPrefixSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { if claim.Spec.DefaultGateway != nil { if ipPrefixType != IPPrefixType_Network { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), + field.NewPath("spec.defaultGateway"), claim, fmt.Errorf("%s cannot have a defaultGateway on a prefix which is not a network type", r.name).Error(), )) } if !pi.IsNorLastNorFirst() { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.prefix"), + field.NewPath("spec.defaultGateway"), claim, fmt.Errorf("%s cannot have a defaultGateway on a prefix which is the first or last ip in the prefix", r.name).Error(), )) diff --git a/apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go b/apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go index 8cf5602..7a97500 100644 --- a/apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go +++ b/apis/backend/ipam/ipclaim_syntaxvalidator_static_range.go @@ -46,7 +46,7 @@ func (r *staticRangeSyntaxValidator) Validate(claim *IPClaim) field.ErrorList { ipPrefixType := claim.GetIPPrefixType() if ipPrefixType != IPPrefixType_Regular { allErrs = append(allErrs, field.Invalid( - field.NewPath("spec.type"), + field.NewPath("spec.prefixType"), claim, fmt.Errorf("%s invalid claim, expecting %s, got %s", r.name, string(IPPrefixType_Regular), string(ipPrefixType)).Error(), )) diff --git a/examples/ipam/index-vpc3.yaml b/examples/ipam/index-vpc3.yaml new file mode 100644 index 0000000..03fb288 --- /dev/null +++ b/examples/ipam/index-vpc3.yaml @@ -0,0 +1,9 @@ +apiVersion: ipam.be.kuid.dev/v1alpha1 +kind: IPIndex +metadata: + name: vpc3 + namespace: default +spec: + prefixes: + - prefix: 10.0.0.0/8 + prefixType: network \ No newline at end of file