mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-18 02:06:52 +00:00
fix sp.
add note on existence anchor
This commit is contained in:
parent
6167ec3709
commit
0a735f9f84
1 changed files with 3 additions and 3 deletions
|
@ -42,7 +42,7 @@ Anchors allow conditional processing (i.e. "if-then-else) and other logical chec
|
|||
|------------- |----- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Conditional | () | If tag with the given value (including child elements) is specified, then peer elements will be processed. <br/>e.g. If image has tag latest then imagePullPolicy cannot be IfNotPresent. <br/> (image): "*:latest" <br> imagePullPolicy: "!IfNotPresent"<br/> |
|
||||
| Equality | =() | If tag is specified, then processing continues. For tags with scalar values, the value must match. For tags with child elements, the child element is further evaluated as a validation pattern. <br/>e.g. If hostPath is defined then the path cannot be /var/lib<br/> =(hostPath):<br/> path: "!/var/lib"<br/> |
|
||||
| Existence | ^() | Works on the list/array type only. If at least one element in the satisfies the pattern. <br/>e.g. At least one container with image nginx:latest must exist. <br/> ^(containers):<br/> - image: nginx:latest<br/> |
|
||||
| Existence | ^() | Works on the list/array type only. If at least one element in the list satisfies the pattern. In contrast, a conditional anchor would validate that all elements in the list match the pattern. <br/>e.g. At least one container with image nginx:latest must exist. <br/> ^(containers):<br/> - image: nginx:latest<br/> |
|
||||
| Negation | X() | The tag cannot be specified. The value of the tag is not evaulated. <br/>e.g. Hostpath tag cannot be defined.<br/> X(hostPath):<br/> |
|
||||
|
||||
## Anchors and child elements
|
||||
|
@ -113,9 +113,9 @@ spec :
|
|||
|
||||
````
|
||||
|
||||
### Check if one exist
|
||||
### Existence anchor: at least one
|
||||
|
||||
A variation of an anchor, is to check existance of one element. This is done by using the ^(...) notation for the field.
|
||||
A variation of an anchor, is to check that in a list of elements at least one element exists that matches the patterm. This is done by using the ^(...) notation for the field.
|
||||
|
||||
For example, this pattern will check that at least one container has memory requests and limits defined and that the request is less than the limit:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue