You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If `valueExpression` returns a string, the audit annotation is published. If
1053
+
`valueExpression`returns null, the audit annotation is omitted. No other return
1054
+
types will be supported.
1055
+
1056
+
`ValidatingAdmissionPolicyBinding`resources may control how admission is
1057
+
enforced. This is performed using a single field. E.g.:
1059
1058
1060
1059
```yaml
1061
1060
apiVersion: admissionregistration.k8s.io/v1alpha1
1062
1061
kind: ValidatingAdmissionPolicyBinding
1063
1062
...
1064
1063
spec:
1065
-
enforcement: warn # optional field
1064
+
validationActions: [warn, audit] # optional field
1066
1065
```
1067
1066
1067
+
The enum options will be:
1068
+
1068
1069
- `deny`: Validation failures result in a denied request. (default beahvior if
1069
1070
field is unset)
1070
-
- `warn`: Validation failures are reported as warnings to the client.
1071
-
- `silent`: Validation failures are not reported to clients. Audit annotations
1072
-
for any failed validations are still included in audit events (see
1073
-
below).
1074
-
- (To disable audit annotations, delete the binding)
1071
+
- `warn`: Validation failures are reported as warnings to the client. (xref: [Admisssion Webhook Warnings](https://kubernetes.io/blog/2020/09/03/warnings/#admission-webhooks))
1072
+
- `audit`: Validation failures are published as audit events (see below Audit
1073
+
Annotations section for details).
1075
1074
1076
1075
Systems that need to aggregate validation failures may implement an [audit
1077
1076
webhook
1078
1077
backend](https://kubernetes.io/docs/tasks/debug/debug-cluster/audit/#webhook-backend). See
1079
1078
below "Audit Events" for details.
1080
1079
1081
-
For singleton policies, the enforcement field will be set on the policy definition.
1080
+
For singleton policies, the `validationActions` field will be set on the policy definition.
1082
1081
1083
-
Metrics will include enforcement so that cluster administrators can monitor the
1084
-
validation failures of a binding before setting enforcement to `deny`.
1082
+
Metrics will include validation action so that cluster administrators can monitor the
1083
+
validation failures of a binding before setting `validationActions` to `deny`.
1085
1084
1086
1085
Supported use cases:
1087
1086
@@ -1102,10 +1101,18 @@ Supported use cases:
1102
1101
enforcement point, higher level constructs can map to this enforcement point
1103
1102
as needed.
1104
1103
1104
+
1105
+
Future work:
1106
+
1107
+
ValidatingAdmissionPolicy resources might, in the future, add a `warnings` field
1108
+
adjacent to the `validations` and `auditAnnotations` fields to declare
1109
+
expressions only ever result in warnings. This would allow
1110
+
ValidatingAdmissionPolicy authors to declare a expression as non-enforcing
All audit event keys are prefixed by `<ValidatingPolicyDefinition name>/`.
1109
1116
1110
1117
At Metadata audit level or higher, when a validating admission binding fails any
1111
1118
validation expression, details are included in the audit annotations
@@ -1117,7 +1124,7 @@ for the audit event under the key `validation_failures`. E.g.:
1117
1124
"kind": "Event",
1118
1125
"apiVersion": "audit.k8s.io/v1",
1119
1126
"annotations": {
1120
-
"mypolicy.mygroup.example.com/mybinding.mygroup.example.com/validation_failure": "{\"expression\": 1, \"message\": \"x must be greater than y\", \"enforcement\": \"deny\"}"
1127
+
"mypolicy.mygroup.example.com/validation_failure": "{\"expression\": 1, \"message\": \"x must be greater than y\", \"enforcement\": \"deny\", \"binding\": \"mybinding.mygroup.example.com\"}"
1121
1128
# other annotations
1122
1129
...
1123
1130
}
@@ -1135,7 +1142,7 @@ are included with the key provided. E.g.:
1135
1142
"kind": "Event",
1136
1143
"apiVersion": "audit.k8s.io/v1",
1137
1144
"annotations": {
1138
-
"mypolicy.mygroup.example.com/mybinding.mygroup.example.com/myauditkey": "my audit value"
1145
+
"mypolicy.mygroup.example.com/myauditkey": "my audit value"
0 commit comments