-
Notifications
You must be signed in to change notification settings - Fork 526
Allow non-canonical IPv6 addresses in DNSRecord
validation.
#12667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow non-canonical IPv6 addresses in DNSRecord
validation.
#12667
Conversation
Previously, the validation of `DNSRecord` resources checked the validity of IP addresses using a helper function from kubernetes. However, this function disallows non-canonical IPv6 addresses, e.g. 2001:db8:0:0:0:0:0:1. Unfortunately, there are some infrastructures, e.g. GCP, which use non-canonical IPv6 addresses for resources like load balancers. It also seems reasonable to allow them in `DNSRecord` resources. This change adapts the validation accordingly so that non-canonical IPv6 addresses are allowed.
/lgtm |
LGTM label has been added. Git tree hash: 07c2cd00c42347e99213be9b5e285ce01eb7cc28
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of this out and adding the unit test so it's not regressed in the future.
Potentially, I think you could also use
diff --git a/pkg/apis/extensions/validation/dnsrecord.go b/pkg/apis/extensions/validation/dnsrecord.go
index d6a0ba09d3..83aff88b26 100644
--- a/pkg/apis/extensions/validation/dnsrecord.go
+++ b/pkg/apis/extensions/validation/dnsrecord.go
@@ -113,7 +113,7 @@ func validateValue(recordType extensionsv1alpha1.DNSRecordType, value string, fl
switch recordType {
case extensionsv1alpha1.DNSRecordTypeA, extensionsv1alpha1.DNSRecordTypeAAAA:
- allErrs = append(allErrs, isValidIP(fldPath, value)...)
+ allErrs = append(allErrs, validation.IsValidIPForLegacyField(fldPath, value, false, nil)...)
case extensionsv1alpha1.DNSRecordTypeCNAME:
allErrs = append(allErrs, validation.IsFullyQualifiedDomainName(fldPath, value)...)
}
Yes, |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: plkokanov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…er#12667) Previously, the validation of `DNSRecord` resources checked the validity of IP addresses using a helper function from kubernetes. However, this function disallows non-canonical IPv6 addresses, e.g. 2001:db8:0:0:0:0:0:1. Unfortunately, there are some infrastructures, e.g. GCP, which use non-canonical IPv6 addresses for resources like load balancers. It also seems reasonable to allow them in `DNSRecord` resources. This change adapts the validation accordingly so that non-canonical IPv6 addresses are allowed.
How to categorize this PR?
/area networking
/area robustness
/area control-plane
/kind enhancement
What this PR does / why we need it:
Allow non-canonical IPv6 addresses in
DNSRecord
validation.Previously, the validation of
DNSRecord
resources checked the validity of IP addresses using a helper function from kubernetes. However, this function disallows non-canonical IPv6 addresses, e.g. 2001:db8:0:0:0:0:0:1. Unfortunately, there are some infrastructures, e.g. GCP, which use non-canonical IPv6 addresses for resources like load balancers. It also seems reasonable to allow them inDNSRecord
resources.This change adapts the validation accordingly so that non-canonical IPv6 addresses are allowed.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note:
/cc @MartinWeindel