41 lines
1.2 KiB
YAML
41 lines
1.2 KiB
YAML
|
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
|