Summary
The generated CRD schema for the vSphere NetworkDeviceSpec incorrectly applies format: ipv6 to the gateway, ipAddrs, and nameservers fields. This causes the CRD to reject valid IPv4 inputs (e.g., 192.168.1.1, 8.8.8.8) even though both IPv4 and IPv6 are intended and documented.
Details
The Go source (in pkg/types/vsphere/platform.go) specifies both +kubebuilder:validation:Format=ipv4 and +kubebuilder:validation:Format=ipv6 markers on these fields. However, controller-gen (v0.19.0) collapses these into a single format: ipv6 in the generated CRD YAML, dropping the IPv4 constraint.
Affected fields within NetworkDeviceSpec (under spec.platform.vsphere.infrastructure.hosts[].networkDevice):
gateway
ipAddrs
nameservers
Impact
Any consumer that vendors this repository and generates CRDs from these types will produce a CRD schema that rejects IPv4 addresses for these fields, despite the field descriptions and examples explicitly showing IPv4 usage.
Suggested Fix
One of the following:
- Remove the
format constraint from these fields so both IPv4 and IPv6 are accepted without format validation.
- Replace the single
format: ipv6 with a pattern-based validation that explicitly allows both IPv4 and IPv6 (and CIDR) formats.
- Adjust the kubebuilder markers so that controller-gen generates a schema that correctly handles both address families.
Backlinks
Summary
The generated CRD schema for the vSphere
NetworkDeviceSpecincorrectly appliesformat: ipv6to thegateway,ipAddrs, andnameserversfields. This causes the CRD to reject valid IPv4 inputs (e.g.,192.168.1.1,8.8.8.8) even though both IPv4 and IPv6 are intended and documented.Details
The Go source (in
pkg/types/vsphere/platform.go) specifies both+kubebuilder:validation:Format=ipv4and+kubebuilder:validation:Format=ipv6markers on these fields. However, controller-gen (v0.19.0) collapses these into a singleformat: ipv6in the generated CRD YAML, dropping the IPv4 constraint.Affected fields within
NetworkDeviceSpec(underspec.platform.vsphere.infrastructure.hosts[].networkDevice):gatewayipAddrsnameserversImpact
Any consumer that vendors this repository and generates CRDs from these types will produce a CRD schema that rejects IPv4 addresses for these fields, despite the field descriptions and examples explicitly showing IPv4 usage.
Suggested Fix
One of the following:
formatconstraint from these fields so both IPv4 and IPv6 are accepted without format validation.format: ipv6with apattern-based validation that explicitly allows both IPv4 and IPv6 (and CIDR) formats.Backlinks