diff --git a/kustomizations/kyverno/pvc-patch.yaml b/kustomizations/kyverno/pvc-patch.yaml new file mode 100644 index 0000000..7691430 --- /dev/null +++ b/kustomizations/kyverno/pvc-patch.yaml @@ -0,0 +1,40 @@ +apiVersion: kyverno.io/v1 +kind: ClusterPolicy +metadata: + name: replace-storage-class-by-openebs +spec: + rules: + - name: replace-storage-class + match: + any: + - resources: + kinds: + - PersistentVolumeClaim + mutate: + patchStrategicMerge: + metadata: + annotations: + volume.beta.kubernetes.io/storage-class: openebs-hostpath + spec: + storageClassName: openebs-hostpath + accessModes: + - ReadWriteOnce + - name: remove-unwanted-annotations + match: + any: + - resources: + kinds: + - PersistentVolumeClaim + namespaces: + - games + mutate: + patchesJson6902: |- + - path: "/metadata/annotations/volume.beta.kubernetes.io~1storage-class" + op: replace + value: openebs-hostpath + - path: "/metadata/annotations/volume.beta.kubernetes.io~1storage-provisioner" + op: replace + value: openebs.io/local + - path: "/metadata/annotations/volume.kubernetes.io~1storage-provisioner" + op: replace + value: openebs.io/local