diff --git a/pkg/collect/host_network.go b/pkg/collect/host_network.go index 32c36709..41f8988b 100644 --- a/pkg/collect/host_network.go +++ b/pkg/collect/host_network.go @@ -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 } diff --git a/pkg/collect/host_network_test.go b/pkg/collect/host_network_test.go index d9e2ea32..e65a8be5 100644 --- a/pkg/collect/host_network_test.go +++ b/pkg/collect/host_network_test.go @@ -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, }, {