fix(collector): fix dns collector limited to 63 chars (#1690)

This commit is contained in:
Dexter Yan
2024-11-19 17:47:24 +13:00
committed by GitHub
parent 91bf0242d4
commit 6167fd8a5e
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -65,8 +65,8 @@ func isValidLoadBalancerAddress(address string) bool {
}
errs := validation.IsQualifiedName(hostAddress)
// Checking for DNS name for RFC1123, DNS1123SubdomainMaxLength int = 253
errs := validation.IsDNS1123Subdomain(hostAddress)
return len(errs) == 0
}
+6 -1
View File
@@ -44,8 +44,13 @@ func Test_isValidLoadBalancerAddress(t *testing.T) {
want: false,
},
{
name: "Too many characters",
name: "Valid long DNS domain but less than 255 characters, RFC1123 compliant",
args: args{address: "howlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64.com:80"},
want: true,
},
{
name: "Non-valid long DNS domain but more than 255 characters, RFC1123 not compliant",
args: args{address: "howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64dssdfasdffs.com:80"},
want: false,
},
{