The NFS subdir external provisioner project allows defining a StorageClass with a pathPattern, a template used to provision subdirectories on NFS exports. This can be controlled with an annotation on a PVC called `nfs.io/storage-path`. This policy ensures that if the StorageClass name `nfs-client` is used by a PVC, corresponding to the NFS subdir external provisioner, and if it sets the nfs.io/storage-path annotation that it cannot be empty, which may otherwise result in it consuming the root of the designated path.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: nfs-subdir-external-provisioner-storage-pathannotations:policies.kyverno.io/title: NFS Subdirectory External Provisioner Enforce Storage Pathpolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: PersistentVolumeClaimkyverno.io/kyverno-version: 1.6.2policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.23"policies.kyverno.io/description: The NFS subdir external provisioner project allows defining a StorageClass with a pathPattern, a template used to provision subdirectories on NFS exports. This can be controlled with an annotation on a PVC called `nfs.io/storage-path`. This policy ensures that if the StorageClass name `nfs-client` is used by a PVC, corresponding to the NFS subdir external provisioner, and if it sets the nfs.io/storage-path annotation that it cannot be empty, which may otherwise result in it consuming the root of the designated path.spec:background: falsevalidationFailureAction: Auditrules:- name: enforce-storage-pathmatch:any:- resources:kinds:- PersistentVolumeClaimpreconditions:all:- key: "{{request.operation || 'BACKGROUND'}}"operator: AnyInvalue:- CREATE- UPDATEvalidate:message: nfs.io/storage-path annotation must not be empty.pattern:metadata:"=(annotations)":"=(nfs.io/storage-path)": "?*"spec:<(storageClassName): nfs-client
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.
This policy prevents updates to the project field after an Application is created.