mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
* test: Add test case for useServerSideApply Signed-off-by: Mike Bryant <mike.bryant@mettle.co.uk> * fix: Allow generate cli tests to work with server-side apply policies Signed-off-by: Mike Bryant <mike.bryant@mettle.co.uk> --------- Signed-off-by: Mike Bryant <mike.bryant@mettle.co.uk> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
36 lines
1.3 KiB
YAML
36 lines
1.3 KiB
YAML
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: create-default-pdb
|
|
annotations:
|
|
policies.kyverno.io/title: Add Pod Disruption Budget
|
|
policies.kyverno.io/category: Sample
|
|
kyverno.io/kyverno-version: 1.6.2
|
|
policies.kyverno.io/minversion: 1.6.0
|
|
policies.kyverno.io/subject: Deployment
|
|
policies.kyverno.io/description: >-
|
|
A PodDisruptionBudget limits the number of Pods of a replicated application that
|
|
are down simultaneously from voluntary disruptions. For example, a quorum-based
|
|
application would like to ensure that the number of replicas running is never brought
|
|
below the number needed for a quorum. As an application owner, you can create a PodDisruptionBudget (PDB)
|
|
for each application. This policy will create a PDB resource whenever a new Deployment is created.
|
|
spec:
|
|
rules:
|
|
- name: create-default-pdb
|
|
match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Deployment
|
|
generate:
|
|
apiVersion: policy/v1
|
|
kind: PodDisruptionBudget
|
|
name: "{{request.object.metadata.name}}-default-pdb"
|
|
namespace: "{{request.object.metadata.namespace}}"
|
|
data:
|
|
spec:
|
|
minAvailable: 1
|
|
selector:
|
|
matchLabels:
|
|
"{{request.object.metadata.labels}}"
|
|
useServerSideApply: true
|