Fix errors on `ValidatingAdmissionPolicyBindings` for the CEL for Admission Control blog & doc (#38893)
* Fix errors on ValidatingAdmissionPolicyBindings for the CEL for Admission Control blog * Fix namespaceSelector error * Fix namespaceSelector errors
This commit is contained in:
parent
91a0615e7f
commit
4ec6fbac55
|
|
@ -60,12 +60,14 @@ kind: ValidatingAdmissionPolicyBinding
|
|||
metadata:
|
||||
name: "demo-binding-test.example.com"
|
||||
spec:
|
||||
policy: "demo-policy.example.com"
|
||||
policyName: "demo-policy.example.com"
|
||||
matchResources:
|
||||
namespaceSelector:
|
||||
- key: environment,
|
||||
operator: In,
|
||||
values: ["test"]
|
||||
matchExpressions:
|
||||
- key: environment
|
||||
operator: In
|
||||
values:
|
||||
- test
|
||||
```
|
||||
|
||||
This `ValidatingAdmissionPolicyBinding` resource binds the above policy only to
|
||||
|
|
@ -115,14 +117,16 @@ kind: ValidatingAdmissionPolicyBinding
|
|||
metadata:
|
||||
name: "demo-binding-production.example.com"
|
||||
spec:
|
||||
policy: "demo-policy.example.com"
|
||||
paramsRef:
|
||||
policyName: "demo-policy.example.com"
|
||||
paramRef:
|
||||
name: "demo-params-production.example.com"
|
||||
matchResources:
|
||||
namespaceSelector:
|
||||
- key: environment,
|
||||
operator: In,
|
||||
values: ["production"]
|
||||
matchExpressions:
|
||||
- key: environment
|
||||
operator: In
|
||||
values:
|
||||
- production
|
||||
```
|
||||
|
||||
```yaml
|
||||
|
|
|
|||
|
|
@ -193,9 +193,10 @@ spec:
|
|||
matchResources:
|
||||
namespaceSelector:
|
||||
matchExpressions:
|
||||
- key: environment,
|
||||
operator: NotIn,
|
||||
values: ["test"]
|
||||
- key: environment
|
||||
operator: NotIn
|
||||
values:
|
||||
- test
|
||||
```
|
||||
|
||||
And have a parameter resource like:
|
||||
|
|
@ -222,7 +223,7 @@ spec:
|
|||
matchResources:
|
||||
namespaceSelector:
|
||||
matchExpressions:
|
||||
- key: environment,
|
||||
- key: environment
|
||||
operator: Exists
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue