Skip to content

Commit

Permalink
fix: fix field
Browse files Browse the repository at this point in the history
Signed-off-by: ShyunnY <1147212064@qq.com>
  • Loading branch information
ShyunnY committed May 16, 2024
1 parent 8965686 commit decfcc7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/backendtrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ type BackendTrafficPolicySpec struct {
// For example, 20Mi, 1Gi, 256Ki etc.
// Note: that when the suffix is not provided, the value is interpreted as bytes.
//
// +kubebuilder:validation:XValidation:rule="type(self) == string ? self.matches(r\"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\") : type(self) == int",message="PerConnectionBufferLimitBytes must be of the format \"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\""
// +kubebuilder:validation:XValidation:rule="type(self) == string ? self.matches(r\"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\") : type(self) == int",message="ConnectionBufferLimitBytes must be of the format \"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\""
// +optional
ConnectionBufferLimitBytes *resource.Quantity `json:"connectionBufferLimitBytes,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
x-kubernetes-validations:
- message: PerConnectionBufferLimitBytes must be of the format "^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$"
- message: ConnectionBufferLimitBytes must be of the format "^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$"
rule: 'type(self) == string ? self.matches(r"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$")
: type(self) == int'
faultInjection:
Expand Down
2 changes: 1 addition & 1 deletion test/cel-validation/backendtrafficpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ func TestBackendTrafficPolicyTarget(t *testing.T) {
}
},
wantErrors: []string{
"spec.connectionBufferLimitBytes: Invalid value: \"\": connectionBufferLimitBytes must be of the format \"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\"",
"spec.connectionBufferLimitBytes: Invalid value: \"\": ConnectionBufferLimitBytes must be of the format \"^[1-9]+[0-9]*([EPTGMK]i|[EPTGMk])?$\"",
},
},
}
Expand Down

0 comments on commit decfcc7

Please sign in to comment.