Description of problem: when trying to create migration policy using the yaml attached I get the following error: [akrgupta@fedora auth]$ oc apply -f migration_policy.yaml The MigrationPolicy "policy1" is invalid: * spec.selectors.namespaceSelector.matchLabels: Invalid value: "object": spec.selectors.namespaceSelector.matchLabels in body must be of type string: "object" * spec.selectors.virtualMachineInstanceSelector.matchLabels: Invalid value: "object": spec.selectors.virtualMachineInstanceSelector.matchLabels in body must be of type string: "object" Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Created attachment 1905718 [details] Migration Policy yaml
Blocker as this is Regression.
Hello, A recent commit [1] got rid of the redundant "matchLabels" fields. In other words, please replace your YAML with this one: spec: allowAutoConverge: True bandwidthPerMigration: 512Ki completionTimeoutPerGiB: 50 allowPostCopy: True selectors: namespaceSelector: awesome-namespace: "yes" virtualMachineInstanceSelector: best-vm: "" p.s. please bear in mind that having an empty value does NOT act as a wildcard, but literally as an empty string. The reason I mention this is because there was an intention, followed by a PR [2] (that never got merged), to implement a wildcard this way. Currently this PR is abandoned and we plan to delay this implementation for now (for many reasons). Please confirm that it works. If it does, I think we should close this BZ on "not a bug". [1] https://github.com/kubevirt/kubevirt/pull/7510/commits/cab98e53fbaf0004299582c4617338d0ffa34950 [2] https://github.com/kubevirt/kubevirt/pull/7322
Thanks Itamar I checked with suggested changes , I was able to successfully create migration policy on 4.12 [akrgupta@fedora auth]$ cat migration_policy.yaml apiVersion: migrations.kubevirt.io/v1alpha1 kind: MigrationPolicy metadata: name: policy2 spec: allowAutoConverge: True bandwidthPerMigration: 512Ki completionTimeoutPerGiB: 50 allowPostCopy: True selectors: namespaceSelector: awesome-namespace: "yes" virtualMachineInstanceSelector: best-vm: "" [akrgupta@fedora auth]$ oc apply -f migration_policy.yaml migrationpolicy.migrations.kubevirt.io/policy2 created
Need to update the doc https://docs.openshift.com/container-platform/4.12/virt/live_migration/virt-configuring-live-migration-policies.html the Migration policy yaml in doc contains matchLabels field needs to be removed . Actual : selectors: namespaceSelector: matchLabels: hpc-workloads: "True" xyz-workloads-type: "" virtualMachineInstanceSelector: matchLabels: workload-type: "db" operating-system: "" expected: selectors: namespaceSelector: hpc-workloads: "True" xyz-workloads-type: "" virtualMachineInstanceSelector: workload-type: "db" operating-system: ""
Looks good to me. I've also added a PR to upstream user-guide regarding that: https://github.com/kubevirt/user-guide/pull/671