We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ac8a8a commit 9237e7eCopy full SHA for 9237e7e
kyverno-sample.yaml
@@ -0,0 +1,22 @@
1
+apiVersion: kyverno.io/v1
2
+kind: ClusterPolicy
3
+metadata:
4
+ name: require-instance-label
5
+spec:
6
+ # Block the resource creation if the policy is violated
7
+ validationFailureAction: Enforce
8
+ rules:
9
+ - name: check-for-instance-label
10
+ match:
11
+ # Match any request to create or update a Pod
12
+ any:
13
+ - resources:
14
+ kinds:
15
+ - Pod
16
+ validate:
17
+ message: "All Pods must have the label 'app.kubernetes.io/instance'."
18
+ # The pattern ensures the label exists and has any non-empty value
19
+ pattern:
20
+ metadata:
21
+ labels:
22
+ app.kubernetes.io/instance: "?*"
0 commit comments