Skip to content

Commit d29f516

Browse files
committed
Remove isCanonical() from ipAddress CEL validation
The isCanonical() function is not supported by the crd-schema-checker tool. The IP canonicalization is already enforced in code (statuscollector.go) using net.ParseIP().String(), so this CEL validation is redundant.
1 parent 2609f71 commit d29f516

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

etcd/v1alpha1/types_pacemakercluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ type PacemakerNodeStatus struct {
310310
Name string `json:"name,omitempty"`
311311

312312
// ipAddress is the IPv4 or IPv6 address of the node
313-
// When present, it must be a valid canonical IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast.
313+
// When present, it must be a valid IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast.
314314
// When not present, the IP address is unknown. This likely indicates that there is an error parsing the raw XML output.
315315
// +kubebuilder:validation:MinLength=2
316316
// +kubebuilder:validation:MaxLength=39
317-
// +kubebuilder:validation:XValidation:rule="isIP(self) && ip.isCanonical() && !ip(self).isUnspecified() && !ip(self).isLoopback() && !ip(self).isLinkLocalUnicast() && !ip(self).isLinkLocalMulticast() && !ip(self).isGlobalUnicast()",message="ipAddress must be a valid canonical IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast"
317+
// +kubebuilder:validation:XValidation:rule="isIP(self) && !ip(self).isUnspecified() && !ip(self).isLoopback() && !ip(self).isLinkLocalUnicast() && !ip(self).isLinkLocalMulticast() && !ip(self).isGlobalUnicast()",message="ipAddress must be a valid IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast"
318318
// +optional
319319
IPAddress string `json:"ipAddress,omitempty"`
320320

etcd/v1alpha1/zz_generated.crd-manifests/0000_25_etcd_01_pacemakerclusters.crd.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,18 @@ spec:
212212
ipAddress:
213213
description: |-
214214
ipAddress is the IPv4 or IPv6 address of the node
215-
When present, it must be a valid canonical IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast.
215+
When present, it must be a valid IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast.
216216
When not present, the IP address is unknown. This likely indicates that there is an error parsing the raw XML output.
217217
maxLength: 39
218218
minLength: 2
219219
type: string
220220
x-kubernetes-validations:
221-
- message: 'ipAddress must be a valid canonical IPv4 or IPv6
222-
address that is not one of the following: unspecified, loopback,
223-
link-local unicast, link-local multicast, or global unicast'
224-
rule: isIP(self) && ip.isCanonical() && !ip(self).isUnspecified()
225-
&& !ip(self).isLoopback() && !ip(self).isLinkLocalUnicast()
226-
&& !ip(self).isLinkLocalMulticast() && !ip(self).isGlobalUnicast()
221+
- message: 'ipAddress must be a valid IPv4 or IPv6 address that
222+
is not one of the following: unspecified, loopback, link-local
223+
unicast, link-local multicast, or global unicast'
224+
rule: isIP(self) && !ip(self).isUnspecified() && !ip(self).isLoopback()
225+
&& !ip(self).isLinkLocalUnicast() && !ip(self).isLinkLocalMulticast()
226+
&& !ip(self).isGlobalUnicast()
227227
mode:
228228
description: |-
229229
mode indicates if the node is in active or standby mode

etcd/v1alpha1/zz_generated.featuregated-crd-manifests/pacemakerclusters.etcd.openshift.io/AAA_ungated.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,18 @@ spec:
213213
ipAddress:
214214
description: |-
215215
ipAddress is the IPv4 or IPv6 address of the node
216-
When present, it must be a valid canonical IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast.
216+
When present, it must be a valid IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast.
217217
When not present, the IP address is unknown. This likely indicates that there is an error parsing the raw XML output.
218218
maxLength: 39
219219
minLength: 2
220220
type: string
221221
x-kubernetes-validations:
222-
- message: 'ipAddress must be a valid canonical IPv4 or IPv6
223-
address that is not one of the following: unspecified, loopback,
224-
link-local unicast, link-local multicast, or global unicast'
225-
rule: isIP(self) && ip.isCanonical() && !ip(self).isUnspecified()
226-
&& !ip(self).isLoopback() && !ip(self).isLinkLocalUnicast()
227-
&& !ip(self).isLinkLocalMulticast() && !ip(self).isGlobalUnicast()
222+
- message: 'ipAddress must be a valid IPv4 or IPv6 address that
223+
is not one of the following: unspecified, loopback, link-local
224+
unicast, link-local multicast, or global unicast'
225+
rule: isIP(self) && !ip(self).isUnspecified() && !ip(self).isLoopback()
226+
&& !ip(self).isLinkLocalUnicast() && !ip(self).isLinkLocalMulticast()
227+
&& !ip(self).isGlobalUnicast()
228228
mode:
229229
description: |-
230230
mode indicates if the node is in active or standby mode

etcd/v1alpha1/zz_generated.swagger_doc_generated.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14401,7 +14401,7 @@
1440114401
"type": "object",
1440214402
"properties": {
1440314403
"ipAddress": {
14404-
"description": "ipAddress is the IPv4 or IPv6 address of the node When present, it must be a valid canonical IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast. When not present, the IP address is unknown. This likely indicates that there is an error parsing the raw XML output.",
14404+
"description": "ipAddress is the IPv4 or IPv6 address of the node When present, it must be a valid IPv4 or IPv6 address that is not one of the following: unspecified, loopback, link-local unicast, link-local multicast, or global unicast. When not present, the IP address is unknown. This likely indicates that there is an error parsing the raw XML output.",
1440514405
"type": "string"
1440614406
},
1440714407
"mode": {

payload-manifests/crds/0000_25_etcd_01_pacemakerclusters.crd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ spec:
221221
- message: 'ipAddress must be a valid canonical IPv4 or IPv6
222222
address that is not one of the following: unspecified, loopback,
223223
link-local unicast, link-local multicast, or global unicast'
224-
rule: isIP(self) && ip.isCanonical() && !ip(self).isUnspecified()
224+
rule: isIP(self) && ip(self).isCanonical() && !ip(self).isUnspecified()
225225
&& !ip(self).isLoopback() && !ip(self).isLinkLocalUnicast()
226226
&& !ip(self).isLinkLocalMulticast() && !ip(self).isGlobalUnicast()
227227
mode:

0 commit comments

Comments
 (0)