mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
update api in doc
This commit is contained in:
parent
6b227a2aa9
commit
47e83aa9c1
5 changed files with 15 additions and 15 deletions
|
@ -27,7 +27,7 @@ Policy enforcement is captured using Kubernetes events. Kyverno also reports pol
|
|||
This policy requires that all pods have CPU and memory resource requests and limits:
|
||||
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: check-cpu-memory
|
||||
|
@ -61,7 +61,7 @@ spec:
|
|||
This policy sets the imagePullPolicy to Always if the image tag is latest:
|
||||
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: set-image-pull-policy
|
||||
|
@ -89,7 +89,7 @@ spec:
|
|||
This policy sets the Zookeeper and Kafka connection strings for all namespaces with a label key 'kafka'.
|
||||
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: Policy
|
||||
metadata:
|
||||
name: "zk-kafka-address"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
## Example 1
|
||||
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: basic-policy
|
||||
|
@ -54,7 +54,7 @@ In this example, when this policy is applied, any new namespace that satisfies t
|
|||
|
||||
## Example 2
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: "default"
|
||||
|
|
|
@ -23,7 +23,7 @@ With Kyverno, the add and replace have the same behavior i.e. both operations wi
|
|||
This patch adds an init container to all deployments.
|
||||
|
||||
````yaml
|
||||
apiVersion : kyverno.io/v1alpha1
|
||||
apiVersion : kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : policy-v1
|
||||
|
@ -47,7 +47,7 @@ spec :
|
|||
Here is the example of a patch that removes a label from the secret:
|
||||
|
||||
````yaml
|
||||
apiVersion : kyverno.io/v1alpha1
|
||||
apiVersion : kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : policy-remove-label
|
||||
|
@ -75,7 +75,7 @@ The overlay cannot be used to delete values in a resource: use **patches** for t
|
|||
The following mutation overlay will add (or replace) the memory request and limit to 10Gi for every Pod with a label ```memory: high```:
|
||||
|
||||
````yaml
|
||||
apiVersion : kyverno.io/v1alpha1
|
||||
apiVersion : kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : policy-change-memory-limit
|
||||
|
@ -108,7 +108,7 @@ spec :
|
|||
Applying overlays to a list type 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: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: policy-endpoints
|
||||
|
@ -151,7 +151,7 @@ A `conditional anchor` evaluates to `true` if the anchor tag exists and if the v
|
|||
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: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : policy-set-port
|
||||
|
@ -181,7 +181,7 @@ An `add anchor` is processed as part of applying the mutation. Typically, every
|
|||
For example, this overlay will set the port to 6443, if a port is not already defined:
|
||||
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : policy-set-port
|
||||
|
|
|
@ -83,7 +83,7 @@ The following rule prevents the creation of Deployment, StatefuleSet and DaemonS
|
|||
|
||||
````yaml
|
||||
|
||||
apiVersion : kyverno.io/v1alpha1
|
||||
apiVersion : kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : validation-example
|
||||
|
@ -120,7 +120,7 @@ A variation of an anchor, is to check that in a list of elements at least one el
|
|||
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:
|
||||
|
||||
````yaml
|
||||
apiVersion : kyverno.io/v1alpha1
|
||||
apiVersion : kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : validation-example2
|
||||
|
@ -156,7 +156,7 @@ The `anyPattern` tag can be used to check if any one of the patterns in the list
|
|||
<small>*Note: either one of `pattern` or `anyPattern` is allowed in a rule, they both can't be declared in the same rule.*</small>
|
||||
|
||||
````yaml
|
||||
apiVersion: kyverno.io/v1alpha1
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: check-container-security-context
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
A Kyverno policy contains a set of rules. Each rule matches resources by kind, name, or selectors.
|
||||
|
||||
````yaml
|
||||
apiVersion : kyverno.io/v1alpha1
|
||||
apiVersion : kyverno.io/v1
|
||||
kind : ClusterPolicy
|
||||
metadata :
|
||||
name : policy
|
||||
|
|
Loading…
Add table
Reference in a new issue