Uploaded image for project: 'Red Hat Advanced Cluster Management'
  1. Red Hat Advanced Cluster Management
  2. ACM-18066

GRC dryrun command returns Error: resourceVersion can not be set for Create requests

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • ACM 2.13.0
    • ACM 2.13.0
    • GRC
    • 1
    • False
    • None
    • False
    • GRC Sprint 2025-05
    • Low
    • None

      Description of problem:

      When creating the resource content for the dryrun command, if I grab the pod data from the cluster and save in a yaml file, I get the following error when I run the dryrun command:

      Error: resourceVersion can not be set for Create requests

      Version-Release number of selected component (if applicable):

      2.13.0-SNAPSHOT-2025-02-24-05-54-38

      How reproducible:

      Always I think

      Steps to Reproduce:

      1. For a running pod, capture the pod details with  oc get po sample-nginx-pod -o yaml > pod.yaml
      2. Using the policy https://github.com/open-cluster-management-io/policy-collection/blob/main/stable/CM-Configuration-Management/policy-pod.yaml
      3. Run dryrun with a command like:  policytools dryrun  -p policies/policy-pod.yaml resources/pod.yaml
      4. I get the error: "Error: resourceVersion can not be set for Create requests"

      Actual results:

      Error mentioned above

      Expected results:

      I expected to get Policy analysis in the form of a Diff and Compliant or NonCompliant

      Additional info:

      The workaround is to remove the metadata entry from the pods.yaml resource that looks like:

      resourceVersion: "618991"

       

              yikim@redhat.com Yi Rae Kim
              gparvin-redhat Gus Parvin
              Derek Ho Derek Ho
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: