PersistentVolumeClaims (PVCs) and StatefulSets may optionally define a StorageClass to dynamically provision storage. In a multi-tenancy environment where StorageClasses are far more common, it is often better to require storage only be provisioned from these StorageClasses. This policy requires that PVCs and StatefulSets containing volumeClaimTemplates define the storageClassName field with some value.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-storageclassannotations:policies.kyverno.io/title: Require StorageClasspolicies.kyverno.io/category: Other, Multi-Tenancypolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: PersistentVolumeClaim, StatefulSetpolicies.kyverno.io/description: PersistentVolumeClaims (PVCs) and StatefulSets may optionally define a StorageClass to dynamically provision storage. In a multi-tenancy environment where StorageClasses are far more common, it is often better to require storage only be provisioned from these StorageClasses. This policy requires that PVCs and StatefulSets containing volumeClaimTemplates define the storageClassName field with some value.spec:validationFailureAction: Auditbackground: truerules:- name: pvc-storageclassmatch:any:- resources:kinds:- PersistentVolumeClaimvalidate:message: PersistentVolumeClaims must define a storageClassName.pattern:spec:storageClassName: "?*"- name: ss-storageclassmatch:any:- resources:kinds:- StatefulSetvalidate:message: StatefulSets must define a storageClassName.pattern:spec:"=(volumeClaimTemplates)":- spec:storageClassName: "?*"
This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.