mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
Updated readme.md and user facing files
This commit is contained in:
parent
4cc4ef7cee
commit
c70484090f
3 changed files with 34 additions and 27 deletions
|
@ -47,7 +47,7 @@ spec:
|
|||
resources:
|
||||
limits:
|
||||
# '?' requires 1 alphanumeric character and '*' means that there can be 0 or more characters.
|
||||
# Using them togther e.g. '?*' requires at least one character.
|
||||
# Using them together e.g. '?*' requires at least one character.
|
||||
memory: "?*"
|
||||
cpu: "?*"
|
||||
requests:
|
||||
|
@ -169,4 +169,3 @@ Welcome to our community and thanks for contributing!
|
|||
* Please review and agree to abide with the [Code of Conduct](/CODE_OF_CONDUCT.md) before contributing.
|
||||
* See the [Wiki](https://github.com/nirmata/kyverno/wiki) for developer documentation.
|
||||
* Browse through the [open issues](https://github.com/nirmata/kyverno/issues)
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ spec :
|
|||
rules:
|
||||
- name: "Remove unwanted label"
|
||||
resource:
|
||||
kind: Secret
|
||||
kinds:
|
||||
- Secret
|
||||
mutate:
|
||||
patches:
|
||||
- path: "/metadata/labels/purpose"
|
||||
|
@ -71,7 +72,8 @@ spec :
|
|||
rules:
|
||||
- name: "Set hard memory limit to 2Gi"
|
||||
resource:
|
||||
kind: Pod
|
||||
kinds:
|
||||
- Pod
|
||||
selector:
|
||||
matchLabels:
|
||||
memory: high
|
||||
|
@ -80,7 +82,7 @@ spec :
|
|||
spec:
|
||||
containers:
|
||||
# the wildcard * will match all containers in the list
|
||||
- name: *
|
||||
- (name): "*"
|
||||
resources:
|
||||
requests:
|
||||
memory: "10Gi"
|
||||
|
@ -91,22 +93,24 @@ spec :
|
|||
|
||||
### Working with lists
|
||||
|
||||
Applying overlays to a list type without is fairly straightforward: new items will be added to the list, unless they already ecist. For example, the next overlay will add IP "192.168.10.172" to all addresses in all Endpoints:
|
||||
Applying overlays to a list type without is fairly straightforward: new items will be added to the list, unless they already exist. For example, the next overlay will add IP "192.168.10.172" to all addresses in all Endpoints:
|
||||
|
||||
````yaml
|
||||
apiVersion: policy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: policy-endpoints
|
||||
spec:
|
||||
rules:
|
||||
- resource:
|
||||
kind : Endpoints
|
||||
- name: "Add IP to subsets"
|
||||
resource:
|
||||
kinds :
|
||||
- Endpoints
|
||||
mutate:
|
||||
overlay:
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: 192.168.10.172
|
||||
- ip: 192.168.42.172
|
||||
````
|
||||
|
||||
|
||||
|
@ -117,14 +121,16 @@ An **anchor** field, marked by parentheses, allows conditional processing of con
|
|||
For example, this overlay will add or replace the value 6443 for the port field, for all ports with a name value that starts with "secure":
|
||||
|
||||
````yaml
|
||||
apiVersion : policy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
kind : Policy
|
||||
metadata :
|
||||
name : policy-set-port
|
||||
spec :
|
||||
rules:
|
||||
- resource:
|
||||
kind : Endpoints
|
||||
- name: "Set port"
|
||||
resource:
|
||||
kinds :
|
||||
- Endpoints
|
||||
mutate:
|
||||
overlay:
|
||||
subsets:
|
||||
|
@ -145,18 +151,20 @@ A variation of an anchor, is to add a field value if it is not already defined.
|
|||
For example, this overlay will set the port to 6443, if a port is not already defined:
|
||||
|
||||
````yaml
|
||||
apiVersion : policy.nirmata.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
kind : Policy
|
||||
metadata :
|
||||
name : policy-set-port
|
||||
spec :
|
||||
rules:
|
||||
- resource:
|
||||
kind : Endpoints
|
||||
- name: "Set port"
|
||||
resource:
|
||||
kinds :
|
||||
- Endpoints
|
||||
mutate:
|
||||
overlay:
|
||||
subsets:
|
||||
- ports:
|
||||
- (ports):
|
||||
+(port): 6443
|
||||
````
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ metadata :
|
|||
name : policy-endpoints
|
||||
spec :
|
||||
rules:
|
||||
- name:
|
||||
- name: ""
|
||||
resource:
|
||||
kinds:
|
||||
- Endpoints
|
||||
|
|
Loading…
Add table
Reference in a new issue