From 08ee348b477c2733bedae17e53ccebc84b48ab53 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 16 Feb 2026 11:04:35 -0500 Subject: [PATCH] Update the text of the StrictIPCIDRValidation warnings (It's the future now!) (These warnings will still be displayed if you update an object that already contained invalid IPs which you didn't fix.) --- pkg/api/pod/warnings_test.go | 4 ++-- pkg/api/service/warnings_test.go | 18 +++++++++--------- .../apimachinery/pkg/util/validation/ip.go | 4 ++-- .../pkg/util/validation/ip_test.go | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pkg/api/pod/warnings_test.go b/pkg/api/pod/warnings_test.go index ac8e72feb97..a1ef7ddd119 100644 --- a/pkg/api/pod/warnings_test.go +++ b/pkg/api/pod/warnings_test.go @@ -1828,8 +1828,8 @@ func TestWarnings(t *testing.T) { }, }}, expected: []string{ - `spec.dnsConfig.nameservers[1]: non-standard IP address "05.06.07.08" will be considered invalid in a future Kubernetes release: use "5.6.7.8"`, - `spec.hostAliases[0].ip: non-standard IP address "::ffff:1.2.3.4" will be considered invalid in a future Kubernetes release: use "1.2.3.4"`, + `spec.dnsConfig.nameservers[1]: non-standard IP address "05.06.07.08" is invalid: use "5.6.7.8"`, + `spec.hostAliases[0].ip: non-standard IP address "::ffff:1.2.3.4" is invalid: use "1.2.3.4"`, }, }, } diff --git a/pkg/api/service/warnings_test.go b/pkg/api/service/warnings_test.go index 3fe97f7d7cb..2eb6f0e84e6 100644 --- a/pkg/api/service/warnings_test.go +++ b/pkg/api/service/warnings_test.go @@ -166,21 +166,21 @@ func TestGetWarningsForServiceClusterIPs(t *testing.T) { name: "IPv4 with leading zeros", service: service([]string{"192.012.2.2"}), want: []string{ - `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" is invalid: use "192.12.2.2"`, }, }, { name: "Dual Stack IPv4-IPv6 and IPv4 with leading zeros", service: service([]string{"192.012.2.2", "2001:db8::2"}), want: []string{ - `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" is invalid: use "192.12.2.2"`, }, }, { name: "Dual Stack IPv6-IPv4 and IPv4 with leading zeros", service: service([]string{"2001:db8::2", "192.012.2.2"}), want: []string{ - `spec.clusterIPs[1]: non-standard IP address "192.012.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[1]: non-standard IP address "192.012.2.2" is invalid: use "192.12.2.2"`, }, }, { @@ -208,7 +208,7 @@ func TestGetWarningsForServiceClusterIPs(t *testing.T) { name: "Dual Stack IPv4-IPv6 and IPv4 with leading zeros and IPv6 non-canonical format", service: service([]string{"192.012.2.2", "2001:db8:0:0::2"}), want: []string{ - `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" is invalid: use "192.12.2.2"`, `spec.clusterIPs[1]: IPv6 address "2001:db8:0:0::2" should be in RFC 5952 canonical format ("2001:db8::2")`, }, }, @@ -217,7 +217,7 @@ func TestGetWarningsForServiceClusterIPs(t *testing.T) { service: service([]string{"2001:db8:0:0::2", "192.012.2.2"}), want: []string{ `spec.clusterIPs[0]: IPv6 address "2001:db8:0:0::2" should be in RFC 5952 canonical format ("2001:db8::2")`, - `spec.clusterIPs[1]: non-standard IP address "192.012.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[1]: non-standard IP address "192.012.2.2" is invalid: use "192.12.2.2"`, }, }, { @@ -238,12 +238,12 @@ func TestGetWarningsForServiceClusterIPs(t *testing.T) { }, want: []string{ `spec.clusterIPs[0]: IPv6 address "2001:db8:0:0::2" should be in RFC 5952 canonical format ("2001:db8::2")`, - `spec.clusterIPs[1]: non-standard IP address "192.012.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[1]: non-standard IP address "192.012.2.2" is invalid: use "192.12.2.2"`, `spec.externalIPs[0]: IPv6 address "2001:db8:1:0::2" should be in RFC 5952 canonical format ("2001:db8:1::2")`, - `spec.externalIPs[1]: non-standard IP address "10.012.2.2" will be considered invalid in a future Kubernetes release: use "10.12.2.2"`, - `spec.loadBalancerIP: non-standard IP address "10.001.1.1" will be considered invalid in a future Kubernetes release: use "10.1.1.1"`, + `spec.externalIPs[1]: non-standard IP address "10.012.2.2" is invalid: use "10.12.2.2"`, + `spec.loadBalancerIP: non-standard IP address "10.001.1.1" is invalid: use "10.1.1.1"`, `spec.loadBalancerSourceRanges[0]: IPv6 CIDR value "2001:db8:1:0::/64" should be in RFC 5952 canonical format ("2001:db8:1::/64")`, - `spec.loadBalancerSourceRanges[1]: non-standard CIDR value "10.012.2.0/24" will be considered invalid in a future Kubernetes release: use "10.12.2.0/24"`, + `spec.loadBalancerSourceRanges[1]: non-standard CIDR value "10.012.2.0/24" is invalid: use "10.12.2.0/24"`, }, }, } diff --git a/staging/src/k8s.io/apimachinery/pkg/util/validation/ip.go b/staging/src/k8s.io/apimachinery/pkg/util/validation/ip.go index 6e947c74c9e..869fb0aad08 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/validation/ip.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/validation/ip.go @@ -115,7 +115,7 @@ func GetWarningsForIP(fldPath *field.Path, value string) []string { // ParseAddr() doesn't) or IPv4-mapped IPv6 (.Is4In6()). Either way, // re-stringifying the net.IP value will give the preferred form. return []string{ - fmt.Sprintf("%s: non-standard IP address %q will be considered invalid in a future Kubernetes release: use %q", fldPath, value, ip.String()), + fmt.Sprintf("%s: non-standard IP address %q is invalid: use %q", fldPath, value, ip.String()), } } @@ -233,7 +233,7 @@ func GetWarningsForCIDR(fldPath *field.Path, value string) []string { // ParsePrefix() doesn't) or IPv4-mapped IPv6 (.Is4In6()). Either way, // re-stringifying the net.IPNet value will give the preferred form. warnings = append(warnings, - fmt.Sprintf("%s: non-standard CIDR value %q will be considered invalid in a future Kubernetes release: use %q", fldPath, value, ipnet.String()), + fmt.Sprintf("%s: non-standard CIDR value %q is invalid: use %q", fldPath, value, ipnet.String()), ) } diff --git a/staging/src/k8s.io/apimachinery/pkg/util/validation/ip_test.go b/staging/src/k8s.io/apimachinery/pkg/util/validation/ip_test.go index caf5cf1fe51..a96ced3cad4 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/validation/ip_test.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/validation/ip_test.go @@ -284,7 +284,7 @@ func TestGetWarningsForIP(t *testing.T) { address: "192.012.2.2", fieldPath: field.NewPath("spec").Child("clusterIPs").Index(0), want: []string{ - `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[0]: non-standard IP address "192.012.2.2" is invalid: use "192.12.2.2"`, }, }, { @@ -292,7 +292,7 @@ func TestGetWarningsForIP(t *testing.T) { address: "::ffff:192.12.2.2", fieldPath: field.NewPath("spec").Child("clusterIPs").Index(0), want: []string{ - `spec.clusterIPs[0]: non-standard IP address "::ffff:192.12.2.2" will be considered invalid in a future Kubernetes release: use "192.12.2.2"`, + `spec.clusterIPs[0]: non-standard IP address "::ffff:192.12.2.2" is invalid: use "192.12.2.2"`, }, }, { @@ -551,7 +551,7 @@ func TestGetWarningsForCIDR(t *testing.T) { cidr: "192.012.2.0/24", fieldPath: field.NewPath("spec").Child("loadBalancerSourceRanges").Index(0), want: []string{ - `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "192.012.2.0/24" will be considered invalid in a future Kubernetes release: use "192.12.2.0/24"`, + `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "192.012.2.0/24" is invalid: use "192.12.2.0/24"`, }, }, { @@ -559,7 +559,7 @@ func TestGetWarningsForCIDR(t *testing.T) { cidr: "192.12.2.0/024", fieldPath: field.NewPath("spec").Child("loadBalancerSourceRanges").Index(0), want: []string{ - `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "192.12.2.0/024" will be considered invalid in a future Kubernetes release: use "192.12.2.0/24"`, + `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "192.12.2.0/024" is invalid: use "192.12.2.0/24"`, }, }, { @@ -567,7 +567,7 @@ func TestGetWarningsForCIDR(t *testing.T) { cidr: "::ffff:192.12.2.0/120", fieldPath: field.NewPath("spec").Child("loadBalancerSourceRanges").Index(0), want: []string{ - `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "::ffff:192.12.2.0/120" will be considered invalid in a future Kubernetes release: use "192.12.2.0/24"`, + `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "::ffff:192.12.2.0/120" is invalid: use "192.12.2.0/24"`, }, }, { @@ -584,7 +584,7 @@ func TestGetWarningsForCIDR(t *testing.T) { fieldPath: field.NewPath("spec").Child("loadBalancerSourceRanges").Index(0), want: []string{ `spec.loadBalancerSourceRanges[0]: CIDR value "192.012.2.8/24" is ambiguous in this context (should be "192.12.2.0/24" or "192.12.2.8/32"?)`, - `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "192.012.2.8/24" will be considered invalid in a future Kubernetes release: use "192.12.2.0/24"`, + `spec.loadBalancerSourceRanges[0]: non-standard CIDR value "192.012.2.8/24" is invalid: use "192.12.2.0/24"`, }, }, {