vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.64k stars 1.39k forks source link

Resource Modifier: Condition matching is incorrect when there are multiple rules #7714

Closed 27149chen closed 4 months ago

27149chen commented 5 months ago

What steps did you take and what happened:

  1. define a resource modifier to update storageClass name in pvc in this rule: a=>b, b=>c
  2. run velero restore
  3. result: a=>c, b=>c
version: v1
resourceModifierRules:
- conditions:
    groupResource: persistentvolumeclaims
  matches:
    - path: "/spec/storageClassName"
      value: "a"
  patches:
  - operation: replace
    path: "/spec/storageClassName"
    value: "b"
- conditions:
    groupResource: persistentvolumeclaims
  matches:
    - path: "/spec/storageClassName"
      value: "b"
  patches:
  - operation: replace
    path: "/spec/storageClassName"
    value: "c"

What did you expect to happen: a=>b, b=>c

Anything else you would like to add: The same problem will occur in other situations if any field that affects the condition matching is changed in patch.

Environment:

Vote on this issue!

This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.