To extract a YAML file from OpenShift (such as a ConfigMap or DeploymentConfig) while removing unnecessary metadata fields like resourceVersion and uid, use the following command:
oc get cm -o yaml | yq 'del(.metadata.uid, .metadata.resourceVersion)' - > output.yaml
This ensures a clean backup without dynamic metadata fields that may change across deployments.