All Policies
Prevent Use of Default Project
This policy prevents the use of the default project in an Application.
Policy Definition
/argo/application-prevent-default-project/application-prevent-default-project.yaml
1apiVersion: kyverno.io/v1
2kind: ClusterPolicy
3metadata:
4 name: application-prevent-default-project
5 annotations:
6 policies.kyverno.io/title: Prevent Use of Default Project
7 policies.kyverno.io/category: Argo
8 policies.kyverno.io/severity: medium
9 kyverno.io/kyverno-version: 1.6.2
10 policies.kyverno.io/minversion: 1.6.0
11 kyverno.io/kubernetes-version: "1.23"
12 policies.kyverno.io/subject: Application
13 policies.kyverno.io/description: >-
14 This policy prevents the use of the default project in an Application.
15spec:
16 validationFailureAction: Audit
17 background: true
18 rules:
19 - name: default-project
20 match:
21 any:
22 - resources:
23 kinds:
24 - Application
25 preconditions:
26 all:
27 - key: "{{ request.operation || 'BACKGROUND' }}"
28 operator: NotEquals
29 value: DELETE
30 validate:
31 message: "The default project may not be used in an Application."
32 pattern:
33 spec:
34 project: "!default"