An AppProject may optionally specify clusterResourceBlacklist which is a blacklisted group of cluster resources. This is often a good practice to ensure AppProjects do not allow more access than needed. This policy is a combination of two rules which enforce that all AppProjects specify clusterResourceBlacklist and that their group and kind have wildcards as values.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: appproject-clusterresourceblacklistannotations:policies.kyverno.io/title: Enforce AppProject with clusterResourceBlacklistpolicies.kyverno.io/category: Argopolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.6.2policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.23"policies.kyverno.io/subject: AppProjectpolicies.kyverno.io/description: An AppProject may optionally specify clusterResourceBlacklist which is a blacklisted group of cluster resources. This is often a good practice to ensure AppProjects do not allow more access than needed. This policy is a combination of two rules which enforce that all AppProjects specify clusterResourceBlacklist and that their group and kind have wildcards as values.spec:validationFailureAction: Auditbackground: truerules:- name: has-wildcardmatch:any:- resources:kinds:- AppProjectpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: Wildcards must be present in group and kind for clusterResourceBlacklist.foreach:- list: request.object.spec.clusterResourceBlacklistdeny:conditions:any:- key: "{{ contains(element.group, '*') }}"operator: Equalsvalue: false- key: "{{ contains(element.kind, '*') }}"operator: Equalsvalue: false- name: validate-clusterresourceblacklistmatch:any:- resources:kinds:- AppProjectpreconditions:all:- key: "{{ request.operation || 'BACKGROUND' }}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: AppProject must specify clusterResourceBlacklist.deny:conditions:any:- key: clusterResourceBlacklistoperator: AnyNotInvalue: "{{ request.object.spec.keys(@) }}"
This policy prevents the use of the default project in an Application.
Services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
This policy prevents updates to the project field after an Application is created.