CEL validation: implement validateProvider for EnvoyProxy#2081
CEL validation: implement validateProvider for EnvoyProxy#2081arkodg merged 6 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #2081 +/- ##
==========================================
- Coverage 64.56% 64.48% -0.08%
==========================================
Files 109 109
Lines 15049 15049
==========================================
- Hits 9716 9705 -11
- Misses 4735 4742 +7
- Partials 598 602 +4
|
Signed-off-by: zirain <zirain2009@gmail.com>
| // +optional | ||
| // +kubebuilder:validation:XValidation:message="allocateLoadBalancerNodePorts can only be set for LoadBalancer type",rule="!has(self.allocateLoadBalancerNodePorts) || self.type == 'LoadBalancer'" | ||
| // +kubebuilder:validation:XValidation:message="loadBalancerIP can only be set for LoadBalancer type",rule="!has(self.loadBalancerIP) || self.type == 'LoadBalancer'" | ||
| // +kubebuilder:validation:XValidation:message="loadBalancerIP must be a valid IPv4 address",rule="!has(self.loadBalancerIP) || self.loadBalancerIP.matches(r\"^(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4})\")" |
There was a problem hiding this comment.
this's hard to read, but I cannot find better solution right now.
Hope one day, there's ip lib from kubernetest just like url.
There was a problem hiding this comment.
Unfortunately, this is just kind of the nature of CEL for more complex logic.
|
/retest |
| // +optional | ||
| // +kubebuilder:validation:XValidation:message="allocateLoadBalancerNodePorts can only be set for LoadBalancer type",rule="!has(self.allocateLoadBalancerNodePorts) || self.type == 'LoadBalancer'" | ||
| // +kubebuilder:validation:XValidation:message="loadBalancerIP can only be set for LoadBalancer type",rule="!has(self.loadBalancerIP) || self.type == 'LoadBalancer'" | ||
| // +kubebuilder:validation:XValidation:message="loadBalancerIP must be a valid IPv4 address",rule="!has(self.loadBalancerIP) || self.loadBalancerIP.matches(r\"^(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4})\")" |
There was a problem hiding this comment.
Unfortunately, this is just kind of the nature of CEL for more complex logic.
| // The full text of the Apache license is available in the LICENSE file at | ||
| // the root of the repo. | ||
|
|
||
| //go:build validation |
There was a problem hiding this comment.
can we rename file to
test/cel/envoyproxy_test.go
and the tag can be celvalidation
Signed-off-by: zirain <zirain2009@gmail.com>
Signed-off-by: zirain <zirain2009@gmail.com>
No description provided.