All Policies
Check Data Protection By Label
Check the 'dataprotection' label for production Deployments and StatefulSet workloads. Use in combination with 'kasten-generate-example-backup-policy' policy to generate a Kasten policy for the workload namespace, if it doesn't already exist.
Policy Definition
/kasten/kasten-data-protection-by-label/kasten-data-protection-by-label.yaml
1apiVersion: kyverno.io/v1
2kind: ClusterPolicy
3metadata:
4 name: kasten-data-protection-by-label
5 annotations:
6 policies.kyverno.io/title: Check Data Protection By Label
7 policies.kyverno.io/category: Veeam Kasten
8 kyverno.io/kyverno-version: 1.12.1
9 policies.kyverno.io/minversion: 1.6.2
10 kyverno.io/kubernetes-version: "1.24-1.30"
11 policies.kyverno.io/subject: Deployment, StatefulSet
12 policies.kyverno.io/description: >-
13 Check the 'dataprotection' label for production Deployments and StatefulSet workloads.
14
15 Use in combination with 'kasten-generate-example-backup-policy' policy to generate a Kasten policy for the workload namespace, if it doesn't already exist.
16spec:
17 validationFailureAction: Audit
18 rules:
19 - name: kasten-data-protection-by-label
20 match:
21 any:
22 - resources:
23 kinds:
24 - Deployment
25 - StatefulSet
26 selector:
27 matchLabels:
28 purpose: production
29 validate:
30 message: >-
31 "Deployments and StatefulSets with 'purpose=production' label must specify a valid 'dataprotection' label:
32
33 "dataprotection=kasten-example" - <Insert human readable settings for each option>
34 "dataprotection=none" - No local snapshots or backups
35 pattern:
36 metadata:
37 labels:
38 dataprotection: "kasten-example|none"