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
// Predicate represents a condition which must by fulfilled for a request to be sent to a webhook.
222
-
type Predicate struct {
215
+
// MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook.
216
+
type MatchCondition struct {
223
217
// Expression represents the expression which will be evaluated by CEL.
224
218
// ref: https://github.com/google/cel-spec
225
219
// CEL expressions have access to the contents of the AdmissionRequest, organized into CEL variables:
@@ -257,7 +251,7 @@ type Predicate struct {
257
251
}
258
252
```
259
253
260
-
The predicate expression has access to the contents of the `AdmissionRequest` object (exposed as the
254
+
The match condition expression has access to the contents of the `AdmissionRequest` object (exposed as the
261
255
`request` variable), but is not given any additional information. Expressions requiring access to
262
256
additional information (such as a paramater object) must be performed in the webhook, and are out of
263
257
scope for this proposal.
@@ -266,35 +260,35 @@ scope for this proposal.
266
260
267
261
#### Security
268
262
269
-
**Risk: Attacker adds or changes a predicate to weaken an admission policy.**
263
+
**Risk: Attacker adds or changes a match condition to weaken an admission policy.**
270
264
271
265
This is does not represent a new threat, as doing so would require update access to the admission
272
266
registration object, and with that permission an attacker could already disable the policy through
273
267
manipulating match rules, namespace selector, or object selector (or reroute the webhook entirely).
274
268
275
-
**Risk: Logic error in predicate expression.**
269
+
**Risk: Logic error in match condition expression.**
276
270
277
-
Currently the predicate conditions must be encoded in the webhook backend itself. Moving the logic
271
+
Currently the match conditions must be encoded in the webhook backend itself. Moving the logic
278
272
into a CEL expression does not materially increase the risk of a logic bug.
279
273
280
274
#### Debugability
281
275
282
276
We do not normally log, audit, or emit an event when a webhook is out-of-scope for a request, and
283
-
the same will _mostly_ be true for predicates.
277
+
the same will _mostly_ be true for match conditions.
284
278
285
279
At [log level V(5)](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use),
286
280
we will emit a log when a request that would otherwise be in-scope for a webhook is excluded for a
287
-
non-matching predicate.
281
+
non-matching match condition.
288
282
289
283
Short of increasing log verbosity, the recommended debug strategy is to capture or reproduce a
290
-
relevant AdmissionRequest (for example, in a non-prod cluster disable all predicates and log the
291
-
requests from a webhook). Then, manually test the predicates against the request, and iterate as
292
-
necessary.
284
+
relevant AdmissionRequest (for example, in a non-prod cluster disable all match conditions and log
285
+
the requests from a webhook). Then, manually test the match conditions against the request, and
286
+
iterate as necessary.
293
287
294
288
#### Performance
295
289
296
290
The CEL expression evaluation will leverage the same [Resource Constraints](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/2876-crd-validation-expression-language#resource-constraints)
297
-
used by CEL CRD Validation & CEL Admission Control. All the predicates for a given webhook will
291
+
used by CEL CRD Validation & CEL Admission Control. All the match conditions for a given webhook will
298
292
share the same resource budget.
299
293
300
294
<<[UNRESOLVED resource constraints ]>>
@@ -832,7 +826,7 @@ Why should this KEP _not_ be implemented?
832
826
833
827
### Exclusion Expressions
834
828
835
-
The `predicate` expression could be inverted, so that requests that match are excluded rather than
829
+
The `matchCondition` expression could be inverted, so that requests that match are excluded rather than
836
830
included. In this case, we would probably also want to change from requiring all expressions to
0 commit comments