Fix incorrect ValidationAdmissionPolicyBindings
This commit is contained in:
parent
d9ca0d9dce
commit
088649ec4f
|
|
@ -76,12 +76,11 @@ kind: ValidatingAdmissionPolicyBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: "demo-binding-test.example.com"
|
name: "demo-binding-test.example.com"
|
||||||
spec:
|
spec:
|
||||||
policy: "replicalimit-policy.example.com"
|
policyName: "demo-policy.example.com"
|
||||||
matchResources:
|
matchResources:
|
||||||
namespaceSelectors:
|
namespaceSelector:
|
||||||
- key: environment,
|
matchLabels:
|
||||||
operator: In,
|
environment: test
|
||||||
values: ["test"]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:
|
When trying to create a deployment with replicas set not satisfying the validation expression, an error will return containing message:
|
||||||
|
|
@ -134,14 +133,13 @@ kind: ValidatingAdmissionPolicyBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: "replicalimit-binding-test.example.com"
|
name: "replicalimit-binding-test.example.com"
|
||||||
spec:
|
spec:
|
||||||
policy: "replicalimit-policy.example.com"
|
policyName: "replicalimit-policy.example.com"
|
||||||
paramsRef:
|
paramsRef:
|
||||||
name: "replica-limit-test.example.com"
|
name: "replica-limit-test.example.com"
|
||||||
matchResources:
|
matchResources:
|
||||||
namespaceSelectors:
|
namespaceSelector:
|
||||||
- key: environment,
|
matchLabels:
|
||||||
operator: In,
|
environment: test
|
||||||
values: ["test"]
|
|
||||||
```
|
```
|
||||||
The parameter resource could be as following:
|
The parameter resource could be as following:
|
||||||
```yaml
|
```yaml
|
||||||
|
|
@ -159,14 +157,15 @@ kind: ValidatingAdmissionPolicyBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: "replicalimit-binding-nontest"
|
name: "replicalimit-binding-nontest"
|
||||||
spec:
|
spec:
|
||||||
policy: "replicalimit-policy.example.com"
|
policyName: "replicalimit-policy.example.com"
|
||||||
paramsRef:
|
paramsRef:
|
||||||
name: "replica-limit-clusterwide.example.com"
|
name: "replica-limit-clusterwide.example.com"
|
||||||
matchResources:
|
matchResources:
|
||||||
namespaceSelectors:
|
namespaceSelector:
|
||||||
- key: environment,
|
matchExpressions:
|
||||||
operator: NotIn,
|
- key: environment,
|
||||||
values: ["test"]
|
operator: NotIn,
|
||||||
|
values: ["test"]
|
||||||
```
|
```
|
||||||
And have a parameter resource like:
|
And have a parameter resource like:
|
||||||
```yaml
|
```yaml
|
||||||
|
|
@ -183,12 +182,13 @@ kind: ValidatingAdmissionPolicyBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: "replicalimit-binding-global"
|
name: "replicalimit-binding-global"
|
||||||
spec:
|
spec:
|
||||||
policy: "replicalimit-policy.example.com"
|
policyName: "replicalimit-policy.example.com"
|
||||||
params: "replica-limit-clusterwide.example.com"
|
params: "replica-limit-clusterwide.example.com"
|
||||||
matchResources:
|
matchResources:
|
||||||
namespaceSelectors:
|
namespaceSelector:
|
||||||
- key: environment,
|
matchExpressions:
|
||||||
operator: Exists
|
- key: environment,
|
||||||
|
operator: Exists
|
||||||
```
|
```
|
||||||
|
|
||||||
The params object representing a parameter resource will not be set if a parameter resource has not been bound,
|
The params object representing a parameter resource will not be set if a parameter resource has not been bound,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue