Skip to content

Commit 87615fc

Browse files
committed
Apply feedback
1 parent 630dd62 commit 87615fc

File tree

1 file changed

+17
-10
lines changed
  • keps/sig-api-machinery/3488-cel-admission-control

1 file changed

+17
-10
lines changed

keps/sig-api-machinery/3488-cel-admission-control/README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,17 +1033,21 @@ apiVersion: admissionregistration.k8s.io/v1alpha1
10331033
kind: ValidatingAdmissionPolicyBinding
10341034
...
10351035
spec:
1036-
validationActions: [warn, audit] # optional field
1036+
validationActions: [Warn, Audit] # required field
10371037
```
10381038

10391039
The enum options will be:
10401040

1041-
- `deny`: Validation failures result in a denied request. (default beahvior if
1042-
field is unset)
1043-
- `warn`: Validation failures are reported as warnings to the client. (xref: [Admisssion Webhook Warnings](https://kubernetes.io/blog/2020/09/03/warnings/#admission-webhooks))
1044-
- `audit`: Validation failures are published as audit events (see below Audit
1041+
- `Deny`: Validation failures result in a denied request.
1042+
- `Warn`: Validation failures are reported as warnings to the client. (xref: [Admisssion Webhook Warnings](https://kubernetes.io/blog/2020/09/03/warnings/#admission-webhooks))
1043+
- `Audit`: Validation failures are published as audit events (see below Audit
10451044
Annotations section for details).
1046-
- `log`: The apiserver handling the admission request logs the validation failure.
1045+
- `Log`: The apiserver handling the admission request logs the validation failure.
1046+
1047+
If, in the future, `ValidatingAdmissionPolicy` also introduces enforcement
1048+
action fields, this `validationActions` field on
1049+
`ValidatingAdmissionPolicyBinding` will specify the "maximum" enforcement (at
1050+
most the enforcement will be what `validationActions` specifies).
10471051

10481052
Systems that need to aggregate validation failures may implement an [audit
10491053
webhook
@@ -1053,7 +1057,7 @@ below "Audit Events" for details.
10531057
For singleton policies, the `validationActions` field will be set on the policy definition.
10541058

10551059
Metrics will include validation action so that cluster administrators can monitor the
1056-
validation failures of a binding before setting `validationActions` to `deny`.
1060+
validation failures of a binding before setting `validationActions` to `Deny`.
10571061

10581062
This enables the following use cases:
10591063

@@ -1066,7 +1070,7 @@ This enables the following use cases:
10661070
knowing all the details of the policies. During rollout the cluster admin
10671071
needs a state where the policies being rolled out cannot result in admission
10681072
rejection. With the enforcement field on bindings, cluster admins can decide
1069-
which initial actions to enable and then add actions until `deny` is enabled.
1073+
which initial actions to enable and then add actions until `Deny` is enabled.
10701074
The cluster admin may monitoring metrics, warnings and audit events along the
10711075
way.
10721076
- A policy framework needs different enforcement actions at different
@@ -1103,9 +1107,12 @@ spec:
11031107
- expression: <expression>
11041108
auditAnnotations:
11051109
- key: "my-audit-key"
1106-
valueExpression: <expression that evaluates to a string>
1110+
valueExpression: <expression that evaluates to a string (and is recorded) or null (and is not recorded)>
11071111
```
11081112

1113+
`auditAnnotations` are independent of `validations`. A `ValidatingAdmissionPolicy`
1114+
may contain only `validations`, only `auditAnnotations` or both.
1115+
11091116
The published annotation key will be of the form `<ValidatingPolicyDefinition
11101117
name>/<auditAnnotation key>` and will be validated as a
11111118
[QualifiedName](https://github.com/kubernetes/kubernetes/blob/dfa4143086bf504c6c72d5eee8a2210b8ed41b9a/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L43).
@@ -1132,7 +1139,7 @@ for the audit event under the key `validation_failures`. E.g.:
11321139
"kind": "Event",
11331140
"apiVersion": "audit.k8s.io/v1",
11341141
"annotations": {
1135-
"mypolicy.mygroup.example.com/validation_failure": "{\"expression\": 1, \"message\": \"x must be greater than y\", \"enforcement\": \"deny\", \"binding\": \"mybinding.mygroup.example.com\"}"
1142+
"mypolicy.mygroup.example.com/validation_failure": "{\"expression\": 1, \"message\": \"x must be greater than y\", \"enforcement\": \"Deny\", \"binding\": \"mybinding.mygroup.example.com\"}"
11361143
# other annotations
11371144
...
11381145
}

0 commit comments

Comments
 (0)