Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
17 changes: 14 additions & 3 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8666,28 +8666,39 @@ spec:
description: |-
gateway is an IPv4 or IPv6 address which represents the subnet gateway,
for example, 192.168.1.1.
format: ipv6
maxLength: 45
type: string
x-kubernetes-validations:
- message: gateway must be a valid IPv4 or IPv6 address
rule: self == '' || isIP(self)
ipAddrs:
description: |-
ipAddrs is a list of one or more IPv4 and/or IPv6 addresses and CIDR to assign to
this device, for example, 192.168.1.100/24. IP addresses provided via ipAddrs are
intended to allow explicit assignment of a machine's IP address.
example: 2001:DB8:0000:0000:244:17FF:FEB6:D37D/64
format: ipv6
items:
type: string
maxItems: 10
type: array
x-kubernetes-validations:
- message: each ipAddrs entry must be a valid CIDR (e.g.
192.168.1.100/24)
rule: self.all(x, isCIDR(x))
nameservers:
description: |-
nameservers is a list of IPv4 and/or IPv6 addresses used as DNS nameservers, for example,
8.8.8.8. a nameserver is not provided by a fulfilled IPAddressClaim. If DHCP is not the
source of IP addresses for this network device, nameservers should include a valid nameserver.
example: 8.8.8.8
format: ipv6
items:
type: string
maxItems: 3
type: array
x-kubernetes-validations:
- message: each nameserver must be a valid IPv4 or IPv6
address
rule: self.all(x, isIP(x))
required:
- ipAddrs
type: object
Expand Down
13 changes: 13 additions & 0 deletions hack/go-crd-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
# Run CRD schema and behavioral validation tests.
# These tests require envtest (kube-apiserver + etcd binaries).
# Example: ./hack/go-crd-test.sh

set -e

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"

go install -mod=mod sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.19
# shellcheck disable=SC2086
KUBEBUILDER_ASSETS="$($(go env GOPATH)/bin/setup-envtest use 1.31.0 -p path --bin-dir /tmp)" \
go test -timeout 5m -v -C "${REPO_ROOT}/tests/crd" ./... "${@}"
12 changes: 6 additions & 6 deletions pkg/types/vsphere/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,15 @@ type Host struct {
type NetworkDeviceSpec struct {
// gateway is an IPv4 or IPv6 address which represents the subnet gateway,
// for example, 192.168.1.1.
// +kubebuilder:validation:Format=ipv4
// +kubebuilder:validation:Format=ipv6
// +kubebuilder:validation:MaxLength=45
// +kubebuilder:validation:XValidation:rule="self == '' || isIP(self)",message="gateway must be a valid IPv4 or IPv6 address"
Gateway string `json:"gateway,omitempty"`

// ipAddrs is a list of one or more IPv4 and/or IPv6 addresses and CIDR to assign to
// this device, for example, 192.168.1.100/24. IP addresses provided via ipAddrs are
// intended to allow explicit assignment of a machine's IP address.
// +kubebuilder:validation:Format=ipv4
// +kubebuilder:validation:Format=ipv6
// +kubebuilder:validation:MaxItems=10
// +kubebuilder:validation:XValidation:rule="self.all(x, isCIDR(x))",message="each ipAddrs entry must be a valid CIDR (e.g. 192.168.1.100/24)"
// +kubebuilder:example=`192.168.1.100/24`
// +kubebuilder:example=`2001:DB8:0000:0000:244:17FF:FEB6:D37D/64`
// +kubebuilder:validation:Required
Expand All @@ -348,8 +348,8 @@ type NetworkDeviceSpec struct {
// nameservers is a list of IPv4 and/or IPv6 addresses used as DNS nameservers, for example,
// 8.8.8.8. a nameserver is not provided by a fulfilled IPAddressClaim. If DHCP is not the
// source of IP addresses for this network device, nameservers should include a valid nameserver.
// +kubebuilder:validation:Format=ipv4
// +kubebuilder:validation:Format=ipv6
// +kubebuilder:validation:MaxItems=3
// +kubebuilder:validation:XValidation:rule="self.all(x, isIP(x))",message="each nameserver must be a valid IPv4 or IPv6 address"
// +kubebuilder:example=`8.8.8.8`
Nameservers []string `json:"nameservers,omitempty"`
}
Expand Down
60 changes: 60 additions & 0 deletions tests/crd/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module github.com/openshift/installer/tests/crd

go 1.25.8

require (
github.com/stretchr/testify v1.11.1
k8s.io/apiextensions-apiserver v0.35.1
k8s.io/apimachinery v0.35.1
k8s.io/client-go v0.35.1
sigs.k8s.io/controller-runtime v0.22.5
sigs.k8s.io/yaml v1.6.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.35.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
)
Loading