How can I set complete claimRef section of PV object to Null - Gatekeeper Mutation

27 Views Asked by At

Hi I am trying to mutate(gatekeeper) a PV object to make claimRef section to Null when PV object is in released state This is the highlevel logic I am using to test

apiVersion: mutations.gatekeeper.sh/v1
kind: Assign
metadata:
  name: mutate-pv
spec:
  applyTo:
  - groups: [""]
    kinds: ["PersistentVolume"]
    versions: ["v1"]
  match:
    kinds:
    - apiGroups: ["*"]
      kinds: ["PersistentVolume"]
  location: "spec.claimRef"
  parameters:
    assign:
      value: {}

However, when mutated the claimRef is set to "/" and PV reclaimble (Status changed to Available), is there a way to set complete claimRef section to Null?

0

There are 0 best solutions below