mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
[API REVIEW] Validation.MessageExpression
This commit is contained in:
parent
de9ce03f19
commit
f4ee476a3c
@ -256,6 +256,18 @@ type Validation struct {
|
|||||||
// If not set, StatusReasonInvalid is used in the response to the client.
|
// If not set, StatusReasonInvalid is used in the response to the client.
|
||||||
// +optional
|
// +optional
|
||||||
Reason *metav1.StatusReason
|
Reason *metav1.StatusReason
|
||||||
|
// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
|
||||||
|
// Since messageExpression is used as a failure message, it must evaluate to a string.
|
||||||
|
// If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails.
|
||||||
|
// If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced
|
||||||
|
// as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
|
||||||
|
// that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and
|
||||||
|
// the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged.
|
||||||
|
// messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'.
|
||||||
|
// Example:
|
||||||
|
// "object.x must be less than max ("+string(params.max)+")"
|
||||||
|
// +optional
|
||||||
|
MessageExpression string
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuditAnnotation describes how to produce an audit annotation for an API request.
|
// AuditAnnotation describes how to produce an audit annotation for an API request.
|
||||||
|
@ -209,6 +209,18 @@ type Validation struct {
|
|||||||
// If not set, StatusReasonInvalid is used in the response to the client.
|
// If not set, StatusReasonInvalid is used in the response to the client.
|
||||||
// +optional
|
// +optional
|
||||||
Reason *metav1.StatusReason `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason"`
|
Reason *metav1.StatusReason `json:"reason,omitempty" protobuf:"bytes,3,opt,name=reason"`
|
||||||
|
// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
|
||||||
|
// Since messageExpression is used as a failure message, it must evaluate to a string.
|
||||||
|
// If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails.
|
||||||
|
// If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced
|
||||||
|
// as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
|
||||||
|
// that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and
|
||||||
|
// the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged.
|
||||||
|
// messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'.
|
||||||
|
// Example:
|
||||||
|
// "object.x must be less than max ("+string(params.max)+")"
|
||||||
|
// +optional
|
||||||
|
MessageExpression string `json:"messageExpression,omitempty" protobuf:"bytes,4,opt,name=messageExpression"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AuditAnnotation describes how to produce an audit annotation for an API request.
|
// AuditAnnotation describes how to produce an audit annotation for an API request.
|
||||||
|
Loading…
Reference in New Issue
Block a user