Skip to content

vsphere NetworkDeviceSpec: CRD schema incorrectly uses format: ipv6 for fields that should accept both IPv4 and IPv6 #10377

@coderabbitai

Description

@coderabbitai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions